@blueking/chat-x 0.0.51-beta.5 → 0.0.52-dev.1
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.
- package/README.md +15 -8
- package/dist/ag-ui/types/contents.d.ts +2 -0
- package/dist/ag-ui/types/messages.d.ts +6 -1
- package/dist/common/constants.d.ts +2 -0
- package/dist/components/ai-buttons/add-menu-btn/add-menu-btn.vue.d.ts +24 -0
- package/dist/components/chat-content/collapsible-content/collapsible-content.vue.d.ts +28 -0
- package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +5 -2
- package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +1 -0
- package/dist/components/chat-content/flow-agent-content/use-flow-node-actions.d.ts +1 -1
- package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +21 -10
- package/dist/components/chat-input/ai-slash-input/command.d.ts +6 -3
- package/dist/components/chat-input/ai-slash-input/constants.d.ts +2 -0
- package/dist/components/chat-input/ai-slash-input/use-menu-trigger.d.ts +17 -0
- package/dist/components/chat-input/build-default-placeholder.d.ts +9 -3
- package/dist/components/chat-input/chat-input.vue.d.ts +30 -18
- package/dist/components/chat-input/input-menu/constants.d.ts +60 -0
- package/dist/components/chat-input/input-menu/index.d.ts +4 -0
- package/dist/components/chat-input/input-menu/input-menu-option.vue.d.ts +14 -0
- package/dist/components/chat-input/input-menu/input-menu-panel.vue.d.ts +17 -0
- package/dist/components/chat-input/input-menu/use-input-menu.d.ts +22 -0
- package/dist/components/chat-input/model-selector/types.d.ts +3 -2
- package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -1
- package/dist/components/chat-message/user-message/user-message.vue.d.ts +1 -1
- package/dist/components/mention/create-mention-tippy.d.ts +27 -0
- package/dist/components/mention/index.d.ts +4 -0
- package/dist/components/{chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue.d.ts → mention/mention-popover.vue.d.ts} +3 -2
- package/dist/components/{chat-input/ai-slash-input/ai-skill-list/ai-skill-list.vue.d.ts → mention/mention-tag.vue.d.ts} +7 -3
- package/dist/components/{chat-input/ai-slash-input/ai-slash-menu/ai-slash-menu.vue.d.ts → mention/mention-text.vue.d.ts} +3 -3
- package/dist/components/resource-icon/index.d.ts +1 -0
- package/dist/components/resource-icon/resource-icon.vue.d.ts +11 -0
- package/dist/composables/index.d.ts +1 -0
- package/dist/composables/use-artifact-preview.d.ts +5 -2
- package/dist/composables/use-common.d.ts +0 -9
- package/dist/composables/use-global-config.d.ts +4 -0
- package/dist/composables/use-input-mention.d.ts +13 -0
- package/dist/composables/use-message-group.d.ts +1011 -72
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/input.d.ts +21 -0
- package/dist/icons/menu-item.d.ts +22 -0
- package/dist/index.css +1 -1
- package/dist/index.js +4953 -4429
- package/dist/index.js.map +1 -1
- package/dist/lang/lang.d.ts +13 -3
- package/dist/mcp/generated/docs/activity-message.md +3 -3
- package/dist/mcp/generated/docs/add-menu-btn.md +91 -0
- package/dist/mcp/generated/docs/ai-slash-input.md +72 -26
- package/dist/mcp/generated/docs/assistant-message.md +7 -1
- package/dist/mcp/generated/docs/chat-container.md +45 -6
- package/dist/mcp/generated/docs/chat-input.md +327 -483
- package/dist/mcp/generated/docs/collapsible-content.md +78 -0
- package/dist/mcp/generated/docs/constants.md +36 -3
- package/dist/mcp/generated/docs/execution-summary.md +1 -23
- package/dist/mcp/generated/docs/file-artifact-panel.md +24 -5
- package/dist/mcp/generated/docs/file-content.md +4 -0
- package/dist/mcp/generated/docs/file-upload-btn.md +15 -12
- package/dist/mcp/generated/docs/flow-agent-content.md +10 -12
- package/dist/mcp/generated/docs/input-menu-panel.md +166 -0
- package/dist/mcp/generated/docs/mention-tag.md +83 -0
- package/dist/mcp/generated/docs/mention-text.md +86 -0
- package/dist/mcp/generated/docs/message-container.md +1 -1
- package/dist/mcp/generated/docs/message-render.md +1 -1
- package/dist/mcp/generated/docs/message-tools.md +15 -4
- package/dist/mcp/generated/docs/messages.md +3 -0
- package/dist/mcp/generated/docs/model-selector.md +4 -2
- package/dist/mcp/generated/docs/overflow-tips.md +3 -3
- package/dist/mcp/generated/docs/resource-icon.md +102 -0
- package/dist/mcp/generated/docs/text-content.md +7 -3
- package/dist/mcp/generated/docs/theme.md +27 -35
- package/dist/mcp/generated/docs/use-artifact-preview.md +7 -3
- package/dist/mcp/generated/docs/use-command-selection.md +1 -1
- package/dist/mcp/generated/docs/use-container-scroll.md +2 -1
- package/dist/mcp/generated/docs/use-flow-node-actions.md +8 -15
- package/dist/mcp/generated/docs/use-global-config.md +11 -4
- package/dist/mcp/generated/docs/use-input-mention.md +119 -0
- package/dist/mcp/generated/docs/use-menu-keydown.md +15 -16
- package/dist/mcp/generated/docs/use-message-group.md +3 -6
- package/dist/mcp/generated/docs/user-message.md +39 -17
- package/dist/mcp/generated/index.json +233 -81
- package/dist/types/editor.d.ts +0 -29
- package/dist/types/index.d.ts +1 -0
- package/dist/types/input-menu.d.ts +46 -0
- package/dist/utils/artifact-tags.d.ts +36 -0
- package/dist/utils/collect-message-artifacts.d.ts +14 -0
- package/dist/utils/file.d.ts +3 -3
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/upload-file.d.ts +6 -1
- package/package.json +3 -2
- package/skills/blueking-chat-x/SKILL.md +143 -0
- package/skills/blueking-chat-x/references/_index.md +153 -0
- package/skills/blueking-chat-x/references/components/activity-layout.md +134 -0
- package/skills/blueking-chat-x/references/components/activity-message.md +486 -0
- package/skills/blueking-chat-x/references/components/add-menu-btn.md +88 -0
- package/skills/blueking-chat-x/references/components/ai-image.md +230 -0
- package/skills/blueking-chat-x/references/components/ai-loading.md +131 -0
- package/skills/blueking-chat-x/references/components/ai-selection.md +439 -0
- package/skills/blueking-chat-x/references/components/ai-slash-input.md +102 -0
- package/skills/blueking-chat-x/references/components/animation-text.md +202 -0
- package/skills/blueking-chat-x/references/components/assistant-message.md +504 -0
- package/skills/blueking-chat-x/references/components/chat-container.md +912 -0
- package/skills/blueking-chat-x/references/components/chat-input.md +614 -0
- package/skills/blueking-chat-x/references/components/cite-content.md +142 -0
- package/skills/blueking-chat-x/references/components/code-content.md +211 -0
- package/skills/blueking-chat-x/references/components/collapsible-content.md +76 -0
- package/skills/blueking-chat-x/references/components/common-error-content.md +73 -0
- package/skills/blueking-chat-x/references/components/content-render.md +233 -0
- package/skills/blueking-chat-x/references/components/delete-tool.md +191 -0
- package/skills/blueking-chat-x/references/components/desc-panel.md +162 -0
- package/skills/blueking-chat-x/references/components/detail-section.md +91 -0
- package/skills/blueking-chat-x/references/components/execution-summary.md +150 -0
- package/skills/blueking-chat-x/references/components/file-artifact-panel.md +307 -0
- package/skills/blueking-chat-x/references/components/file-content.md +340 -0
- package/skills/blueking-chat-x/references/components/file-icon.md +109 -0
- package/skills/blueking-chat-x/references/components/file-upload-btn.md +162 -0
- package/skills/blueking-chat-x/references/components/flow-agent-content.md +266 -0
- package/skills/blueking-chat-x/references/components/flow-agent-node-detail.md +236 -0
- package/skills/blueking-chat-x/references/components/highlight-keyword.md +146 -0
- package/skills/blueking-chat-x/references/components/image-content.md +182 -0
- package/skills/blueking-chat-x/references/components/image-preview-group.md +184 -0
- package/skills/blueking-chat-x/references/components/image-preview.md +226 -0
- package/skills/blueking-chat-x/references/components/info-message.md +144 -0
- package/skills/blueking-chat-x/references/components/input-attachment.md +49 -0
- package/skills/blueking-chat-x/references/components/input-info-alert.md +42 -0
- package/skills/blueking-chat-x/references/components/input-menu-panel.md +162 -0
- package/skills/blueking-chat-x/references/components/interrupt-message.md +212 -0
- package/skills/blueking-chat-x/references/components/key-value-content.md +128 -0
- package/skills/blueking-chat-x/references/components/knowledge-rag-content.md +122 -0
- package/skills/blueking-chat-x/references/components/latex-content.md +200 -0
- package/skills/blueking-chat-x/references/components/loading-message.md +192 -0
- package/skills/blueking-chat-x/references/components/markdown-content.md +232 -0
- package/skills/blueking-chat-x/references/components/mention-tag.md +79 -0
- package/skills/blueking-chat-x/references/components/mention-text.md +83 -0
- package/skills/blueking-chat-x/references/components/mermaid-content.md +189 -0
- package/skills/blueking-chat-x/references/components/message-container.md +645 -0
- package/skills/blueking-chat-x/references/components/message-loading.md +118 -0
- package/skills/blueking-chat-x/references/components/message-render.md +327 -0
- package/skills/blueking-chat-x/references/components/message-time.md +177 -0
- package/skills/blueking-chat-x/references/components/message-tools.md +427 -0
- package/skills/blueking-chat-x/references/components/model-selector.md +157 -0
- package/skills/blueking-chat-x/references/components/preview-toolbar.md +42 -0
- package/skills/blueking-chat-x/references/components/questions-container.md +85 -0
- package/skills/blueking-chat-x/references/components/reasoning-message.md +232 -0
- package/skills/blueking-chat-x/references/components/reference-content.md +135 -0
- package/skills/blueking-chat-x/references/components/reference-doc-content.md +109 -0
- package/skills/blueking-chat-x/references/components/resource-icon.md +98 -0
- package/skills/blueking-chat-x/references/components/scroll-btn.md +159 -0
- package/skills/blueking-chat-x/references/components/selection-footer.md +78 -0
- package/skills/blueking-chat-x/references/components/selection-question.md +88 -0
- package/skills/blueking-chat-x/references/components/shortcut-btn.md +204 -0
- package/skills/blueking-chat-x/references/components/shortcut-btns.md +266 -0
- package/skills/blueking-chat-x/references/components/shortcut-render.md +424 -0
- package/skills/blueking-chat-x/references/components/simple-table.md +101 -0
- package/skills/blueking-chat-x/references/components/text-content.md +80 -0
- package/skills/blueking-chat-x/references/components/tool-approval-card.md +183 -0
- package/skills/blueking-chat-x/references/components/tool-btn.md +317 -0
- package/skills/blueking-chat-x/references/components/tool-message.md +235 -0
- package/skills/blueking-chat-x/references/components/toolcall-render.md +348 -0
- package/skills/blueking-chat-x/references/components/user-feedback.md +233 -0
- package/skills/blueking-chat-x/references/components/user-message.md +444 -0
- package/skills/blueking-chat-x/references/components/user-question-answered-card.md +104 -0
- package/skills/blueking-chat-x/references/components/user-question-card.md +231 -0
- package/skills/blueking-chat-x/references/components/user-question-choice.md +105 -0
- package/skills/blueking-chat-x/references/components/user-question-option.md +42 -0
- package/skills/blueking-chat-x/references/components/vnode-renderer.md +122 -0
- package/skills/blueking-chat-x/references/composables/use-animation-text.md +196 -0
- package/skills/blueking-chat-x/references/composables/use-artifact-preview.md +235 -0
- package/skills/blueking-chat-x/references/composables/use-clipboard.md +203 -0
- package/skills/blueking-chat-x/references/composables/use-command-selection.md +150 -0
- package/skills/blueking-chat-x/references/composables/use-container-scroll.md +57 -0
- package/skills/blueking-chat-x/references/composables/use-custom-tab.md +158 -0
- package/skills/blueking-chat-x/references/composables/use-flow-node-actions.md +164 -0
- package/skills/blueking-chat-x/references/composables/use-full-screen.md +112 -0
- package/skills/blueking-chat-x/references/composables/use-global-config.md +155 -0
- package/skills/blueking-chat-x/references/composables/use-input-mention.md +115 -0
- package/skills/blueking-chat-x/references/composables/use-menu-keydown.md +161 -0
- package/skills/blueking-chat-x/references/composables/use-message-group.md +244 -0
- package/skills/blueking-chat-x/references/composables/use-observer-visible-list.md +188 -0
- package/skills/blueking-chat-x/references/composables/use-parent-scrolling.md +46 -0
- package/skills/blueking-chat-x/references/directives/index.md +61 -0
- package/skills/blueking-chat-x/references/directives/overflow-tips.md +205 -0
- package/skills/blueking-chat-x/references/icons/index.md +185 -0
- package/skills/blueking-chat-x/references/plugins/index.md +56 -0
- package/skills/blueking-chat-x/references/plugins/markdown-container.md +55 -0
- package/skills/blueking-chat-x/references/plugins/markdown-latex.md +205 -0
- package/skills/blueking-chat-x/references/plugins/markdown-mermaid.md +247 -0
- package/skills/blueking-chat-x/references/theme/theme.md +423 -0
- package/skills/blueking-chat-x/references/types/constants.md +340 -0
- package/skills/blueking-chat-x/references/types/index.md +120 -0
- package/skills/blueking-chat-x/references/types/interrupt.md +379 -0
- package/skills/blueking-chat-x/references/types/messages.md +556 -0
- package/skills/blueking-chat-x/references/types/schema.md +91 -0
- package/skills/blueking-chat-x/references/utils/index.md +196 -0
- package/skills/blueking-chat-x/scripts/generate-references.mjs +536 -0
- package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +0 -28
- package/dist/components/chat-input/ai-slash-editor/theme.d.ts +0 -24
- package/dist/mcp/generated/docs/ai-prompt-list.md +0 -45
- package/dist/mcp/generated/docs/ai-skill-list.md +0 -75
- package/dist/mcp/generated/docs/ai-slash-editor.md +0 -43
- package/dist/mcp/generated/docs/ai-slash-menu.md +0 -42
|
@@ -0,0 +1,536 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
/** biome-ignore-all lint/suspicious/noAssignInExpressions: <explanation> */
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 从 wikis 生成 blueking-chat-x skill 的 references。
|
|
30
|
+
*
|
|
31
|
+
* 设计目标:把面向人类阅读的 VitePress 文档(含大量 demo 脚本/演示 HTML)清洗成
|
|
32
|
+
* LLM 友好的「使用方视角」精简文档——剥离演示噪音、保留完整 API 表格与示例代码。
|
|
33
|
+
*
|
|
34
|
+
* 与 mcp/scripts/build-index.ts 共享清洗思路,但本脚本:
|
|
35
|
+
* 1. 强化代码围栏处理:正确识别 ````vue 内嵌套 ``` 的情况,避免误删示例里的 <script setup>;
|
|
36
|
+
* 2. 按「使用方」需要的范围生成(组件全量 + composables/types/utils/directives/plugins/icons/theme),
|
|
37
|
+
* 并产出能力地图索引;
|
|
38
|
+
* 3. 「导入」行以 src/index.ts 的真实导出为准,未导出的组件明确标注为内部实现,
|
|
39
|
+
* 避免使用方抄到跑不通的 import。
|
|
40
|
+
*
|
|
41
|
+
* 运行(在 packages/chat-x 下,依赖 glob / gray-matter 已在 devDependencies):
|
|
42
|
+
* node skills/blueking-chat-x/scripts/generate-references.mjs
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
import { glob } from 'glob';
|
|
46
|
+
import matter from 'gray-matter';
|
|
47
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
48
|
+
import { basename, dirname, join, relative, resolve } from 'node:path';
|
|
49
|
+
import { fileURLToPath } from 'node:url';
|
|
50
|
+
|
|
51
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
52
|
+
const __dirname = dirname(__filename);
|
|
53
|
+
|
|
54
|
+
// scripts/ -> blueking-chat-x -> skills -> chat-x
|
|
55
|
+
const WIKIS_DIR = resolve(__dirname, '../../../wikis');
|
|
56
|
+
const REFERENCES_DIR = resolve(__dirname, '../references');
|
|
57
|
+
const SRC_DIR = resolve(__dirname, '../../../src');
|
|
58
|
+
const SRC_ENTRY = join(SRC_DIR, 'index.ts');
|
|
59
|
+
|
|
60
|
+
/** 组件能力域:以 wikis/components/<domain>/ 目录为准,避免依赖 frontmatter.domain 出现的拼写漂移。 */
|
|
61
|
+
const DOMAIN_LABELS = {
|
|
62
|
+
setup: '对话搭建',
|
|
63
|
+
message: '消息系统',
|
|
64
|
+
rendering: '内容渲染',
|
|
65
|
+
medias: '媒体文件',
|
|
66
|
+
input: '输入交互',
|
|
67
|
+
agent: 'Agent 能力',
|
|
68
|
+
feedback: '工具与反馈',
|
|
69
|
+
helper: '辅助能力',
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 生成范围:每条对应 references 下的一个子目录与一个 wikis glob。
|
|
74
|
+
*
|
|
75
|
+
* allowIndex:该组的 `index.md` 是否也要生成。utils / directives / plugins / icons / types
|
|
76
|
+
* 的实际 API 内容就写在 index.md 里(不是导航页),跳过它等于整组能力对使用方不可见。
|
|
77
|
+
* components 与 composables 的 index.md 是纯导航,已由 `_index.md` 承担,继续跳过。
|
|
78
|
+
*/
|
|
79
|
+
const GROUPS = [
|
|
80
|
+
{ key: 'components', label: '组件', pattern: 'components/*/*.md', grouped: true, allowIndex: false },
|
|
81
|
+
{ key: 'composables', label: 'Composables 组合式函数', pattern: 'composables/*.md', allowIndex: false },
|
|
82
|
+
{ key: 'types', label: '类型定义', pattern: 'types/*.md', allowIndex: true },
|
|
83
|
+
{ key: 'utils', label: 'Utils 工具函数', pattern: 'utils/*.md', allowIndex: true },
|
|
84
|
+
{ key: 'directives', label: 'Directives 指令', pattern: 'directives/*.md', allowIndex: true },
|
|
85
|
+
{ key: 'plugins', label: 'Plugins Markdown 插件', pattern: 'plugins/*.md', allowIndex: true },
|
|
86
|
+
{ key: 'icons', label: 'Icons 图标', pattern: 'icons/*.md', allowIndex: true },
|
|
87
|
+
{ key: 'theme', label: '主题', pattern: 'theme/*.md', allowIndex: false },
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
const FENCE_RE = /^(\s*)(`{3,}|~{3,})(.*)$/;
|
|
91
|
+
|
|
92
|
+
/** barrel 导出解析用(正则足够覆盖本项目的 barrel 写法,无需引入 TS parser) */
|
|
93
|
+
const NAMED_EXPORT_RE = /export\s+(type\s+)?\{([^}]*)\}(?:\s*from\s*['"]([^'"]+)['"])?/g;
|
|
94
|
+
const STAR_EXPORT_RE = /export\s+\*\s+(?:as\s+(\w+)\s+)?from\s*['"]([^'"]+)['"]/g;
|
|
95
|
+
const DECL_EXPORT_RE =
|
|
96
|
+
/export\s+(?:declare\s+)?(const|let|var|async\s+function|function|abstract\s+class|class|enum|interface|type)\s+(\w+)/g;
|
|
97
|
+
const TYPE_DECL_KEYWORDS = new Set(['interface', 'type']);
|
|
98
|
+
|
|
99
|
+
/** 生成能力地图索引:组件按能力域分组,其余按组列出。 */
|
|
100
|
+
function buildIndexDoc(index) {
|
|
101
|
+
const lines = [];
|
|
102
|
+
lines.push('# @blueking/chat-x 能力地图(自动生成)');
|
|
103
|
+
lines.push('');
|
|
104
|
+
lines.push('> 由 `scripts/generate-references.mjs` 从 `wikis/` 生成,请勿手改。');
|
|
105
|
+
lines.push('> 查某个能力时:先在本索引定位 slug,再读对应 `path` 的 reference 文档。');
|
|
106
|
+
lines.push('');
|
|
107
|
+
|
|
108
|
+
lines.push('## 组件(按能力域)');
|
|
109
|
+
lines.push('');
|
|
110
|
+
for (const domainKey of Object.keys(DOMAIN_LABELS)) {
|
|
111
|
+
const list = index.components[domainKey];
|
|
112
|
+
if (!list?.length) continue;
|
|
113
|
+
lines.push(`### ${DOMAIN_LABELS[domainKey]}`);
|
|
114
|
+
lines.push('');
|
|
115
|
+
for (const entry of list.sort((a, b) => a.slug.localeCompare(b.slug))) {
|
|
116
|
+
lines.push(`- **${entry.name}** — ${entry.description} → \`${entry.path}\``);
|
|
117
|
+
}
|
|
118
|
+
lines.push('');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
for (const group of GROUPS) {
|
|
122
|
+
if (group.grouped) continue;
|
|
123
|
+
const list = index[group.key];
|
|
124
|
+
if (!list?.length) continue;
|
|
125
|
+
lines.push(`## ${group.label}`);
|
|
126
|
+
lines.push('');
|
|
127
|
+
for (const entry of list.sort((a, b) => a.slug.localeCompare(b.slug))) {
|
|
128
|
+
lines.push(`- **${entry.name}** — ${entry.description} → \`${entry.path}\``);
|
|
129
|
+
}
|
|
130
|
+
lines.push('');
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return lines.join('\n');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** 组装单个 reference 文档:精简元信息头 + 关联组件 + 清洗后的完整正文。 */
|
|
137
|
+
function buildReferenceDoc(meta, cleanedBody) {
|
|
138
|
+
const lines = [];
|
|
139
|
+
lines.push(`# ${meta.name}`);
|
|
140
|
+
lines.push('');
|
|
141
|
+
|
|
142
|
+
const tags = [];
|
|
143
|
+
if (meta.domainLabel) tags.push(`能力域:${meta.domainLabel}`);
|
|
144
|
+
if (meta.importSymbols?.length) {
|
|
145
|
+
tags.push(`导入:\`import { ${meta.importSymbols.join(', ')} } from '@blueking/chat-x'\``);
|
|
146
|
+
} else if (meta.internal) {
|
|
147
|
+
// 同名类型是最容易踩的坑:能 import 到,但拿到的不是组件
|
|
148
|
+
if (meta.typeOnly) {
|
|
149
|
+
tags.push('未从包入口导出:内部组件(入口的同名导出是 TS 类型,不是组件)');
|
|
150
|
+
} else {
|
|
151
|
+
tags.push(meta.domainLabel ? '未从包入口导出:内部组件,请通过上层组件使用' : '未从包入口导出:内部实现');
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (meta.since) tags.push(`since ${meta.since}`);
|
|
155
|
+
if (tags.length) {
|
|
156
|
+
lines.push(`> ${tags.join(' | ')}`);
|
|
157
|
+
lines.push('');
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (meta.aiSummary) {
|
|
161
|
+
lines.push(meta.aiSummary.trim());
|
|
162
|
+
lines.push('');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (meta.related.length) {
|
|
166
|
+
lines.push(`**关联**:${meta.related.map(r => (r.relation ? `${r.slug}(${r.relation})` : r.slug)).join('、')}`);
|
|
167
|
+
lines.push('');
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
lines.push('---');
|
|
171
|
+
lines.push('');
|
|
172
|
+
lines.push(cleanedBody);
|
|
173
|
+
lines.push('');
|
|
174
|
+
|
|
175
|
+
return lines.join('\n');
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* 清洗 wiki 正文:剥离 <script> demo 块、<div class="demo"> 演示块、内联 style,
|
|
180
|
+
* 并合并多余空行。代码围栏内的内容原样保留。
|
|
181
|
+
*
|
|
182
|
+
* 围栏处理采用 CommonMark 规则:记录开围栏的字符与长度,只有「同字符、长度 >= 开围栏、
|
|
183
|
+
* 且其后无信息串」的行才视为闭围栏。这样 ````vue 内的 ``` 会被当作内容,
|
|
184
|
+
* 不会误把示例里的 <script setup> 当成需剥离的 VitePress demo。
|
|
185
|
+
*/
|
|
186
|
+
function cleanMarkdownBody(rawBody) {
|
|
187
|
+
const lines = rawBody.split('\n');
|
|
188
|
+
const out = [];
|
|
189
|
+
let fence = null; // { char, len }
|
|
190
|
+
let i = 0;
|
|
191
|
+
|
|
192
|
+
while (i < lines.length) {
|
|
193
|
+
const line = lines[i];
|
|
194
|
+
const fenceMatch = line.match(FENCE_RE);
|
|
195
|
+
|
|
196
|
+
if (fenceMatch) {
|
|
197
|
+
const marker = fenceMatch[2];
|
|
198
|
+
const char = marker[0];
|
|
199
|
+
const len = marker.length;
|
|
200
|
+
const rest = fenceMatch[3].trim();
|
|
201
|
+
|
|
202
|
+
if (!fence) {
|
|
203
|
+
fence = { char, len };
|
|
204
|
+
} else if (char === fence.char && len >= fence.len && rest === '') {
|
|
205
|
+
fence = null;
|
|
206
|
+
}
|
|
207
|
+
out.push(line);
|
|
208
|
+
i++;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (fence) {
|
|
213
|
+
out.push(line);
|
|
214
|
+
i++;
|
|
215
|
+
continue;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// 以下分支仅在围栏外生效——剥离 VitePress 演示噪音
|
|
219
|
+
if (/<script\b/i.test(line)) {
|
|
220
|
+
if (/<\/script>/i.test(line)) {
|
|
221
|
+
i++;
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
i++;
|
|
225
|
+
while (i < lines.length && !/<\/script>/i.test(lines[i])) {
|
|
226
|
+
i++;
|
|
227
|
+
}
|
|
228
|
+
if (i < lines.length) i++;
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (/<div[^>]*\bclass=["']?demo["']?[^>]*>/i.test(line)) {
|
|
233
|
+
let depth = 0;
|
|
234
|
+
const start = i;
|
|
235
|
+
while (i < lines.length) {
|
|
236
|
+
depth += countDivDelta(lines[i]);
|
|
237
|
+
i++;
|
|
238
|
+
if (depth <= 0) break;
|
|
239
|
+
}
|
|
240
|
+
if (i === start) i++;
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
out.push(stripInlineStyles(line));
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return mergeBlankLines(out.join('\n')).trim();
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function countDivDelta(line) {
|
|
252
|
+
const opens = (line.match(/<div\b/gi) ?? []).length;
|
|
253
|
+
const closes = (line.match(/<\/div>/gi) ?? []).length;
|
|
254
|
+
return opens - closes;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* 把 `A`、`A as B`、`default as B`、`type A as B` 归一到对外暴露的名字,
|
|
259
|
+
* 并标出它是否只是类型导出(决定能不能真的 import 成组件用)。
|
|
260
|
+
*/
|
|
261
|
+
function parseExportClause(clause) {
|
|
262
|
+
const trimmed = clause.trim();
|
|
263
|
+
if (!trimmed) return null;
|
|
264
|
+
|
|
265
|
+
const typeOnly = /^type\s+/.test(trimmed);
|
|
266
|
+
const parts = trimmed.replace(/^type\s+/, '').split(/\s+as\s+/);
|
|
267
|
+
const symbol = (parts[1] ?? parts[0]).trim();
|
|
268
|
+
|
|
269
|
+
return /^[A-Za-z_$][\w$]*$/.test(symbol) ? { symbol, typeOnly } : null;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** 解析相对导入说明符到实际文件;兼容 edix 里 `./types.js` 这类带 .js 后缀的 TS 写法。 */
|
|
273
|
+
function resolveModuleFile(fromFile, spec) {
|
|
274
|
+
if (!spec.startsWith('.')) return '';
|
|
275
|
+
const base = resolve(dirname(fromFile), spec.replace(/\.(js|ts)$/, ''));
|
|
276
|
+
for (const candidate of [`${base}.ts`, `${base}.tsx`, join(base, 'index.ts')]) {
|
|
277
|
+
if (existsSync(candidate)) return candidate;
|
|
278
|
+
}
|
|
279
|
+
return '';
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* 从 src/index.ts 出发递归解析 barrel,得到包入口真实对外暴露的符号集。
|
|
284
|
+
*
|
|
285
|
+
* 存在的意义:文档标题里的组件名与真实导出并不总是一致——既有大小写漂移,也有大量只在库内
|
|
286
|
+
* 使用、压根不导出的内部组件;更隐蔽的是 UserMessage 这类「同名导出其实是 TS 类型而非组件」。
|
|
287
|
+
* 因此值导出与类型导出必须分开收集,只有值导出才能生成「导入」行。
|
|
288
|
+
*/
|
|
289
|
+
function collectPackageExports() {
|
|
290
|
+
const visited = new Set();
|
|
291
|
+
const valueSymbols = new Set();
|
|
292
|
+
const typeSymbols = new Set();
|
|
293
|
+
const unresolved = [];
|
|
294
|
+
|
|
295
|
+
const visit = file => {
|
|
296
|
+
if (!file || visited.has(file)) return;
|
|
297
|
+
visited.add(file);
|
|
298
|
+
|
|
299
|
+
let code;
|
|
300
|
+
try {
|
|
301
|
+
code = readFileSync(file, 'utf-8');
|
|
302
|
+
} catch {
|
|
303
|
+
unresolved.push(relative(SRC_DIR, file));
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
for (const match of code.matchAll(NAMED_EXPORT_RE)) {
|
|
308
|
+
const statementIsType = Boolean(match[1]);
|
|
309
|
+
for (const clause of match[2].split(',')) {
|
|
310
|
+
const parsed = parseExportClause(clause);
|
|
311
|
+
if (!parsed) continue;
|
|
312
|
+
const target = statementIsType || parsed.typeOnly ? typeSymbols : valueSymbols;
|
|
313
|
+
target.add(parsed.symbol);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
for (const match of code.matchAll(STAR_EXPORT_RE)) {
|
|
318
|
+
// export * as NS from '...' 暴露的是命名空间本身,不需要继续深入
|
|
319
|
+
if (match[1]) {
|
|
320
|
+
valueSymbols.add(match[1]);
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
const next = resolveModuleFile(file, match[2]);
|
|
324
|
+
if (next) {
|
|
325
|
+
visit(next);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
unresolved.push(`${relative(SRC_DIR, file)} → ${match[2]}`);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
for (const match of code.matchAll(DECL_EXPORT_RE)) {
|
|
332
|
+
const target = TYPE_DECL_KEYWORDS.has(match[1]) ? typeSymbols : valueSymbols;
|
|
333
|
+
target.add(match[2]);
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
visit(SRC_ENTRY);
|
|
338
|
+
return { valueSymbols, typeSymbols, unresolved };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* 判定文档对应的导入符号。
|
|
343
|
+
*
|
|
344
|
+
* 依次尝试:frontmatter.exportSymbol 显式声明 → 名称首词精确命中值导出 → 忽略大小写命中
|
|
345
|
+
* (纠正 ToolcallRender / commonErrorContent 这类漂移)→ 前缀命中(useXxx 的
|
|
346
|
+
* Provider / Consumer 成对导出)→ 只命中类型导出(同名类型不是组件)→ 判定为不导出。
|
|
347
|
+
*/
|
|
348
|
+
function resolveImportHint(name, override, exports) {
|
|
349
|
+
if (typeof override === 'string' && override.trim()) {
|
|
350
|
+
return { symbols: [override.trim()], explicit: true };
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const guess = String(name).trim().split(/\s+/)[0] ?? '';
|
|
354
|
+
// exportSymbol: false 表示文档已确认「就是内部组件」,据此标注且不再告警
|
|
355
|
+
if (override === false) return { symbols: [], missing: guess, similar: [] };
|
|
356
|
+
// 首词不是标识符(如「类型定义」「工具函数」)说明这篇不是单个符号的文档
|
|
357
|
+
if (!/^[A-Za-z][A-Za-z0-9]*$/.test(guess)) return { symbols: [], skip: true };
|
|
358
|
+
|
|
359
|
+
const { valueSymbols, typeSymbols } = exports;
|
|
360
|
+
if (valueSymbols.has(guess)) return { symbols: [guess] };
|
|
361
|
+
|
|
362
|
+
const lower = guess.toLowerCase();
|
|
363
|
+
const caseHit = [...valueSymbols].find(symbol => symbol.toLowerCase() === lower);
|
|
364
|
+
if (caseHit) return { symbols: [caseHit], drifted: guess };
|
|
365
|
+
|
|
366
|
+
const prefixHits = [...valueSymbols].filter(symbol => symbol.startsWith(guess)).sort();
|
|
367
|
+
if (prefixHits.length) return { symbols: prefixHits, derived: guess };
|
|
368
|
+
|
|
369
|
+
if ([...typeSymbols].some(symbol => symbol.toLowerCase() === lower)) {
|
|
370
|
+
return { symbols: [], missing: guess, typeOnly: true, similar: [] };
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
const similar = [...valueSymbols].filter(symbol => symbol.toLowerCase().includes(lower)).sort();
|
|
374
|
+
return { symbols: [], missing: guess, similar };
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/** 无 frontmatter 的文档(utils / icons 等 index.md)从首个 H1 与首段推导标题与描述。 */
|
|
378
|
+
function extractHeadingMeta(body) {
|
|
379
|
+
const titleMatch = body.match(/^#\s+(.+)$/m);
|
|
380
|
+
if (!titleMatch) return { name: '', description: '' };
|
|
381
|
+
|
|
382
|
+
const name = titleMatch[1].trim();
|
|
383
|
+
const after = body.slice(body.indexOf(titleMatch[0]) + titleMatch[0].length);
|
|
384
|
+
// 只取 H1 与下一个标题之间的内容,避免描述串到后面的小节里
|
|
385
|
+
const intro = after.split(/\n#{1,6}\s/)[0] ?? '';
|
|
386
|
+
const paragraph =
|
|
387
|
+
intro
|
|
388
|
+
.split(/\n\s*\n/)
|
|
389
|
+
.map(block => block.trim())
|
|
390
|
+
// 排除代码围栏、HTML、引用、表格与列表;以行内代码(反引号)开头的正文段落要保留
|
|
391
|
+
.find(block => block && !/^(?:```|~~~|[<>|])/.test(block) && !/^(?:[-*+]\s|\d+\.\s)/.test(block)) ?? '';
|
|
392
|
+
|
|
393
|
+
const description = paragraph.replace(/\s+/g, ' ').slice(0, 80);
|
|
394
|
+
// 截断可能切在行内代码中间,去掉落单的反引号,避免污染索引里的 markdown
|
|
395
|
+
const balanced =
|
|
396
|
+
(description.match(/`/g) ?? []).length % 2 === 0 ? description : description.replace(/`[^`]*$/, '').trim();
|
|
397
|
+
|
|
398
|
+
return { name, description: balanced };
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
function main() {
|
|
402
|
+
// 全量重建,避免删除/重命名后的残留
|
|
403
|
+
rmSync(REFERENCES_DIR, { recursive: true, force: true });
|
|
404
|
+
mkdirSync(REFERENCES_DIR, { recursive: true });
|
|
405
|
+
|
|
406
|
+
const { valueSymbols, typeSymbols, unresolved } = collectPackageExports();
|
|
407
|
+
|
|
408
|
+
const index = { components: {} }; // components: domainKey -> entries[]
|
|
409
|
+
for (const group of GROUPS) {
|
|
410
|
+
if (!group.grouped) index[group.key] = [];
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
const warnings = [];
|
|
414
|
+
let internalCount = 0;
|
|
415
|
+
let typeOnlyCount = 0;
|
|
416
|
+
|
|
417
|
+
for (const group of GROUPS) {
|
|
418
|
+
const files = glob.sync(join(WIKIS_DIR, group.pattern)).sort();
|
|
419
|
+
const outDir = join(REFERENCES_DIR, group.key);
|
|
420
|
+
mkdirSync(outDir, { recursive: true });
|
|
421
|
+
|
|
422
|
+
const seenSlugs = new Map();
|
|
423
|
+
|
|
424
|
+
for (const file of files) {
|
|
425
|
+
const fileName = basename(file, '.md');
|
|
426
|
+
if (fileName === 'index' && !group.allowIndex) continue;
|
|
427
|
+
|
|
428
|
+
const rel = relative(WIKIS_DIR, file).replace(/\\/g, '/');
|
|
429
|
+
const parsed = matter(readFileSync(file, 'utf-8'));
|
|
430
|
+
const data = parsed.data ?? {};
|
|
431
|
+
const heading = extractHeadingMeta(parsed.content);
|
|
432
|
+
|
|
433
|
+
const slug = typeof data.slug === 'string' && data.slug.trim() ? data.slug.trim() : fileName;
|
|
434
|
+
const name =
|
|
435
|
+
typeof data.name === 'string' && data.name.trim() ? data.name.trim() : heading.name || slug;
|
|
436
|
+
const description =
|
|
437
|
+
typeof data.description === 'string' && data.description.trim()
|
|
438
|
+
? data.description.trim()
|
|
439
|
+
: heading.description;
|
|
440
|
+
const aiSummary =
|
|
441
|
+
typeof data.aiSummary === 'string' && data.aiSummary.trim() ? data.aiSummary.trim() : description;
|
|
442
|
+
// YAML 里 `sinceVersion: 2.1` 会解析成数字,统一转字符串避免静默丢失
|
|
443
|
+
const since = data.sinceVersion === undefined ? '' : String(data.sinceVersion).trim();
|
|
444
|
+
const related = normalizeRelated(data.relatedComponents);
|
|
445
|
+
|
|
446
|
+
// 同一 slug 会写到同一个输出文件,静默覆盖比报错更难查
|
|
447
|
+
if (seenSlugs.has(slug)) {
|
|
448
|
+
warnings.push(`slug 冲突:${rel} 与 ${seenSlugs.get(slug)} 都输出到 ${group.key}/${slug}.md`);
|
|
449
|
+
}
|
|
450
|
+
seenSlugs.set(slug, rel);
|
|
451
|
+
|
|
452
|
+
// 组件能力域以目录为准:components/<domain>/<slug>.md
|
|
453
|
+
let domainKey = '';
|
|
454
|
+
let domainLabel = '';
|
|
455
|
+
if (group.grouped) {
|
|
456
|
+
domainKey = rel.split('/')[1] ?? 'helper';
|
|
457
|
+
domainLabel = DOMAIN_LABELS[domainKey] ?? domainKey;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
const hint = resolveImportHint(name, data.exportSymbol, { valueSymbols, typeSymbols });
|
|
461
|
+
if (hint.drifted) {
|
|
462
|
+
warnings.push(`${rel}:文档名 ${hint.drifted} 与真实导出 ${hint.symbols[0]} 不一致,已按真实导出输出`);
|
|
463
|
+
}
|
|
464
|
+
if (hint.missing) {
|
|
465
|
+
internalCount += 1;
|
|
466
|
+
if (hint.typeOnly) typeOnlyCount += 1;
|
|
467
|
+
if (hint.similar.length) {
|
|
468
|
+
warnings.push(
|
|
469
|
+
`${rel}:${hint.missing} 未从包入口导出,但存在相似导出 ${hint.similar.join(' / ')};` +
|
|
470
|
+
'如确为同一物,请在 frontmatter 补 exportSymbol',
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const cleanedBody = cleanMarkdownBody(parsed.content);
|
|
476
|
+
const doc = buildReferenceDoc(
|
|
477
|
+
{
|
|
478
|
+
name,
|
|
479
|
+
domainLabel,
|
|
480
|
+
importSymbols: hint.symbols,
|
|
481
|
+
internal: Boolean(hint.missing),
|
|
482
|
+
typeOnly: Boolean(hint.typeOnly),
|
|
483
|
+
since,
|
|
484
|
+
aiSummary,
|
|
485
|
+
related,
|
|
486
|
+
},
|
|
487
|
+
cleanedBody,
|
|
488
|
+
);
|
|
489
|
+
writeFileSync(join(outDir, `${slug}.md`), doc);
|
|
490
|
+
|
|
491
|
+
const entry = { name, slug, description: description || aiSummary, path: `${group.key}/${slug}.md` };
|
|
492
|
+
if (group.grouped) {
|
|
493
|
+
(index.components[domainKey] ??= []).push({ ...entry, domainLabel });
|
|
494
|
+
} else {
|
|
495
|
+
index[group.key].push(entry);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
writeFileSync(join(REFERENCES_DIR, '_index.md'), buildIndexDoc(index));
|
|
501
|
+
|
|
502
|
+
const componentCount = Object.values(index.components).reduce((acc, list) => acc + list.length, 0);
|
|
503
|
+
const counts = [`components ${componentCount}`];
|
|
504
|
+
for (const group of GROUPS) {
|
|
505
|
+
if (!group.grouped) counts.push(`${group.key} ${index[group.key].length}`);
|
|
506
|
+
}
|
|
507
|
+
console.log(`生成完成:${counts.join('、')}`);
|
|
508
|
+
console.log(
|
|
509
|
+
`包入口值导出 ${valueSymbols.size} 个、类型导出 ${typeSymbols.size} 个;` +
|
|
510
|
+
`标注为内部实现的文档 ${internalCount} 篇(其中 ${typeOnlyCount} 篇存在同名类型导出)`,
|
|
511
|
+
);
|
|
512
|
+
|
|
513
|
+
for (const item of unresolved) {
|
|
514
|
+
console.warn(`[warn] barrel 未能解析:${item}`);
|
|
515
|
+
}
|
|
516
|
+
for (const warning of warnings) {
|
|
517
|
+
console.warn(`[warn] ${warning}`);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
function mergeBlankLines(text) {
|
|
522
|
+
return text.replace(/\n{3,}/g, '\n\n');
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function normalizeRelated(raw) {
|
|
526
|
+
if (!Array.isArray(raw)) return [];
|
|
527
|
+
return raw
|
|
528
|
+
.filter(item => item && typeof item === 'object' && 'slug' in item)
|
|
529
|
+
.map(item => ({ slug: String(item.slug), relation: 'relation' in item ? String(item.relation) : '' }));
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
function stripInlineStyles(line) {
|
|
533
|
+
return line.replace(/\sstyle="[^"]*"/gi, '');
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
main();
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type IKeyboardEvent, editor as monacoEditor } from 'monaco-editor';
|
|
2
|
-
import 'tippy.js/dist/tippy.css';
|
|
3
|
-
type __VLS_Props = {
|
|
4
|
-
disabled?: boolean;
|
|
5
|
-
modelValue?: string;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
prompts?: string[];
|
|
8
|
-
};
|
|
9
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
10
|
-
readonly editor: monacoEditor.IStandaloneCodeEditor;
|
|
11
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
12
|
-
focus: () => any;
|
|
13
|
-
keydown: (event: IKeyboardEvent) => any;
|
|
14
|
-
"update:modelValue": (value: string) => any;
|
|
15
|
-
layoutChange: (layoutInfo: monacoEditor.EditorLayoutInfo) => any;
|
|
16
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
-
onFocus?: (() => any) | undefined;
|
|
18
|
-
onKeydown?: ((event: IKeyboardEvent) => any) | undefined;
|
|
19
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
20
|
-
onLayoutChange?: ((layoutInfo: monacoEditor.EditorLayoutInfo) => any) | undefined;
|
|
21
|
-
}>, {
|
|
22
|
-
disabled: boolean;
|
|
23
|
-
modelValue: string;
|
|
24
|
-
placeholder: string;
|
|
25
|
-
prompts: string[];
|
|
26
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
27
|
-
declare const _default: typeof __VLS_export;
|
|
28
|
-
export default _default;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { editor } from 'monaco-editor';
|
|
2
|
-
export declare const aiSlashEditorOptions: editor.IStandaloneEditorConstructionOptions;
|
|
3
|
-
export declare const resourceTypeMap: {
|
|
4
|
-
readonly tool: {
|
|
5
|
-
readonly background: "#F0F1F5";
|
|
6
|
-
readonly color: "#4D4F56";
|
|
7
|
-
readonly iconColor: "#979BA5";
|
|
8
|
-
};
|
|
9
|
-
readonly shortcut: {
|
|
10
|
-
readonly background: "#E1ECFF";
|
|
11
|
-
readonly color: "#3A84FF";
|
|
12
|
-
readonly iconColor: "#3A84FF";
|
|
13
|
-
};
|
|
14
|
-
readonly doc: {
|
|
15
|
-
readonly background: "#DAF6E5";
|
|
16
|
-
readonly color: "#2CAF5E";
|
|
17
|
-
readonly iconColor: "#2CAF5E";
|
|
18
|
-
};
|
|
19
|
-
readonly mcp: {
|
|
20
|
-
readonly background: "#FDEED8";
|
|
21
|
-
readonly color: "#F59500";
|
|
22
|
-
readonly iconColor: "#F59500";
|
|
23
|
-
};
|
|
24
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<!-- AI SUMMARY -->
|
|
2
|
-
## 快速了解
|
|
3
|
-
|
|
4
|
-
\ Prompt 选择列表,供 AiSlashInput 插入模板文本。 源码位置:src/components/chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue。
|
|
5
|
-
|
|
6
|
-
### 关联组件
|
|
7
|
-
- **ai-slash-input** — 输入 \ 时由 AiSlashInput tippy 菜单渲染
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
<!-- FULL DOC -->
|
|
11
|
-
|
|
12
|
-
# AiPromptList Prompt 列表
|
|
13
|
-
|
|
14
|
-
> **能力域**:输入交互
|
|
15
|
-
|
|
16
|
-
## 源码事实
|
|
17
|
-
|
|
18
|
-
- **源码位置**:`src/components/chat-input/ai-slash-input/ai-prompt-list/ai-prompt-list.vue`
|
|
19
|
-
- **能力说明**:`\` Prompt 选择列表,供 AiSlashInput 插入模板文本。
|
|
20
|
-
|
|
21
|
-
## API 摘要
|
|
22
|
-
|
|
23
|
-
### Props
|
|
24
|
-
|
|
25
|
-
- `{ onSelect: (prompt: string) => void; prompts: string[]; }`
|
|
26
|
-
|
|
27
|
-
### Emits
|
|
28
|
-
|
|
29
|
-
- 无。
|
|
30
|
-
|
|
31
|
-
### Slots
|
|
32
|
-
|
|
33
|
-
- 无。
|
|
34
|
-
|
|
35
|
-
### Expose
|
|
36
|
-
|
|
37
|
-
- 无。
|
|
38
|
-
|
|
39
|
-
## 组件依赖
|
|
40
|
-
|
|
41
|
-
- 无组件依赖或仅依赖基础库。
|
|
42
|
-
|
|
43
|
-
## 使用建议
|
|
44
|
-
|
|
45
|
-
- 优先通过上层组合组件使用;直接使用前请确认 props 数据结构来自对应类型定义。
|