@blueking/chat-x 0.0.1-beta.4 → 0.0.1-beta.6

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 (92) hide show
  1. package/dist/ag-ui/types/constants.d.ts +12 -6
  2. package/dist/ag-ui/types/contents.d.ts +34 -42
  3. package/dist/ag-ui/types/messages.d.ts +111 -25
  4. package/dist/common/constants.d.ts +12 -0
  5. package/dist/common/index.d.ts +1 -0
  6. package/dist/common/markdown.d.ts +5 -0
  7. package/dist/components/ai-buttons/file-upload-btn/file-upload-btn.vue.d.ts +26 -0
  8. package/dist/components/ai-buttons/scroll-btn/scroll-btn.vue.d.ts +19 -0
  9. package/dist/components/{message-tools → ai-buttons/tool-btn}/tool-btn.vue.d.ts +3 -3
  10. package/dist/components/ai-shortcut/{shortcut-btn.vue.d.ts → shortcut-btn/shortcut-btn.vue.d.ts} +4 -2
  11. package/dist/components/ai-shortcut/{shortcut-btns.vue.d.ts → shortcut-btns/shortcut-btns.vue.d.ts} +1 -1
  12. package/dist/components/ai-shortcut/{shortcut-render.vue.d.ts → shortcut-render/shortcut-render.vue.d.ts} +3 -3
  13. package/dist/components/animation-text/animation-text.vue.d.ts +6 -0
  14. package/dist/components/chat-content/cite-content/cite-content.vue.d.ts +7 -0
  15. package/dist/components/chat-content/common-error-content/common-error-content.vue.d.ts +6 -0
  16. package/dist/components/chat-content/{content-render.vue.d.ts → content-render/content-render.vue.d.ts} +4 -2
  17. package/dist/components/chat-content/file-content/file-content.vue.d.ts +12 -0
  18. package/dist/components/chat-content/key-value-content/key-value-content.vue.d.ts +10 -0
  19. package/dist/components/chat-content/markdown-content/markdown-content.vue.d.ts +11 -0
  20. package/dist/components/chat-content/reference-content/reference-content.vue.d.ts +7 -0
  21. package/dist/components/chat-content/text-content/text-content.vue.d.ts +6 -0
  22. package/dist/components/chat-content/vnode-renderer.d.ts +27 -0
  23. package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +6 -1
  24. package/dist/components/chat-input/ai-slash-input/{ai-slash-menu.vue.d.ts → ai-slash-menu/ai-slash-menu.vue.d.ts} +1 -1
  25. package/dist/components/chat-input/chat-input.vue.d.ts +57 -7
  26. package/dist/components/chat-input/input-attachment/input-attachment.vue.d.ts +5 -3
  27. package/dist/components/{chat-content/think-content.vue.d.ts → chat-message/activity-message/activity-message.vue.d.ts} +2 -2
  28. package/dist/components/chat-message/assistant-message/assistant-message.vue.d.ts +16 -0
  29. package/dist/components/chat-message/flow-message/flow-detail.vue.d.ts +11 -0
  30. package/dist/components/chat-message/flow-message/flow-message.vue.d.ts +4 -0
  31. package/dist/components/chat-message/flow-message/flow-node-group.vue.d.ts +12 -0
  32. package/dist/components/chat-message/flow-message/flow-node-item.vue.d.ts +11 -0
  33. package/dist/components/chat-message/flow-message/flow-status-icons.d.ts +36 -0
  34. package/dist/components/chat-message/flow-message/index.d.ts +6 -0
  35. package/dist/components/chat-message/flow-message/mock.d.ts +13 -0
  36. package/dist/components/chat-message/flow-message/types.d.ts +132 -0
  37. package/dist/components/chat-message/info-message/info-message.vue.d.ts +4 -0
  38. package/dist/components/chat-message/message-container/message-container.vue.d.ts +11519 -0
  39. package/dist/components/chat-message/message-render/message-render.vue.d.ts +22 -0
  40. package/dist/components/{chat-content/reference-content.vue.d.ts → chat-message/reasoning-message/reasoning-message.vue.d.ts} +2 -2
  41. package/dist/components/chat-message/tool-message/tool-message.vue.d.ts +4 -0
  42. package/dist/components/chat-message/user-message/user-message.vue.d.ts +11 -0
  43. package/dist/components/index.d.ts +8 -6
  44. package/dist/components/markdown-token/code-content/code-content.vue.d.ts +15 -0
  45. package/dist/components/markdown-token/image-content/image-content.vue.d.ts +7 -0
  46. package/dist/components/markdown-token/index.d.ts +5 -0
  47. package/dist/components/markdown-token/latex-content/latex-content.vue.d.ts +8 -0
  48. package/dist/components/markdown-token/mermaid-content/mermaid-content.vue.d.ts +15 -0
  49. package/dist/components/message-tools/message-tools.vue.d.ts +16 -4
  50. package/dist/components/message-tools/user-feedback/user-feedback.vue.d.ts +14 -0
  51. package/dist/components/tool-call/desc-panel/desc-panel.vue.d.ts +7 -0
  52. package/dist/components/tool-call/toolcall-render/toolcall-render.vue.d.ts +10 -0
  53. package/dist/composables/index.d.ts +4 -0
  54. package/dist/composables/use-animation-text.d.ts +16 -0
  55. package/dist/composables/use-clipboard.d.ts +3 -0
  56. package/dist/composables/use-container-scroll.d.ts +15 -0
  57. package/dist/composables/use-observer-visible-list.d.ts +2 -1
  58. package/dist/composables/use-parent-scrolling.d.ts +16 -0
  59. package/dist/directives/overflow-tips.d.ts +2 -2
  60. package/dist/icons/content.d.ts +12 -0
  61. package/dist/icons/index.d.ts +1 -0
  62. package/dist/icons/input.d.ts +12 -0
  63. package/dist/icons/messages.d.ts +3 -0
  64. package/dist/icons/shortcuts.d.ts +6 -0
  65. package/dist/icons/tools.d.ts +6 -0
  66. package/dist/index.css +1 -1
  67. package/dist/index.d.ts +1 -0
  68. package/dist/index.js +5104 -2335
  69. package/dist/index.js.map +1 -1
  70. package/dist/lang/lang.d.ts +57 -1
  71. package/dist/plugins/index.d.ts +3 -0
  72. package/dist/plugins/markdown-animation-attrs.d.ts +6 -0
  73. package/dist/plugins/markdown-latex.d.ts +19 -0
  74. package/dist/plugins/markdown-mermaid.d.ts +7 -0
  75. package/dist/types/input.d.ts +10 -0
  76. package/dist/types/shortcut.d.ts +29 -5
  77. package/dist/types/tool.d.ts +2 -2
  78. package/dist/utils/file.d.ts +24 -0
  79. package/dist/utils/index.d.ts +2 -0
  80. package/dist/utils/markdown-completer.d.ts +37 -0
  81. package/dist/utils/stream-markdown-completer.d.ts +17 -0
  82. package/dist/utils/tokens-to-vnodes.d.ts +28 -0
  83. package/dist/utils/utils.d.ts +6 -0
  84. package/package.json +32 -8
  85. package/dist/components/chat-content/common-error-content.vue.d.ts +0 -18
  86. package/dist/components/chat-content/markdown-content.vue.d.ts +0 -5
  87. package/dist/components/chat-content/text-content.vue.d.ts +0 -4
  88. package/dist/components/chat-message/assistant-message.vue.d.ts +0 -18
  89. package/dist/components/chat-message/info-message.vue.d.ts +0 -4
  90. package/dist/components/chat-message/message-render.vue.d.ts +0 -16
  91. package/dist/components/chat-message/user-message.vue.d.ts +0 -4
  92. /package/dist/components/chat-input/ai-slash-input/{ai-prompt-list.vue.d.ts → ai-prompt-list/ai-prompt-list.vue.d.ts} +0 -0
@@ -13,5 +13,61 @@ export declare const lang: {
13
13
  readonly 取消: "Cancel";
14
14
  readonly 预览内容: "Preview Content";
15
15
  readonly 跳转详情: "Jump to Detail";
16
+ readonly '\u8C03\u7528\u5DE5\u5177\uFF1A': "Call Tool:";
17
+ readonly 调用中: "Calling...";
18
+ readonly 调用成功: "Call Success";
19
+ readonly 调用失败: "Call Failed";
20
+ readonly 说出您的想法: "Tell us your thoughts";
21
+ readonly '\u4EC0\u4E48\u539F\u56E0\u8BA9\u4F60\u6EE1\u610F\uFF1F': "What makes you satisfied?";
22
+ readonly '\u4EC0\u4E48\u539F\u56E0\u8BA9\u4F60\u4E0D\u6EE1\u610F\uFF1F': "What makes you dissatisfied?";
23
+ readonly 返回内容: "Return Content";
24
+ readonly 编辑: "Edit";
25
+ readonly 深度思考: "Deep Thinking";
26
+ readonly '\u56FE\u7247\u52A0\u8F7D\u4E2D...': "Loading image...";
27
+ readonly 图片加载失败: "Failed to load image";
28
+ readonly 思考中: "Thinking...";
29
+ readonly 已思考完成: "Thinking Completed";
30
+ readonly 思考失败: "Thinking Failed";
31
+ readonly 复制成功: "Copy Success";
32
+ readonly 复制失败: "Copy Failed";
33
+ readonly 返回底部: "Return to bottom";
34
+ readonly 停止生成: "Stop generating";
35
+ readonly 耗时: "Duration";
36
+ readonly 参数: "Parameters";
37
+ readonly 描述: "Description";
38
+ readonly 执行情况: "Execution Status";
39
+ readonly 执行中: "Running";
40
+ readonly 成功: "Success";
41
+ readonly 失败: "Failed";
42
+ readonly 挂起: "Pending";
43
+ readonly 详情: "Details";
44
+ readonly 节点详情: "Node Details";
45
+ readonly 节点: "Node";
46
+ readonly 节点配置: "Node Config";
47
+ readonly 节点输出: "Node Output";
48
+ readonly 基础信息: "Basic Info";
49
+ readonly 流程模板: "Flow Template";
50
+ readonly 节点名称: "Node Name";
51
+ readonly 步骤名称: "Step Name";
52
+ readonly 执行方案: "Execution Plan";
53
+ readonly 是否可选: "Optional";
54
+ readonly 失败处理: "Failure Handler";
55
+ readonly 超时控制: "Timeout Control";
56
+ readonly 总是使用最新版本: "Always Use Latest Version";
57
+ readonly 是: "Yes";
58
+ readonly 否: "No";
59
+ readonly 输入参数: "Input Params";
60
+ readonly 输出参数: "Output Params";
61
+ readonly 参数名: "Param Name";
62
+ readonly 参数值: "Param Value";
63
+ readonly 名称: "Name";
64
+ readonly 变量说明: "Description";
65
+ readonly 暂无数据: "No Data";
66
+ readonly '\u8282\u70B9\u8F93\u51FA\u5185\u5BB9...': "Node output content...";
67
+ readonly '\u8C03\u7528 MCP\uFF1A': "Call MCP:";
68
+ readonly 更多: "More";
69
+ readonly '\u68C0\u7D22\u4E2D...': "Searching...";
70
+ readonly 检索完成: "Search Completed";
71
+ readonly 上传文件: "Upload File";
16
72
  };
17
- export declare const t: (key: keyof typeof lang) => "Cancel" | "Copy" | "Submit" | "Send" | "Stop" | "Ask AI" | "Share" | "Like" | "Unsatisfied" | "Delete" | "Quote" | "Regenerate" | "Preview Content" | "Jump to Detail" | "发送" | "停止" | "问问小鲸" | "复制" | "分享" | "点赞" | "不满意" | "删除" | "引用" | "重新生成" | "提交" | "取消" | "预览内容" | "跳转详情";
73
+ export declare const t: (key: keyof typeof lang) => "Send" | "Stop" | "Ask AI" | "Copy" | "Share" | "Like" | "Unsatisfied" | "Delete" | "Quote" | "Regenerate" | "Submit" | "Cancel" | "Preview Content" | "Jump to Detail" | "Call Tool:" | "Calling..." | "Call Success" | "Call Failed" | "Tell us your thoughts" | "What makes you satisfied?" | "What makes you dissatisfied?" | "Return Content" | "Edit" | "Deep Thinking" | "Loading image..." | "Failed to load image" | "Thinking..." | "Thinking Completed" | "Thinking Failed" | "Copy Success" | "Copy Failed" | "Return to bottom" | "Stop generating" | "Duration" | "Parameters" | "Description" | "Execution Status" | "Running" | "Success" | "Failed" | "Pending" | "Details" | "Node Details" | "Node" | "Node Config" | "Node Output" | "Basic Info" | "Flow Template" | "Node Name" | "Step Name" | "Execution Plan" | "Optional" | "Failure Handler" | "Timeout Control" | "Always Use Latest Version" | "Yes" | "No" | "Input Params" | "Output Params" | "Param Name" | "Param Value" | "Name" | "No Data" | "Node output content..." | "Call MCP:" | "More" | "Searching..." | "Search Completed" | "Upload File" | "发送" | "停止" | "问问小鲸" | "复制" | "分享" | "点赞" | "不满意" | "删除" | "引用" | "重新生成" | "提交" | "取消" | "预览内容" | "跳转详情" | "调用工具:" | "调用中" | "调用成功" | "调用失败" | "说出您的想法" | "什么原因让你满意?" | "什么原因让你不满意?" | "返回内容" | "编辑" | "深度思考" | "图片加载中..." | "图片加载失败" | "思考中" | "已思考完成" | "思考失败" | "复制成功" | "复制失败" | "返回底部" | "停止生成" | "耗时" | "参数" | "描述" | "执行情况" | "执行中" | "成功" | "失败" | "挂起" | "详情" | "节点详情" | "节点" | "节点配置" | "节点输出" | "基础信息" | "流程模板" | "节点名称" | "步骤名称" | "执行方案" | "是否可选" | "失败处理" | "超时控制" | "总是使用最新版本" | "是" | "否" | "输入参数" | "输出参数" | "参数名" | "参数值" | "名称" | "变量说明" | "暂无数据" | "节点输出内容..." | "调用 MCP:" | "更多" | "检索中..." | "检索完成" | "上传文件";
@@ -0,0 +1,3 @@
1
+ export * from './markdown-animation-attrs';
2
+ export * from './markdown-latex';
3
+ export * from './markdown-mermaid';
@@ -0,0 +1,6 @@
1
+ import type MarkdownIt from 'markdown-it/index.js';
2
+ /**
3
+ * 添加 markdown 动画属性
4
+ * @param md - markdown-it 实例
5
+ */
6
+ export declare const markdownAnimationAttrs: (md: MarkdownIt) => void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Markdown-it LaTeX 解析插件
3
+ * 只负责解析 LaTeX 语法($...$, $$...$$, \(...\), \[...\]),不负责渲染
4
+ * KaTeX 渲染在 LatexContent 组件中完成
5
+ */
6
+ import type { PluginWithOptions } from '../markdown-it';
7
+ export type LatexOption = {
8
+ /** 是否将 align* 替换为 aligned(KaTeX 不支持 align*) */
9
+ replaceAlignStart?: boolean;
10
+ };
11
+ /**
12
+ * Markdown-it LaTeX 解析插件
13
+ * 只负责解析,不负责渲染(渲染在 LatexContent 组件中完成)
14
+ *
15
+ * @param md - markdown-it 实例
16
+ * @param options - 配置选项
17
+ */
18
+ export declare const markdownItLatex: PluginWithOptions<LatexOption>;
19
+ export default markdownItLatex;
@@ -0,0 +1,7 @@
1
+ import type { PluginSimple } from '../markdown-it';
2
+ /**
3
+ * Markdown-it plugin for Mermaid diagrams with streaming and incremental rendering
4
+ * @param md - markdown-it 实例
5
+ */
6
+ export declare const markdownItMermaid: PluginSimple;
7
+ export default markdownItMermaid;
@@ -1,10 +1,16 @@
1
1
  import { type tagSchema } from '../components/chat-input/ai-slash-input/constants';
2
+ import type { BinaryInputContent } from '../ag-ui/types/contents';
2
3
  import type { InferDoc } from '../edix';
3
4
  export declare const MessageState: {
4
5
  readonly ACTIVE: "active";
5
6
  readonly DISABLED: "disabled";
6
7
  readonly LOADING: "loading";
7
8
  };
9
+ export declare enum UploadStatus {
10
+ Error = "error",
11
+ Pending = "pending",
12
+ Success = "success"
13
+ }
8
14
  export type MentionState = {
9
15
  coordinates: null | {
10
16
  height: number;
@@ -16,3 +22,7 @@ export type MentionState = {
16
22
  rect: DOMRect | null;
17
23
  };
18
24
  export type TagSchema = InferDoc<typeof tagSchema>;
25
+ export type UploadFile = BinaryInputContent & {
26
+ file?: File;
27
+ status?: UploadStatus;
28
+ };
@@ -1,8 +1,9 @@
1
1
  import type { Component, h, VNode } from 'vue';
2
2
  import { type Checkbox, type Form, type Input, type Radio, type Select, type Switcher } from 'bkui-vue';
3
- export type BaseShortcutComponent<T extends keyof ShortcutComponentProps> = {
4
- formItemProps: InstanceType<typeof Form.FormItem>['$props'];
5
- props: ShortcutComponentProps[T];
3
+ export type BaseShortcutComponent<T extends keyof ShortcutComponentProps> = OldShortcut & {
4
+ formItemProps?: InstanceType<typeof Form.FormItem>['$props'];
5
+ key: string;
6
+ props?: ShortcutComponentProps[T];
6
7
  type: T;
7
8
  };
8
9
  export interface CheckboxGroupShortcutComponent extends BaseShortcutComponent<'checkboxGroup'> {
@@ -11,13 +12,30 @@ export interface CheckboxGroupShortcutComponent extends BaseShortcutComponent<'c
11
12
  };
12
13
  }
13
14
  export type InputShortcutComponent = BaseShortcutComponent<'input'>;
15
+ export type NumberShortcutComponent = BaseShortcutComponent<'number'>;
16
+ export interface OldShortcut {
17
+ default?: string;
18
+ fillBack?: boolean;
19
+ fillRegx?: RegExp;
20
+ key?: string;
21
+ max?: 100;
22
+ min?: 1;
23
+ name?: string;
24
+ options?: {
25
+ label: string;
26
+ value: string;
27
+ }[];
28
+ placeholder?: string;
29
+ required?: boolean;
30
+ rows?: number;
31
+ }
14
32
  export interface RadioGroupShortcutComponent extends BaseShortcutComponent<'radioGroup'> {
15
33
  props: InstanceType<typeof Radio.Group>['$props'] & {
16
34
  options: InstanceType<typeof Radio>['$props'][];
17
35
  };
18
36
  }
19
37
  export interface SelectShortcutComponent extends BaseShortcutComponent<'select'> {
20
- props: InstanceType<typeof Select>['$props'] & {
38
+ props?: InstanceType<typeof Select>['$props'] & {
21
39
  options: InstanceType<typeof Select.Option>['$props'][];
22
40
  };
23
41
  }
@@ -27,14 +45,20 @@ export interface Shortcut {
27
45
  formModel?: Record<string, unknown>;
28
46
  icon?: ((c: typeof h) => Component | VNode) | string | VNode;
29
47
  id: string;
48
+ key?: string;
30
49
  name: string;
31
50
  }
32
- export type ShortcutComponent = CheckboxGroupShortcutComponent | InputShortcutComponent | RadioGroupShortcutComponent | SelectShortcutComponent | SwitcherShortcutComponent;
51
+ export type ShortcutComponent = CheckboxGroupShortcutComponent | InputShortcutComponent | NumberShortcutComponent | RadioGroupShortcutComponent | SelectShortcutComponent | SwitcherShortcutComponent | TextareaShortcutComponent | TextShortcutComponent;
33
52
  export type ShortcutComponentProps = {
34
53
  checkboxGroup: InstanceType<typeof Checkbox.Group>['$props'];
35
54
  input: InstanceType<typeof Input>['$props'];
55
+ number: InstanceType<typeof Input>['$props'];
36
56
  radioGroup: InstanceType<typeof Radio.Group>['$props'];
37
57
  select: InstanceType<typeof Select>['$props'];
38
58
  switcher: InstanceType<typeof Switcher>['$props'];
59
+ text: InstanceType<typeof Input>['$props'];
60
+ textarea: InstanceType<typeof Input>['$props'];
39
61
  };
40
62
  export type SwitcherShortcutComponent = BaseShortcutComponent<'switcher'>;
63
+ export type TextareaShortcutComponent = BaseShortcutComponent<'textarea'>;
64
+ export type TextShortcutComponent = BaseShortcutComponent<'text'>;
@@ -1,6 +1,6 @@
1
1
  import { type ToolIconsMap } from '../icons/tools';
2
2
  export interface IToolBtn {
3
- description: string;
3
+ description?: string;
4
4
  id: keyof typeof ToolIconsMap;
5
- name: string;
5
+ name?: string;
6
6
  }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 判断文件是否为图片文件
3
+ * @param file 文件
4
+ * @returns 是否为图片文件
5
+ */
6
+ export declare const isImageFile: (mimeType?: string) => boolean;
7
+ /**
8
+ * 获取文件预览 URL
9
+ * @param file 文件
10
+ * @returns 文件预览 URL
11
+ */
12
+ export declare const getFilePreviewUrl: (file?: File) => string;
13
+ /**
14
+ * 获取文件扩展名
15
+ * @param file 文件
16
+ * @returns 文件扩展名
17
+ */
18
+ export declare const getFileExtension: (file?: File) => string;
19
+ /**
20
+ * 格式化文件大小 及 单位展示
21
+ * @param file 文件
22
+ * @returns 1024B -> 1KB 1024KB -> 1MB 1024MB -> 1GB
23
+ */
24
+ export declare const formatFileSize: (file?: File) => string;
@@ -1 +1,3 @@
1
+ export * from './file';
2
+ export * from './markdown-completer';
1
3
  export * from './utils';
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Markdown 流式渲染语法补全器
3
+ * 用于在流式输入过程中补全不完整的 markdown 语法,提升渲染效果
4
+ *
5
+ * 基于行切分的高效处理策略:
6
+ * - 跨行语法(代码块、块级公式、\begin环境):从后向前逐行扫描
7
+ * - 行内语法(行内代码、行内公式、链接):只检查最后一行
8
+ */
9
+ export interface MarkdownCompleteOptions {
10
+ /**
11
+ * 是否进行全量检查
12
+ * - true: 检查整个内容的所有语法
13
+ * - false: 只检查最后部分(性能更好,默认)
14
+ * @default false
15
+ */
16
+ fullCheck?: boolean;
17
+ }
18
+ export interface MarkdownCompleteResult {
19
+ /** 补全后的内容 */
20
+ content: string;
21
+ /** 补全添加的后缀(用于后续流式输入完整时去掉) */
22
+ suffix: string;
23
+ }
24
+ /**
25
+ * 主补全函数
26
+ * 基于行切分,按优先级检查需要补全的语法
27
+ */
28
+ export declare function completeMarkdownSyntax(content: string, options?: MarkdownCompleteOptions): MarkdownCompleteResult;
29
+ /**
30
+ * 检查内容是否需要补全
31
+ * 轻量级检查,用于快速判断是否需要调用完整的补全函数
32
+ */
33
+ export declare function needsMarkdownCompletion(content: string): boolean;
34
+ /**
35
+ * 从补全内容中移除之前添加的后缀
36
+ */
37
+ export declare function removeCompletionSuffix(content: string, previousSuffix: string): string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Stream Markdown Completer
3
+ *
4
+ * 用于在流式渲染中补全未闭合的 Markdown 和 KaTeX 语法,
5
+ * 避免因语法不完整导致的渲染错误或布局混乱。
6
+ */
7
+ export interface CompletionResult {
8
+ content: string;
9
+ isIncomplete?: boolean;
10
+ suffix: string;
11
+ }
12
+ export declare function completeMarkdownSyntax(content: string): CompletionResult;
13
+ /**
14
+ * 根据部分环境名猜测完整的环境名
15
+ * 用于未来可能的智能补全功能
16
+ */
17
+ export declare function guessEnvironmentName(partial: string): string;
@@ -0,0 +1,28 @@
1
+ import { type VNode } from 'vue';
2
+ import type { Renderer, Token } from '../markdown-it';
3
+ export interface TokenToVNodeOptions {
4
+ /**
5
+ * 对应 markdown-it 的 highlight 选项
6
+ * 允许 null | undefined,且参数签名包含 attrs
7
+ */
8
+ highlight?: ((str: string, lang: string, attrs?: any) => string) | null;
9
+ html?: boolean;
10
+ renderer?: Renderer;
11
+ /**
12
+ * HTML 净化函数,用于处理 innerHTML 的内容
13
+ */
14
+ sanitize?: (html: string) => string;
15
+ }
16
+ type TokenAttrs = [string, string][];
17
+ /**
18
+ * 公共入口函数,重置 key 计数器后调用内部函数
19
+ */
20
+ export declare const tokensToVNodes: (tokens: Token[], options?: TokenToVNodeOptions) => VNode[];
21
+ /**
22
+ * 将 markdown-it 的 attrs 数组转换为 Vue h 函数需要的 props 对象
23
+ * 优化:增加 key 参数,用于优化 Vue Diff 性能
24
+ */
25
+ export declare const attrsToStyleAndProps: (attrs: null | TokenAttrs, extraClass?: string, key?: number | string) => Record<string, any>;
26
+ export declare const renderFence: (token: Token, options: TokenToVNodeOptions, key: string) => VNode;
27
+ export declare const renderImage: (token: Token, key: string) => VNode;
28
+ export {};
@@ -1 +1,7 @@
1
1
  export declare const getCookieByName: (name: string) => string | null | undefined;
2
+ /**
3
+ *
4
+ * @param duration 耗时,单位:毫秒
5
+ * @returns 返回格式化后的耗时字符串,如:1m 30s 500ms
6
+ */
7
+ export declare const formatDuration: (duration: number) => string;
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "@blueking/chat-x",
3
- "version": "0.0.1-beta.4",
3
+ "version": "0.0.1-beta.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "prepublishOnly": "pnpm build",
8
8
  "dev": "vite --config vite.config.ts",
9
9
  "dts": "vue-tsc --project tsconfig.dts.json",
10
- "build": "pnpm dts && vite --config vite.config.ts build",
11
- "preview": "pnpm dts && vite --config vite.config.ts build --mode preview",
10
+ "build": "vite --config vite.config.ts build && pnpm dts",
11
+ "preview": "vite --config vite.config.ts build --mode preview && pnpm dts",
12
12
  "lint:script": "eslint . --ext .vue,.ts --fix",
13
13
  "lint:style": "stylelint \"**/*.{scss,css,vue}\" --fix",
14
- "lint:all": "pnpm lint:script && pnpm lint:style"
14
+ "lint:all": "pnpm lint:script && pnpm lint:style",
15
+ "test": "vitest",
16
+ "test:coverage": "vitest run --coverage"
15
17
  },
16
18
  "module": "dist/index.js",
17
19
  "publishConfig": {
@@ -30,23 +32,45 @@
30
32
  ],
31
33
  "keywords": [],
32
34
  "author": "",
33
- "license": "ISC",
35
+ "license": "MIT",
34
36
  "dependencies": {
35
37
  "bkui-vue": "^2.0.1",
38
+ "dompurify": "^3.3.1",
39
+ "highlight.js": "^11.11.1",
40
+ "katex": "^0.16.27",
41
+ "lodash": "^4.17.21",
42
+ "markdown-it-footnote": "^4.0.0",
43
+ "markdown-it-ins": "^4.0.0",
44
+ "markdown-it-mark": "^4.0.0",
45
+ "markdown-it-sub": "^2.0.0",
46
+ "markdown-it-sup": "^2.0.0",
47
+ "markdown-it-task-checkbox": "^1.0.6",
48
+ "mermaid": "^11.12.2",
36
49
  "vue": "^3.5.24"
37
50
  },
38
51
  "devDependencies": {
52
+ "@blueking/chat-helper": "workspace:*",
53
+ "@types/katex": "^0.16.7",
54
+ "@types/lodash": "^4.17.23",
39
55
  "@types/markdown-it": "^14.1.2",
40
56
  "@vitejs/plugin-vue": "^6.0.1",
57
+ "@vitest/coverage-v8": "4.0.18",
58
+ "@vue/test-utils": "^2.4.6",
41
59
  "@vue/tsconfig": "^0.8.1",
60
+ "echarts": "^6.0.0",
61
+ "entities": "^7.0.0",
42
62
  "github-markdown-css": "^5.8.1",
63
+ "happy-dom": "^20.3.7",
43
64
  "less": "^4.4.2",
44
- "markdown-it": "^14.1.0",
65
+ "linkify-it": "^5.0.0",
66
+ "mdurl": "^2.0.0",
45
67
  "monaco-editor": "^0.55.1",
68
+ "punycode.js": "^2.3.1",
46
69
  "sass-embedded": "^1.93.3",
47
- "vite": "npm:rolldown-vite@7.2.5",
70
+ "uc.micro": "^2.1.0",
71
+ "vite": "npm:rolldown-vite@7.3.1",
48
72
  "vite-bundle-analyzer": "^1.3.2",
49
- "vite-plugin-dts": "^4.5.4",
73
+ "vitest": "^3.1.1",
50
74
  "vue-tippy": "^6.7.1",
51
75
  "vue-tsc": "^3.1.4"
52
76
  }
@@ -1,18 +0,0 @@
1
- import { MessageContentType } from '../../ag-ui/types/constants';
2
- import type { IBaseMessageContent } from '../../ag-ui/types/contents';
3
- declare const __VLS_export: <T extends MessageContentType, D extends any>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
- props: __VLS_PrettifyLocal<IBaseMessageContent<T, D>> & import("vue").PublicProps & (typeof globalThis extends {
5
- __VLS_PROPS_FALLBACK: infer P;
6
- } ? P : {});
7
- expose: (exposed: {}) => void;
8
- attrs: any;
9
- slots: {};
10
- emit: {};
11
- }>) => import("vue").VNode & {
12
- __ctx?: Awaited<typeof __VLS_setup>;
13
- };
14
- declare const _default: typeof __VLS_export;
15
- export default _default;
16
- type __VLS_PrettifyLocal<T> = {
17
- [K in keyof T as K]: T[K];
18
- } & {};
@@ -1,5 +0,0 @@
1
- import type { MarkdownMessageContent } from '../../ag-ui/types/contents';
2
- import 'github-markdown-css/github-markdown.css';
3
- declare const __VLS_export: import("vue").DefineComponent<MarkdownMessageContent, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MarkdownMessageContent> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
4
- declare const _default: typeof __VLS_export;
5
- export default _default;
@@ -1,4 +0,0 @@
1
- import type { TextMessageContent } from '../../ag-ui/types/contents';
2
- declare const __VLS_export: import("vue").DefineComponent<TextMessageContent, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<TextMessageContent> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
- declare const _default: typeof __VLS_export;
4
- export default _default;
@@ -1,18 +0,0 @@
1
- import type { AssistantMessage } from '../../ag-ui/types/messages';
2
- declare var __VLS_1: {
3
- content: import("../../index.ts").ImageMessageContent | import("../../index.ts").MarkdownMessageContent | import("../../index.ts").ReferenceDocumentMessageContent | import("../../index.ts").TextMessageContent | import("../../index.ts").ThinkingMessageContent | import("../../index.ts").ToolCallMessageContent;
4
- }, __VLS_8: {};
5
- type __VLS_Slots = {} & {
6
- default?: (props: typeof __VLS_1) => any;
7
- } & {
8
- tools?: (props: typeof __VLS_8) => any;
9
- };
10
- declare const __VLS_base: import("vue").DefineComponent<AssistantMessage, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AssistantMessage> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
- declare const _default: typeof __VLS_export;
13
- export default _default;
14
- type __VLS_WithSlots<T, S> = T & {
15
- new (): {
16
- $slots: S;
17
- };
18
- };
@@ -1,4 +0,0 @@
1
- import type { InfoMessage } from '../../ag-ui/types/messages';
2
- declare const __VLS_export: import("vue").DefineComponent<InfoMessage, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<InfoMessage> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
- declare const _default: typeof __VLS_export;
4
- export default _default;
@@ -1,16 +0,0 @@
1
- import type { TextMessageContent } from '../../ag-ui/types/contents';
2
- declare var __VLS_14: {
3
- content: import("../../index.ts").ImageMessageContent | import("../../index.ts").MarkdownMessageContent | import("../../index.ts").ReferenceDocumentMessageContent | TextMessageContent | import("../../index.ts").ThinkingMessageContent | import("../../index.ts").ToolCallMessageContent;
4
- };
5
- type __VLS_Slots = {} & {
6
- default?: (props: typeof __VLS_14) => any;
7
- };
8
- declare const __VLS_base: import("vue").DefineComponent<import("../../index.ts").AssistantMessage | import("../../index.ts").GuideMessage | import("../../index.ts").HiddenAssistantMessage | import("../../index.ts").HiddenGuideMessage | import("../../index.ts").HiddenMessage | import("../../index.ts").HiddenSystemMessage | import("../../index.ts").HiddenUserMessage | import("../../index.ts").InfoMessage | import("../../index.ts").PauseMessage | import("../../index.ts").PlaceholderMessage | import("../../index.ts").SystemMessage | import("../../index.ts").TemplateAssistantMessage | import("../../index.ts").TemplateGuideMessage | import("../../index.ts").TemplateHiddenMessage | import("../../index.ts").TemplateSystemMessage | import("../../index.ts").TemplateUserMessage | import("../../index.ts").UserMessage, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("../../index.ts").AssistantMessage | import("../../index.ts").GuideMessage | import("../../index.ts").HiddenAssistantMessage | import("../../index.ts").HiddenGuideMessage | import("../../index.ts").HiddenMessage | import("../../index.ts").HiddenSystemMessage | import("../../index.ts").HiddenUserMessage | import("../../index.ts").InfoMessage | import("../../index.ts").PauseMessage | import("../../index.ts").PlaceholderMessage | import("../../index.ts").SystemMessage | import("../../index.ts").TemplateAssistantMessage | import("../../index.ts").TemplateGuideMessage | import("../../index.ts").TemplateHiddenMessage | import("../../index.ts").TemplateSystemMessage | import("../../index.ts").TemplateUserMessage | import("../../index.ts").UserMessage> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
10
- declare const _default: typeof __VLS_export;
11
- export default _default;
12
- type __VLS_WithSlots<T, S> = T & {
13
- new (): {
14
- $slots: S;
15
- };
16
- };
@@ -1,4 +0,0 @@
1
- import type { UserMessage } from '../../ag-ui/types/messages';
2
- declare const __VLS_export: import("vue").DefineComponent<UserMessage, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<UserMessage> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
3
- declare const _default: typeof __VLS_export;
4
- export default _default;