调整了整个框架,模块化解耦

This commit is contained in:
史悦
2025-10-27 11:04:00 +08:00
parent c83c36baa6
commit 533375e8ca
12 changed files with 1722 additions and 1558 deletions

39
js/modules/swot.js Normal file
View File

@@ -0,0 +1,39 @@
(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: /```(?:svg)?\s*<svg/i,
parser: parseResponse
},
hooks: {},
exports: {
allowSvg: true,
allowPng: true,
allowClipboard: true,
allowCode: true
},
ui: {
placeholderText: '生成的SWOT分析将在此处显示'
}
});
})(window);