Files
productcanvas/js/modules/swot.js
史悦 d74fbce137 现在支持的格式
-  ```svg<svg... 
  -  ```svg <svg... 
  -  ```xml<svg... 
  -  ```xml <svg... 
  -  ``` xml<svg... 
  -  ``` svg<svg... 
  -  ```<svg... (无语言标识)

  这样无论 LLM 输出哪种格式,都能正确实时绘制和复制图片到剪贴板了。
2026-02-03 10:55:17 +08:00

40 lines
932 B
JavaScript

(function registerSwotModule(global) {
'use strict';
if (!global.ModuleRegistry) {
throw new Error('ModuleRegistry 未初始化');
}
const parseResponse = (content) => Utils.parseSVGResponse(content);
global.ModuleRegistry.register({
id: 'swot',
label: 'SWOT分析',
icon: 'ph:chart-bar-duotone',
renderer: 'svg',
promptKey: 'swot',
storageNamespace: 'module:swot',
chat: {
placeholder: '输入业务背景或问题,我来生成 SWOT 分析…',
streamStartToken: '```svg',
contextWindow: 10
},
artifact: {
type: 'svg',
fence: 'svg',
startPattern: /```\s*(?:svg|xml)?\s*<svg/i,
parser: parseResponse
},
hooks: {},
exports: {
allowSvg: true,
allowPng: true,
allowClipboard: true,
allowCode: true
},
ui: {
placeholderText: '生成的SWOT分析将在此处显示'
}
});
})(window);