@core-pilot/client-vue 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cjs/client-vue.css +1 -1
  2. package/dist/cjs/components/bubble-list/index.js +1 -1
  3. package/dist/cjs/components/bubble-list/index.js.map +1 -1
  4. package/dist/cjs/components/core-upload/index.js +1 -1
  5. package/dist/cjs/components/core-upload/index.js.map +1 -1
  6. package/dist/cjs/components/editor-sender/index.js +1 -1
  7. package/dist/cjs/components/editor-sender/index.js.map +1 -1
  8. package/dist/cjs/components/x-markdown/composables/useFormHandler.js +2 -0
  9. package/dist/cjs/components/x-markdown/composables/useFormHandler.js.map +1 -0
  10. package/dist/cjs/components/x-markdown/composables/useImageLoader.js +2 -0
  11. package/dist/cjs/components/x-markdown/composables/useImageLoader.js.map +1 -0
  12. package/dist/cjs/components/x-markdown/composables/useMarkdownProcessor.js +2 -0
  13. package/dist/cjs/components/x-markdown/composables/useMarkdownProcessor.js.map +1 -0
  14. package/dist/cjs/components/x-markdown/composables/useRefHandler.js +2 -0
  15. package/dist/cjs/components/x-markdown/composables/useRefHandler.js.map +1 -0
  16. package/dist/cjs/components/x-markdown/composables/useStreamHandler.js +2 -0
  17. package/dist/cjs/components/x-markdown/composables/useStreamHandler.js.map +1 -0
  18. package/dist/cjs/components/x-markdown/index.js +1 -1
  19. package/dist/cjs/components/x-markdown/index.js.map +1 -1
  20. package/dist/cjs/components/x-markdown/renderers/hastRenderer.js +2 -0
  21. package/dist/cjs/components/x-markdown/renderers/hastRenderer.js.map +1 -0
  22. package/dist/cjs/components/x-markdown/utils/disabledUtils.js +2 -0
  23. package/dist/cjs/components/x-markdown/utils/disabledUtils.js.map +1 -0
  24. package/dist/cjs/components/x-markdown/utils/formUtils.js +2 -0
  25. package/dist/cjs/components/x-markdown/utils/formUtils.js.map +1 -0
  26. package/dist/cjs/components/x-markdown/utils/jsonUtils.js +2 -0
  27. package/dist/cjs/components/x-markdown/utils/jsonUtils.js.map +1 -0
  28. package/dist/cjs/components/x-markdown/utils/parseCorePilotSchema.js +1 -1
  29. package/dist/cjs/components/x-markdown/utils/parseCorePilotSchema.js.map +1 -1
  30. package/dist/cjs/components/x-markdown/utils/refUtils.js +2 -0
  31. package/dist/cjs/components/x-markdown/utils/refUtils.js.map +1 -0
  32. package/dist/cjs/components/x-markdown/utils/textFormatUtils.js +2 -0
  33. package/dist/cjs/components/x-markdown/utils/textFormatUtils.js.map +1 -0
  34. package/dist/es/client-vue.css +1 -1
  35. package/dist/es/components/bubble-list/index.js +3 -0
  36. package/dist/es/components/bubble-list/index.js.map +1 -1
  37. package/dist/es/components/core-upload/index.js +33 -24
  38. package/dist/es/components/core-upload/index.js.map +1 -1
  39. package/dist/es/components/editor-sender/index.js +39 -16
  40. package/dist/es/components/editor-sender/index.js.map +1 -1
  41. package/dist/es/components/x-markdown/composables/useFormHandler.js +66 -0
  42. package/dist/es/components/x-markdown/composables/useFormHandler.js.map +1 -0
  43. package/dist/es/components/x-markdown/composables/useImageLoader.js +58 -0
  44. package/dist/es/components/x-markdown/composables/useImageLoader.js.map +1 -0
  45. package/dist/es/components/x-markdown/composables/useMarkdownProcessor.js +48 -0
  46. package/dist/es/components/x-markdown/composables/useMarkdownProcessor.js.map +1 -0
  47. package/dist/es/components/x-markdown/composables/useRefHandler.js +80 -0
  48. package/dist/es/components/x-markdown/composables/useRefHandler.js.map +1 -0
  49. package/dist/es/components/x-markdown/composables/useStreamHandler.js +45 -0
  50. package/dist/es/components/x-markdown/composables/useStreamHandler.js.map +1 -0
  51. package/dist/es/components/x-markdown/index.js +85 -646
  52. package/dist/es/components/x-markdown/index.js.map +1 -1
  53. package/dist/es/components/x-markdown/renderers/hastRenderer.js +427 -0
  54. package/dist/es/components/x-markdown/renderers/hastRenderer.js.map +1 -0
  55. package/dist/es/components/x-markdown/utils/disabledUtils.js +15 -0
  56. package/dist/es/components/x-markdown/utils/disabledUtils.js.map +1 -0
  57. package/dist/es/components/x-markdown/utils/formUtils.js +82 -0
  58. package/dist/es/components/x-markdown/utils/formUtils.js.map +1 -0
  59. package/dist/es/components/x-markdown/utils/jsonUtils.js +20 -0
  60. package/dist/es/components/x-markdown/utils/jsonUtils.js.map +1 -0
  61. package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js +10 -0
  62. package/dist/es/components/x-markdown/utils/parseCorePilotSchema.js.map +1 -1
  63. package/dist/es/components/x-markdown/utils/refUtils.js +18 -0
  64. package/dist/es/components/x-markdown/utils/refUtils.js.map +1 -0
  65. package/dist/es/components/x-markdown/utils/textFormatUtils.js +46 -0
  66. package/dist/es/components/x-markdown/utils/textFormatUtils.js.map +1 -0
  67. package/package.json +1 -1
@@ -0,0 +1,15 @@
1
+ const checkDisabled = (node, context) => {
2
+ const { properties = {}, parentScope } = node;
3
+ const { disabled } = properties;
4
+ if (disabled) {
5
+ return true;
6
+ }
7
+ if (parentScope === "form") {
8
+ return context.isHistoryMessage && !context.isRewrite;
9
+ }
10
+ return false;
11
+ };
12
+ export {
13
+ checkDisabled
14
+ };
15
+ //# sourceMappingURL=disabledUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disabledUtils.js","sources":["../../../../../src/components/x-markdown/utils/disabledUtils.ts"],"sourcesContent":["/**\n * 禁用状态相关工具函数\n * 规范了组件禁用状态的判断逻辑\n */\n\nimport { InputSchema } from '@/types/index.ts';\n\nexport interface DisabledCheckContext {\n isHistoryMessage: boolean;\n isRewrite: boolean;\n}\n\n/**\n * 检查节点是否应该被禁用\n * \n * 规范说明:\n * - 如果节点本身设置了 disabled 属性,则禁用\n * - 如果节点在 form 作用域内,且是历史消息且未处于重写状态,则禁用\n * - 其他情况不禁用\n * \n * @param node - 输入节点 schema\n * @param context - 禁用检查上下文\n * @returns 是否应该禁用\n */\nexport const checkDisabled = (\n node: InputSchema,\n context: DisabledCheckContext\n): boolean => {\n const { properties = {}, parentScope } = node;\n const { disabled } = properties;\n \n // 如果节点本身设置了 disabled,则禁用\n if (disabled) {\n return true;\n }\n \n // 如果当前是历史消息,且父级作用域为 form,且未处于重写状态,则禁用\n if (parentScope === 'form') {\n return context.isHistoryMessage && !context.isRewrite;\n }\n \n return false;\n};\n\n"],"names":[],"mappings":"AAwBO,MAAM,gBAAgB,CAC3B,MACA,YACY;AACZ,QAAM,EAAE,aAAa,IAAI,gBAAgB;AACzC,QAAM,EAAE,aAAa;AAGrB,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AAGA,MAAI,gBAAgB,QAAQ;AAC1B,WAAO,QAAQ,oBAAoB,CAAC,QAAQ;AAAA,EAC9C;AAEA,SAAO;AACT;"}
@@ -0,0 +1,82 @@
1
+ const collectFormsFromSchema = (schema, formDataList, formIndex = 0, historyInputsMap) => {
2
+ var _a;
3
+ if (!schema || typeof schema !== "object") return formIndex;
4
+ if (schema.type === "form") {
5
+ const formData = {
6
+ ...((_a = schema.properties) == null ? void 0 : _a.data) || {},
7
+ // 支持多表单场景:根据表单索引获取对应的 historyInputs
8
+ ...(historyInputsMap == null ? void 0 : historyInputsMap[formIndex]) || {}
9
+ };
10
+ formDataList.push(formData);
11
+ return formIndex + 1;
12
+ }
13
+ if (Array.isArray(schema.children)) {
14
+ let currentFormIndex = formIndex;
15
+ schema.children.forEach((child) => {
16
+ currentFormIndex = collectFormsFromSchema(
17
+ child,
18
+ formDataList,
19
+ currentFormIndex,
20
+ historyInputsMap
21
+ );
22
+ });
23
+ return currentFormIndex;
24
+ }
25
+ return formIndex;
26
+ };
27
+ const computedForm = (mdAst, historyInputsMap) => {
28
+ const formDataList = [];
29
+ const preNodes = [];
30
+ const findPreNodes = (node) => {
31
+ if (!node) return;
32
+ if (node.tagName === "pre") {
33
+ preNodes.push(node);
34
+ }
35
+ if (Array.isArray(node.children)) {
36
+ node.children.forEach(findPreNodes);
37
+ }
38
+ };
39
+ if (Array.isArray(mdAst.children)) {
40
+ mdAst.children.forEach(findPreNodes);
41
+ }
42
+ preNodes.forEach((preNode) => {
43
+ var _a, _b, _c, _d, _e;
44
+ const codeNode = (_a = preNode.children) == null ? void 0 : _a.find((child) => child.tagName === "code");
45
+ if ((_c = (_b = codeNode == null ? void 0 : codeNode.properties) == null ? void 0 : _b.className) == null ? void 0 : _c.includes("language-CorePilot")) {
46
+ try {
47
+ const code = ((_e = (_d = codeNode.children) == null ? void 0 : _d[0]) == null ? void 0 : _e.value) || "";
48
+ if (code) {
49
+ const schema = JSON.parse(code);
50
+ collectFormsFromSchema(schema, formDataList, 0, historyInputsMap);
51
+ }
52
+ } catch (error) {
53
+ console.error("Failed to parse CorePilot schema:", error);
54
+ }
55
+ }
56
+ });
57
+ return formDataList;
58
+ };
59
+ const normalizeHistoryInputs = (historyInputs) => {
60
+ if (!historyInputs) return void 0;
61
+ if (typeof historyInputs === "object" && !Array.isArray(historyInputs)) {
62
+ const keys = Object.keys(historyInputs);
63
+ const isFormDataMap = keys.some((key) => /^\d+$/.test(key));
64
+ if (isFormDataMap) {
65
+ const result = {};
66
+ keys.forEach((key) => {
67
+ const numKey = parseInt(key, 10);
68
+ if (!isNaN(numKey)) {
69
+ result[numKey] = historyInputs[key];
70
+ }
71
+ });
72
+ return result;
73
+ }
74
+ }
75
+ return { 0: historyInputs };
76
+ };
77
+ export {
78
+ collectFormsFromSchema,
79
+ computedForm,
80
+ normalizeHistoryInputs
81
+ };
82
+ //# sourceMappingURL=formUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formUtils.js","sources":["../../../../../src/components/x-markdown/utils/formUtils.ts"],"sourcesContent":["/**\n * 表单相关工具函数\n */\n\n/**\n * 表单数据映射接口\n * 用于支持多表单场景,每个表单可以有独立的 historyInputs\n */\nexport interface FormDataMap {\n [formIndex: number]: Record<string, any>;\n}\n\n/**\n * 递归遍历 schema,收集所有 form 表单及其 data 属性\n * 支持多表单场景:每个表单可以有独立的 historyInputs\n * \n * @param schema - CorePilot schema 对象\n * @param formDataList - 用于存储收集到的 form data 的数组\n * @param formIndex - 当前表单索引(用于多表单场景)\n * @param historyInputsMap - 历史输入映射,支持多表单场景\n * @returns void\n */\nexport const collectFormsFromSchema = (\n schema: any,\n formDataList: Array<Record<string, any>>,\n formIndex: number = 0,\n historyInputsMap?: FormDataMap\n): number => {\n if (!schema || typeof schema !== 'object') return formIndex;\n \n // 如果当前节点是 form,收集其 data 属性\n if (schema.type === 'form') {\n const formData = {\n ...schema.properties?.data || {},\n // 支持多表单场景:根据表单索引获取对应的 historyInputs\n ...(historyInputsMap?.[formIndex] || {}),\n };\n formDataList.push(formData);\n return formIndex + 1; // 返回下一个表单索引\n }\n \n // 递归遍历 children 数组\n if (Array.isArray(schema.children)) {\n let currentFormIndex = formIndex;\n schema.children.forEach((child) => {\n currentFormIndex = collectFormsFromSchema(\n child,\n formDataList,\n currentFormIndex,\n historyInputsMap\n );\n });\n return currentFormIndex;\n }\n \n return formIndex;\n};\n\n/**\n * 计算 markdown AST 中所有 form 表单的数量,并提取每个 form 的预定义数据\n * 支持多表单场景\n * \n * @param mdAst - markdown AST 对象\n * @param historyInputsMap - 历史输入映射,支持多表单场景\n * @returns form data 列表\n */\nexport const computedForm = (\n mdAst: any,\n historyInputsMap?: FormDataMap\n): Array<Record<string, any>> => {\n const formDataList: Array<Record<string, any>> = [];\n \n // 高效检索:直接查找所有 pre 标签\n const preNodes: any[] = [];\n const findPreNodes = (node: any) => {\n if (!node) return;\n if (node.tagName === \"pre\") {\n preNodes.push(node);\n }\n if (Array.isArray(node.children)) {\n node.children.forEach(findPreNodes);\n }\n };\n \n // 遍历 mdAst 查找所有 pre 节点\n if (Array.isArray(mdAst.children)) {\n mdAst.children.forEach(findPreNodes);\n }\n \n // 处理每个 pre 节点中的 CorePilot 代码块\n preNodes.forEach((preNode: any) => {\n const codeNode = preNode.children?.find((child: any) => child.tagName === \"code\");\n if (codeNode?.properties?.className?.includes(\"language-CorePilot\")) {\n try {\n const code = codeNode.children?.[0]?.value || '';\n if (code) {\n const schema = JSON.parse(code);\n // 递归收集所有 form,支持多表单场景\n collectFormsFromSchema(schema, formDataList, 0, historyInputsMap);\n }\n } catch (error) {\n console.error('Failed to parse CorePilot schema:', error);\n }\n }\n });\n \n return formDataList;\n};\n\n/**\n * 将单个 historyInputs 对象转换为表单索引映射\n * 用于向后兼容:如果传入的是单个对象,则将其映射到第一个表单\n * \n * @param historyInputs - 历史输入对象(单个或多个)\n * @returns 表单数据映射\n */\nexport const normalizeHistoryInputs = (\n historyInputs?: Record<string, any> | FormDataMap\n): FormDataMap | undefined => {\n if (!historyInputs) return undefined;\n \n // 如果已经是 FormDataMap 格式,直接返回\n if (typeof historyInputs === 'object' && !Array.isArray(historyInputs)) {\n // 检查是否是 FormDataMap 格式(键是数字字符串)\n const keys = Object.keys(historyInputs);\n const isFormDataMap = keys.some(key => /^\\d+$/.test(key));\n \n if (isFormDataMap) {\n // 转换为数字键\n const result: FormDataMap = {};\n keys.forEach(key => {\n const numKey = parseInt(key, 10);\n if (!isNaN(numKey)) {\n result[numKey] = historyInputs[key];\n }\n });\n return result;\n }\n }\n \n // 向后兼容:单个对象映射到第一个表单\n return { 0: historyInputs as Record<string, any> };\n};\n\n"],"names":[],"mappings":"AAsBO,MAAM,yBAAyB,CACpC,QACA,cACA,YAAoB,GACpB,qBACW;AALN;AAML,MAAI,CAAC,UAAU,OAAO,WAAW,SAAU,QAAO;AAGlD,MAAI,OAAO,SAAS,QAAQ;AAC1B,UAAM,WAAW;AAAA,MACf,KAAG,YAAO,eAAP,mBAAmB,SAAQ,CAAA;AAAA;AAAA,MAE9B,IAAI,qDAAmB,eAAc,CAAA;AAAA,IAAC;AAExC,iBAAa,KAAK,QAAQ;AAC1B,WAAO,YAAY;AAAA,EACrB;AAGA,MAAI,MAAM,QAAQ,OAAO,QAAQ,GAAG;AAClC,QAAI,mBAAmB;AACvB,WAAO,SAAS,QAAQ,CAAC,UAAU;AACjC,yBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAA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ClB,cAAM,SAAS,SAAS,KAAK,EAAE;AAC/B,YAAI,CAAC,MAAM,MAAM,GAAG;AAClB,iBAAO,MAAM,IAAI,cAAc,GAAG;AAAA,QACpC;AAAA,MACF,CAAC;AACD,aAAO;AAAA,IACT;AAAA,EACF;AAGA,SAAO,EAAE,GAAG,cAAA;AACd;"}
@@ -0,0 +1,20 @@
1
+ const isCompleteJSON = (jsonStr) => {
2
+ if (!jsonStr || jsonStr.trim().length === 0) {
3
+ return false;
4
+ }
5
+ const trimmed = jsonStr.trim();
6
+ const firstChar = trimmed[0];
7
+ if (firstChar !== "{" && firstChar !== "[") {
8
+ return false;
9
+ }
10
+ try {
11
+ JSON.parse(trimmed);
12
+ return true;
13
+ } catch (error) {
14
+ return false;
15
+ }
16
+ };
17
+ export {
18
+ isCompleteJSON
19
+ };
20
+ //# sourceMappingURL=jsonUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsonUtils.js","sources":["../../../../../src/components/x-markdown/utils/jsonUtils.ts"],"sourcesContent":["/**\n * JSON 相关工具函数\n */\n\n/**\n * 检测 JSON 字符串是否完整\n * 使用最高效的方式:快速检查基本结构后直接尝试解析\n */\nexport const isCompleteJSON = (jsonStr: string): boolean => {\n if (!jsonStr || jsonStr.trim().length === 0) {\n return false;\n }\n \n const trimmed = jsonStr.trim();\n \n // 快速检查:必须以 { 或 [ 开头\n const firstChar = trimmed[0];\n if (firstChar !== '{' && firstChar !== '[') {\n return false;\n }\n \n // 直接尝试解析,如果成功就是完整的 JSON\n try {\n JSON.parse(trimmed);\n return true;\n } catch (error) {\n // 解析失败,说明 JSON 不完整或格式错误\n return false;\n }\n};\n\n"],"names":[],"mappings":"AAQO,MAAM,iBAAiB,CAAC,YAA6B;AAC1D,MAAI,CAAC,WAAW,QAAQ,KAAA,EAAO,WAAW,GAAG;AAC3C,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,QAAQ,KAAA;AAGxB,QAAM,YAAY,QAAQ,CAAC;AAC3B,MAAI,cAAc,OAAO,cAAc,KAAK;AAC1C,WAAO;AAAA,EACT;AAGA,MAAI;AACF,SAAK,MAAM,OAAO;AAClB,WAAO;AAAA,EACT,SAAS,OAAO;AAEd,WAAO;AAAA,EACT;AACF;"}
@@ -38,6 +38,8 @@ const parseSchema = (schema, type) => {
38
38
  return parseRadio(schema, type);
39
39
  case "echart":
40
40
  return parseECharts(schema, type);
41
+ case "upload":
42
+ return parseUpload(schema, type);
41
43
  default:
42
44
  const _ = schema;
43
45
  console.error(_);
@@ -299,6 +301,14 @@ const parseECharts = (schema, parentType) => {
299
301
  parentScope: parentType
300
302
  };
301
303
  };
304
+ const parseUpload = (schema, parentType) => {
305
+ return {
306
+ tagName: "CoreUpload",
307
+ type: "element",
308
+ properties: schema.properties,
309
+ parentScope: parentType
310
+ };
311
+ };
302
312
  const parseCorePilot = (schema) => {
303
313
  return parseSchema(schema);
304
314
  };
@@ -1 +1 @@
1
- {"version":3,"file":"parseCorePilotSchema.js","sources":["../../../../../src/components/x-markdown/utils/parseCorePilotSchema.ts"],"sourcesContent":["import { \n FormSchema, \n ViewSchema,\n FormFieldSchema, \n CardSchema, \n ButtonSchema, \n TableSchema, \n TipsSchema, \n TextSchema, \n InputSchema, \n SelectSchema, \n DateTimePickerSchema, \n TableColumnSchema, \n RowSchema, \n ColSchema, \n ResultSchema, \n TagSchema,\n RadioGroupSchema,\n RadioSchema,\n EChartsSchema,\n} from '@/types/index';\n\ntype ElementSchema = \n | ViewSchema<any> \n | FormSchema \n | FormFieldSchema \n | CardSchema \n | ButtonSchema \n | TableSchema \n | TipsSchema \n | TextSchema \n | InputSchema \n | SelectSchema \n | DateTimePickerSchema \n | TableColumnSchema \n | RowSchema \n | ColSchema \n | ResultSchema \n | TagSchema \n | RadioGroupSchema \n | RadioSchema\n | EChartsSchema;\n\ntype ParentScopeType = 'form' | 'table';\n\nconst parseSchema = (schema: ElementSchema, type?: ParentScopeType) => {\n switch (schema.type) {\n case 'view':\n return parseView(schema);\n case 'form':\n return parseForm(schema);\n case 'card':\n return parseCard(schema);\n case 'table':\n return parseTable(schema);\n case 'input':\n return parseInput(schema, type);\n case 'select':\n return parseSelect(schema, type);\n case 'dateTimePicker':\n return parseDate(schema, type);\n case 'button':\n return parseButton(schema, type);\n case 'tips':\n return parseTips(schema, type);\n case 'text':\n return parseText(schema, type);\n case 'formfield':\n return parseFormItem(schema, type);\n case 'column':\n return parseTableColumn(schema, type);\n case 'row':\n return parseRow(schema, type);\n case 'col':\n return parseCol(schema, type);\n case 'result':\n return parseResult(schema, type);\n case 'tag':\n return parseTag(schema, type);\n case 'radioGroup':\n return parseRadioGroup(schema, type);\n case 'radio':\n return parseRadio(schema, type);\n case 'echart':\n return parseECharts(schema, type);\n default:\n const _: never = schema;\n console.error(_);\n }\n}\n\n// result组件解析\nconst parseResult = (schema: ResultSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreResult',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\n// view组件解析\nconst parseView = (schema: ViewSchema<any>) => {\n return {\n tagName: 'view',\n type: 'element',\n properties: {\n title: schema.title,\n },\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n }\n}\n\n// form组件解析\nconst parseForm = (schema: FormSchema) => {\n const children: any[] = [] \n schema.fields.forEach((item) => {\n children.push(parseSchema(item, 'form'));\n });\n const actionChild = {\n tagName: 'div',\n type: 'element',\n properties: {\n class: 'hitl-btn-list',\n },\n children: schema.actions.map((item) => {\n return parseSchema(item, 'form');\n })\n }\n children.push(actionChild);\n return {\n tagName: 'ElForm',\n type: 'element',\n properties: {\n labelPosition: 'right',\n ...schema.properties,\n },\n children,\n }\n}\n\nconst parseInput = (schema: InputSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElInput',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseSelect = (schema: SelectSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElSelect',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseDate = (schema: DateTimePickerSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElDatePicker',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseButton = (schema: ButtonSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElButton',\n type: 'element',\n properties: {\n ...schema.properties,\n action: schema.action,\n payload: schema.payload,\n },\n // TODO 记录父级作用域,用于在form、table 组件中使用\n parentScope: type,\n children: schema.children?.map?.((item) => {\n return parseSchema(item, type);\n })\n }\n}\n\nconst parseCard = (schema: CardSchema) => {\n const result: any = {\n tagName: 'CoreCard',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n };\n \n // 处理 header 插槽\n if (schema.slots?.header) {\n result.slots = {\n header: schema.slots.header.map((item) => {\n return parseSchema(item);\n })\n };\n }\n \n return result;\n}\n\nconst parseTableColumn = (schema: TableColumnSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElTableColumn',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children?.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseTable = (schema: TableSchema) => {\n // 兼容旧版本不存在tableProps属性\n if (!schema.properties.tableProps) {\n schema.properties.tableProps = {\n data: [],\n ...schema.properties,\n };\n }\n return {\n tagName: 'ElTable',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, 'table');\n })\n }\n}\n\n\nconst parseTips = (schema: TipsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreTips',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseText = (schema: TextSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreText',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\nconst injectFormProp = (schema: FormFieldSchema['children'], prop: string) => {\n return schema.map((item) => {\n return {\n ...item,\n properties: {\n ...item.properties,\n formProp: prop,\n },\n }\n })\n}\nconst parseFormItem = (schema: FormFieldSchema, parentType?: ParentScopeType) => {\n const prop = schema.properties.prop;\n const children = injectFormProp(schema.children, prop);\n const formatRules = (rules: FormFieldSchema['properties']['rules']) => {\n return rules?.map((item) => {\n if ('pattern' in item && item.pattern) {\n return {\n pattern: new RegExp(item.pattern),\n message: item.message,\n trigger: item.trigger,\n }\n }\n return item;\n })\n }\n return {\n tagName: 'ElFormItem',\n type: 'element',\n properties: {\n ...schema.properties,\n rules: formatRules(schema.properties.rules),\n },\n parentScope: parentType,\n children: [\n parseSchema(children[0] as InputSchema, parentType),\n ]\n }\n}\n\nconst parseRow = (schema: RowSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRow',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseCol = (schema: ColSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElCol',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as ElementSchema, parentType);\n })\n }\n}\n\nconst parseRadioGroup = (schema: RadioGroupSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadioGroup',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.properties.options?.map((item) => {\n return parseSchema({\n type: 'radio',\n properties: item,\n } as RadioSchema, parentType);\n })\n }\n}\n\nconst parseRadio = (schema: RadioSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadio',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseTag = (schema: TagSchema, parentType?: ParentScopeType) => {\n const formatSchema = {\n tagName: 'ElTag',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as TextSchema, parentType);\n })\n }\n if (parentType === 'table') {\n formatSchema.value = schema.value;\n }\n return formatSchema;\n}\n\n// ECharts 图表解析\nconst parseECharts = (schema: EChartsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreChart',\n type: 'element' as const,\n properties: schema.properties,\n parentScope: parentType,\n };\n}\n\nexport const parseCorePilot = (schema: ViewSchema<any>) => {\n return parseSchema(schema);\n}"],"names":[],"mappings":"AA6CA,MAAM,cAAc,CAAC,QAAuB,SAA2B;AACrE,UAAQ,OAAO,MAAA;AAAA,IACb,KAAK;AACH,aAAO,UAAU,MAAM;AAAA,IACzB,KAAK;AACH,aAAO,UAAU,MAAM;AAAA,IACzB,KAAK;AACH,aAAO,UAAU,MAAM;AAAA,IACzB,KAAK;AACH,aAAO,WAAW,MAAM;AAAA,IAC1B,KAAK;AACH,aAAO,WAAW,QAAQ,IAAI;AAAA,IAChC,KAAK;AACH,aAAO,YAAY,QAAQ,IAAI;AAAA,IACjC,KAAK;AACH,aAAO,UAAU,QAAQ,IAAI;AAAA,IAC/B,KAAK;AACH,aAAO,YAAY,QAAQ,IAAI;AAAA,IACjC,KAAK;AACH,aAAO,UAAU,QAAQ,IAAI;AAAA,IAC/B,KAAK;AACH,aAAO,UAAU,QAAQ,IAAI;AAAA,IAC/B,KAAK;AACH,aAAO,cAAc,QAAQ,IAAI;AAAA,IACnC,KAAK;AACH,aAAO,iBAAiB,QAAQ,IAAI;AAAA,IACtC,KAAK;AACH,aAAO,SAAS,QAAQ,IAAI;AAAA,IAC9B,KAAK;AACH,aAAO,SAAS,QAAQ,IAAI;AAAA,IAC9B,KAAK;AACH,aAAO,YAAY,QAAQ,IAAI;AAAA,IACjC,KAAK;AACH,aAAO,SAAS,QAAQ,IAAI;AAAA,IAC9B,KAAK;AACH,aAAO,gBAAgB,QAAQ,IAAI;AAAA,IACrC,KAAK;AACH,aAAO,WAAW,QAAQ,IAAI;AAAA,IAChC,KAAK;AACH,aAAO,aAAa,QAAQ,IAAI;AAAA,IAClC;AACE,YAAM,IAAW;AACjB,cAAQ,MAAM,CAAC;AAAA,EAAA;AAErB;AAGA,MAAM,cAAc,CAAC,QAAsB,eAAiC;AAC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AC;AAAA,EAAA;AAEH,MAAI,eAAe,SAAS;AAC1B,iBAAa,QAAQ,OAAO;AAAA,EAC9B;AACA,SAAO;AACT;AAGA,MAAM,eAAe,CAAC,QAAuB,eAAiC;AAC5E,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,YAAY,OAAO;AAAA,IACnB,aAAa;AAAA,EAAA;AAEjB;AAEO,MAAM,iBAAiB,CAAC,WAA4B;AACzD,SAAO,YAAY,MAAM;AAC3B;"}
1
+ {"version":3,"file":"parseCorePilotSchema.js","sources":["../../../../../src/components/x-markdown/utils/parseCorePilotSchema.ts"],"sourcesContent":["import { \n FormSchema, \n ViewSchema,\n FormFieldSchema, \n CardSchema, \n ButtonSchema, \n TableSchema, \n TipsSchema, \n TextSchema, \n InputSchema, \n SelectSchema, \n DateTimePickerSchema, \n TableColumnSchema, \n RowSchema, \n ColSchema, \n ResultSchema, \n TagSchema,\n RadioGroupSchema,\n RadioSchema,\n EChartsSchema,\n UploadSchema,\n} from '@/types/index';\n\ntype ElementSchema = \n | ViewSchema<any> \n | FormSchema \n | FormFieldSchema \n | CardSchema \n | ButtonSchema \n | TableSchema \n | TipsSchema \n | TextSchema \n | InputSchema \n | SelectSchema \n | DateTimePickerSchema \n | TableColumnSchema \n | RowSchema \n | ColSchema \n | ResultSchema \n | TagSchema \n | RadioGroupSchema \n | RadioSchema\n | EChartsSchema\n | UploadSchema;\n\ntype ParentScopeType = 'form' | 'table';\n\nconst parseSchema = (schema: ElementSchema, type?: ParentScopeType) => {\n switch (schema.type) {\n case 'view':\n return parseView(schema);\n case 'form':\n return parseForm(schema);\n case 'card':\n return parseCard(schema);\n case 'table':\n return parseTable(schema);\n case 'input':\n return parseInput(schema, type);\n case 'select':\n return parseSelect(schema, type);\n case 'dateTimePicker':\n return parseDate(schema, type);\n case 'button':\n return parseButton(schema, type);\n case 'tips':\n return parseTips(schema, type);\n case 'text':\n return parseText(schema, type);\n case 'formfield':\n return parseFormItem(schema, type);\n case 'column':\n return parseTableColumn(schema, type);\n case 'row':\n return parseRow(schema, type);\n case 'col':\n return parseCol(schema, type);\n case 'result':\n return parseResult(schema, type);\n case 'tag':\n return parseTag(schema, type);\n case 'radioGroup':\n return parseRadioGroup(schema, type);\n case 'radio':\n return parseRadio(schema, type);\n case 'echart':\n return parseECharts(schema, type);\n case 'upload':\n return parseUpload(schema, type);\n default:\n const _: never = schema;\n console.error(_);\n }\n}\n\n// result组件解析\nconst parseResult = (schema: ResultSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreResult',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\n// view组件解析\nconst parseView = (schema: ViewSchema<any>) => {\n return {\n tagName: 'view',\n type: 'element',\n properties: {\n title: schema.title,\n },\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n }\n}\n\n// form组件解析\nconst parseForm = (schema: FormSchema) => {\n const children: any[] = [] \n schema.fields.forEach((item) => {\n children.push(parseSchema(item, 'form'));\n });\n const actionChild = {\n tagName: 'div',\n type: 'element',\n properties: {\n class: 'hitl-btn-list',\n },\n children: schema.actions.map((item) => {\n return parseSchema(item, 'form');\n })\n }\n children.push(actionChild);\n return {\n tagName: 'ElForm',\n type: 'element',\n properties: {\n labelPosition: 'right',\n ...schema.properties,\n },\n children,\n }\n}\n\nconst parseInput = (schema: InputSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElInput',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseSelect = (schema: SelectSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElSelect',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseDate = (schema: DateTimePickerSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElDatePicker',\n type: 'element',\n properties: schema.properties,\n parentScope: type,\n }\n}\n\nconst parseButton = (schema: ButtonSchema, type?: ParentScopeType) => {\n return {\n tagName: 'ElButton',\n type: 'element',\n properties: {\n ...schema.properties,\n action: schema.action,\n payload: schema.payload,\n },\n // TODO 记录父级作用域,用于在form、table 组件中使用\n parentScope: type,\n children: schema.children?.map?.((item) => {\n return parseSchema(item, type);\n })\n }\n}\n\nconst parseCard = (schema: CardSchema) => {\n const result: any = {\n tagName: 'CoreCard',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item);\n })\n };\n \n // 处理 header 插槽\n if (schema.slots?.header) {\n result.slots = {\n header: schema.slots.header.map((item) => {\n return parseSchema(item);\n })\n };\n }\n \n return result;\n}\n\nconst parseTableColumn = (schema: TableColumnSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElTableColumn',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children?.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseTable = (schema: TableSchema) => {\n // 兼容旧版本不存在tableProps属性\n if (!schema.properties.tableProps) {\n schema.properties.tableProps = {\n data: [],\n ...schema.properties,\n };\n }\n return {\n tagName: 'ElTable',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, 'table');\n })\n }\n}\n\n\nconst parseTips = (schema: TipsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreTips',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseText = (schema: TextSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreText',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\nconst injectFormProp = (schema: FormFieldSchema['children'], prop: string) => {\n return schema.map((item) => {\n return {\n ...item,\n properties: {\n ...item.properties,\n formProp: prop,\n },\n }\n })\n}\nconst parseFormItem = (schema: FormFieldSchema, parentType?: ParentScopeType) => {\n const prop = schema.properties.prop;\n const children = injectFormProp(schema.children, prop);\n const formatRules = (rules: FormFieldSchema['properties']['rules']) => {\n return rules?.map((item) => {\n if ('pattern' in item && item.pattern) {\n return {\n pattern: new RegExp(item.pattern),\n message: item.message,\n trigger: item.trigger,\n }\n }\n return item;\n })\n }\n return {\n tagName: 'ElFormItem',\n type: 'element',\n properties: {\n ...schema.properties,\n rules: formatRules(schema.properties.rules),\n },\n parentScope: parentType,\n children: [\n parseSchema(children[0] as InputSchema, parentType),\n ]\n }\n}\n\nconst parseRow = (schema: RowSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRow',\n type: 'element',\n properties: schema.properties,\n children: schema.children.map((item) => {\n return parseSchema(item, parentType);\n })\n }\n}\n\nconst parseCol = (schema: ColSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElCol',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as ElementSchema, parentType);\n })\n }\n}\n\nconst parseRadioGroup = (schema: RadioGroupSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadioGroup',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.properties.options?.map((item) => {\n return parseSchema({\n type: 'radio',\n properties: item,\n } as RadioSchema, parentType);\n })\n }\n}\n\nconst parseRadio = (schema: RadioSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'ElRadio',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n }\n}\n\nconst parseTag = (schema: TagSchema, parentType?: ParentScopeType) => {\n const formatSchema = {\n tagName: 'ElTag',\n type: 'element',\n properties: schema.properties,\n parentScope: parentType,\n children: schema.children.map((item) => {\n return parseSchema(item as TextSchema, parentType);\n })\n }\n if (parentType === 'table') {\n formatSchema.value = schema.value;\n }\n return formatSchema;\n}\n\n// ECharts 图表解析\nconst parseECharts = (schema: EChartsSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreChart',\n type: 'element' as const,\n properties: schema.properties,\n parentScope: parentType,\n };\n}\n\n// Upload 上传组件解析\nconst parseUpload = (schema: UploadSchema, parentType?: ParentScopeType) => {\n return {\n tagName: 'CoreUpload',\n type: 'element' as const,\n properties: schema.properties,\n parentScope: parentType,\n };\n}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AAS;AAC1B,iBAAa,QAAQ,OAAO;AAAA,EAC9B;AACA,SAAO;AACT;AAGA,MAAM,eAAe,CAAC,QAAuB,eAAiC;AAC5E,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,YAAY,OAAO;AAAA,IACnB,aAAa;AAAA,EAAA;AAEjB;AAGA,MAAM,cAAc,CAAC,QAAsB,eAAiC;AAC1E,SAAO;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,YAAY,OAAO;AAAA,IACnB,aAAa;AAAA,EAAA;AAEjB;AAEO,MAAM,iBAAiB,CAAC,WAA4B;AACzD,SAAO,YAAY,MAAM;AAC3B;"}
@@ -0,0 +1,18 @@
1
+ const checkAndReturnRefList = (text) => {
2
+ const reg = /<div hidden>([\s\S]*?)<\/div>/g;
3
+ const match = reg.exec(text);
4
+ if (!match) {
5
+ return [];
6
+ }
7
+ const refListStr = match[1];
8
+ try {
9
+ const refList = JSON.parse(refListStr);
10
+ return refList;
11
+ } catch (error) {
12
+ return [];
13
+ }
14
+ };
15
+ export {
16
+ checkAndReturnRefList
17
+ };
18
+ //# sourceMappingURL=refUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refUtils.js","sources":["../../../../../src/components/x-markdown/utils/refUtils.ts"],"sourcesContent":["/**\n * 引用相关工具函数\n */\n\nexport interface RefConfig {\n title: string;\n link: string;\n time: string;\n author: string;\n}\n\n/**\n * 从文本中提取引用列表\n */\nexport const checkAndReturnRefList = (text: string): RefConfig[] => {\n const reg = /<div hidden>([\\s\\S]*?)<\\/div>/g;\n const match = reg.exec(text);\n if (!match) {\n return [];\n }\n const refListStr = match[1];\n try {\n const refList = JSON.parse(refListStr);\n return refList;\n } catch (error) {\n return [];\n }\n};\n\n"],"names":[],"mappings":"AAcO,MAAM,wBAAwB,CAAC,SAA8B;AAClE,QAAM,MAAM;AACZ,QAAM,QAAQ,IAAI,KAAK,IAAI;AAC3B,MAAI,CAAC,OAAO;AACV,WAAO,CAAA;AAAA,EACT;AACA,QAAM,aAAa,MAAM,CAAC;AAC1B,MAAI;AACF,UAAM,UAAU,KAAK,MAAM,UAAU;AACrC,WAAO;AAAA,EACT,SAAS,OAAO;AACd,WAAO,CAAA;AAAA,EACT;AACF;"}
@@ -0,0 +1,46 @@
1
+ import { checkAndReturnRefList } from "./refUtils.js";
2
+ const updateSummaryClasses = (mdText) => {
3
+ const summaryDivReg = /(<summary[^>]*>[\s\S]*?<\/summary>)\s*(<div>[\s\S]*?)(<\/div>|$)/g;
4
+ let isFirstSummary = true;
5
+ return mdText.replace(summaryDivReg, (match, summaryTag, divContent, divEnd) => {
6
+ const isDivComplete = divEnd === "</div>";
7
+ const updatedSummary = summaryTag.replace(
8
+ /(<summary)/g,
9
+ (match2) => {
10
+ if (isFirstSummary) {
11
+ isFirstSummary = false;
12
+ return match2;
13
+ }
14
+ return `<summary class="${isDivComplete ? "loaded" : "loading"}"`;
15
+ }
16
+ );
17
+ return `${updatedSummary}
18
+ ${divContent}${divEnd}`;
19
+ });
20
+ };
21
+ const formatMarkdownText = (content, autoHideThinking, startTime, endTime) => {
22
+ if (!autoHideThinking) return content;
23
+ let formatted = content;
24
+ formatted = updateSummaryClasses(formatted);
25
+ formatted = formatted.replace(/[\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]/g, " ");
26
+ if (formatted.includes("</details>")) {
27
+ const res = checkAndReturnRefList(formatted);
28
+ const text = formatted.replace(/<details open>([\s\S]*?)<\/details>/g, (match, content2) => {
29
+ content2 = content2.replace(/<summary>([\s\S]*?)<\/summary>/, (match2, content3) => {
30
+ const duration = ((endTime - startTime) / 1e3).toFixed(0);
31
+ return `<summary style="color: #8D90A0;font-weight: 300; font-size: 16px;">
32
+ 已完成思考 ${duration > "0" ? duration + "s" : ""} ${res.length ? `<span style="display: inline-block;margin: 0 8px;border-left: 1px solid #CDCFD7;width: 1px;height: 16px;"></span> 引用文档:${res == null ? void 0 : res.length} 个` : ""}
33
+ </summary>`;
34
+ });
35
+ content2 = content2.replace(/<summary>完成<\/summary>/, '<summary class="loaded">完成</summary>');
36
+ return `<details>${content2}</details>`;
37
+ });
38
+ return text;
39
+ }
40
+ return formatted;
41
+ };
42
+ export {
43
+ formatMarkdownText,
44
+ updateSummaryClasses
45
+ };
46
+ //# sourceMappingURL=textFormatUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textFormatUtils.js","sources":["../../../../../src/components/x-markdown/utils/textFormatUtils.ts"],"sourcesContent":["/**\n * 文本格式化相关工具函数\n */\n\nimport { checkAndReturnRefList } from './refUtils';\n\n/**\n * 更新 summary 标签的 class\n */\nexport const updateSummaryClasses = (mdText: string): string => {\n const summaryDivReg = /(<summary[^>]*>[\\s\\S]*?<\\/summary>)\\s*(<div>[\\s\\S]*?)(<\\/div>|$)/g;\n let isFirstSummary = true;\n\n return mdText.replace(summaryDivReg, (match, summaryTag, divContent, divEnd) => {\n const isDivComplete = divEnd === '</div>'; // 直接判断闭合标签是否存在\n const updatedSummary = summaryTag.replace(\n /(<summary)/g,\n (match) => {\n if (isFirstSummary) {\n isFirstSummary = false;\n return match;\n }\n return `<summary class=\"${isDivComplete ? 'loaded' : 'loading'}\"`\n }\n );\n return `${updatedSummary}\\n${divContent}${divEnd}`; // 重组时拼接闭合部分\n });\n};\n\n/**\n * 格式化文本,处理思考过程、引用等\n */\nexport const formatMarkdownText = (\n content: string,\n autoHideThinking: boolean,\n startTime: number,\n endTime: number\n): string => {\n if (!autoHideThinking) return content;\n \n let formatted = content;\n formatted = updateSummaryClasses(formatted);\n formatted = formatted.replace(/[\\u00A0\\u1680\\u2000-\\u200A\\u202F\\u205F\\u3000]/g, ' ');\n \n if (formatted.includes('</details>')) {\n const res = checkAndReturnRefList(formatted);\n\n const text = formatted.replace(/<details open>([\\s\\S]*?)<\\/details>/g, (match, content) => {\n // 将 content 中的第一个 <summary> 中的内容替换为 具体的秒数\n content = content.replace(/<summary>([\\s\\S]*?)<\\/summary>/, (match, content) => {\n const duration = ((endTime - startTime) / 1000).toFixed(0);\n return `<summary style=\"color: #8D90A0;font-weight: 300; font-size: 16px;\">\n 已完成思考 ${duration > '0' ? duration + 's' : ''} ${res.length ? `<span style=\"display: inline-block;margin: 0 8px;border-left: 1px solid #CDCFD7;width: 1px;height: 16px;\"></span> 引用文档:${res?.length} 个` : ''}\n </summary>`;\n })\n\n content = content.replace(/<summary>完成<\\/summary>/, '<summary class=\"loaded\">完成</summary>')\n\n return `<details>${content}</details>`;\n });\n \n return text;\n }\n \n return formatted;\n};\n\n"],"names":["match","content"],"mappings":";AASO,MAAM,uBAAuB,CAAC,WAA2B;AAC9D,QAAM,gBAAgB;AACtB,MAAI,iBAAiB;AAErB,SAAO,OAAO,QAAQ,eAAe,CAAC,OAAO,YAAY,YAAY,WAAW;AAC9E,UAAM,gBAAgB,WAAW;AACjC,UAAM,iBAAiB,WAAW;AAAA,MAChC;AAAA,MACA,CAACA,WAAU;AACT,YAAI,gBAAgB;AAClB,2BAAiB;AACjB,iBAAOA;AAAAA,QACT;AACA,eAAO,mBAAmB,gBAAgB,WAAW,SAAS;AAAA,MAChE;AAAA,IAAA;AAEF,WAAO,GAAG,cAAc;AAAA,EAAK,UAAU,GAAG,MAAM;AAAA,EAClD,CAAC;AACH;AAKO,MAAM,qBAAqB,CAChC,SACA,kBACA,WACA,YACW;AACX,MAAI,CAAC,iBAAkB,QAAO;AAE9B,MAAI,YAAY;AAChB,cAAY,qBAAqB,SAAS;AAC1C,cAAY,UAAU,QAAQ,kDAAkD,GAAG;AAEnF,MAAI,UAAU,SAAS,YAAY,GAAG;AACpC,UAAM,MAAM,sBAAsB,SAAS;AAE3C,UAAM,OAAO,UAAU,QAAQ,wCAAwC,CAAC,OAAOC,aAAY;AAEzFA,iBAAUA,SAAQ,QAAQ,kCAAkC,CAACD,QAAOC,aAAY;AAC9E,cAAM,aAAa,UAAU,aAAa,KAAM,QAAQ,CAAC;AACzD,eAAO;AAAA,kBACG,WAAW,MAAM,WAAW,MAAM,EAAE,IAAI,IAAI,SAAS,0HAA0H,2BAAK,MAAM,OAAO,EAAE;AAAA;AAAA,MAE/M,CAAC;AAEDA,iBAAUA,SAAQ,QAAQ,0BAA0B,sCAAsC;AAE1F,aAAO,YAAYA,QAAO;AAAA,IAC5B,CAAC;AAED,WAAO;AAAA,EACT;AAEA,SAAO;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@core-pilot/client-vue",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/es/index.js",
6
6
  "browser": "dist/umd/index.js",