@blueking/chat-x 0.0.50 → 0.0.51-beta.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.
Files changed (54) hide show
  1. package/dist/ag-ui/types/contents.d.ts +2 -0
  2. package/dist/ag-ui/types/messages.d.ts +5 -0
  3. package/dist/common/constants.d.ts +1 -1
  4. package/dist/components/ai-buttons/file-upload-btn/file-upload-btn.vue.d.ts +0 -2
  5. package/dist/components/chat-content/file-content/file-content.vue.d.ts +5 -2
  6. package/dist/components/chat-content/file-content/upload-file-item.vue.d.ts +12 -0
  7. package/dist/components/chat-content/file-content/upload-image-item.vue.d.ts +21 -0
  8. package/dist/components/chat-input/ai-slash-editor/ai-slash-editor.vue.d.ts +1 -1
  9. package/dist/components/chat-input/build-default-placeholder.d.ts +7 -0
  10. package/dist/components/chat-input/chat-input.vue.d.ts +1 -1
  11. package/dist/components/chat-message/message-container/message-container.vue.d.ts +1 -0
  12. package/dist/components/chat-message/message-render/message-render.vue.d.ts +2 -0
  13. package/dist/components/chat-message/user-message/user-message.vue.d.ts +3 -1
  14. package/dist/components/index.d.ts +2 -1
  15. package/dist/components/message-tools/message-time/format-message-time.d.ts +8 -0
  16. package/dist/components/message-tools/message-time/message-time.vue.d.ts +8 -0
  17. package/dist/components/message-tools/message-tools.vue.d.ts +11 -1
  18. package/dist/composables/use-custom-tab.d.ts +5 -3
  19. package/dist/composables/use-global-config.d.ts +3 -0
  20. package/dist/composables/use-message-group.d.ts +150 -72
  21. package/dist/icons/execution.d.ts +6 -0
  22. package/dist/icons/tools.d.ts +3 -0
  23. package/dist/index.css +1 -1
  24. package/dist/index.js +3124 -2837
  25. package/dist/index.js.map +1 -1
  26. package/dist/lang/lang.d.ts +8 -7
  27. package/dist/mcp/generated/docs/ai-slash-input.md +2 -0
  28. package/dist/mcp/generated/docs/assistant-message.md +9 -7
  29. package/dist/mcp/generated/docs/chat-container.md +38 -32
  30. package/dist/mcp/generated/docs/chat-input.md +18 -12
  31. package/dist/mcp/generated/docs/cite-content.md +3 -3
  32. package/dist/mcp/generated/docs/desc-panel.md +32 -10
  33. package/dist/mcp/generated/docs/execution-summary.md +3 -3
  34. package/dist/mcp/generated/docs/file-artifact-panel.md +6 -4
  35. package/dist/mcp/generated/docs/file-content.md +89 -73
  36. package/dist/mcp/generated/docs/file-upload-btn.md +16 -18
  37. package/dist/mcp/generated/docs/message-container.md +3 -0
  38. package/dist/mcp/generated/docs/message-render.md +2 -1
  39. package/dist/mcp/generated/docs/message-time.md +180 -0
  40. package/dist/mcp/generated/docs/message-tools.md +47 -12
  41. package/dist/mcp/generated/docs/messages.md +9 -0
  42. package/dist/mcp/generated/docs/toolcall-render.md +82 -43
  43. package/dist/mcp/generated/docs/use-artifact-preview.md +19 -17
  44. package/dist/mcp/generated/docs/use-custom-tab.md +12 -8
  45. package/dist/mcp/generated/docs/use-global-config.md +15 -5
  46. package/dist/mcp/generated/docs/user-message.md +9 -0
  47. package/dist/mcp/generated/docs/user-question-card.md +2 -0
  48. package/dist/mcp/generated/index.json +46 -6
  49. package/dist/types/input.d.ts +6 -0
  50. package/dist/utils/file.d.ts +7 -1
  51. package/dist/utils/index.d.ts +2 -0
  52. package/dist/utils/merge-tools-by-id.d.ts +6 -0
  53. package/dist/utils/upload-file.d.ts +35 -0
  54. package/package.json +1 -1
@@ -4,6 +4,8 @@ export interface BinaryInputContent {
4
4
  filename?: string;
5
5
  id?: string;
6
6
  mimeType: string;
7
+ /** 文件字节数;发送时由原始 File 写入,用于消息态附件卡片展示大小 */
8
+ size?: number;
7
9
  type: MessageContentType.Binary;
8
10
  url?: string;
9
11
  }
@@ -15,6 +15,8 @@ declare global {
15
15
  }
16
16
  export interface BaseMessage<T extends MessageType, C = string> {
17
17
  content: C;
18
+ /** 消息创建时间,ISO 字符串或毫秒时间戳,由消息层(chat-helper)写入 */
19
+ createdAt?: number | string;
18
20
  id: number | string;
19
21
  messageId: number | string;
20
22
  name?: string;
@@ -55,7 +57,10 @@ export type FunctionCall = {
55
57
  description?: string;
56
58
  mcpName?: string;
57
59
  name: string;
60
+ /** 调用类型;function或者不填代表函数调用,mcp 代表 MCP 调用,skill 代表 Skill 加载调用*/
61
+ type?: FunctionCallType;
58
62
  };
63
+ export type FunctionCallType = 'function' | 'mcp' | 'skill';
59
64
  export type GuideMessage = BaseMessage<MessageRole.Guide, string>;
60
65
  export type HiddenAssistantMessage = BaseMessage<MessageRole.HiddenAssistant, string>;
61
66
  export type HiddenGuideMessage = BaseMessage<MessageRole.HiddenGuide, string>;
@@ -28,7 +28,7 @@ export declare const CONST_USER_MESSAGE_TOOLS: IToolBtn[];
28
28
  * 更新工具
29
29
  */
30
30
  export declare const CONST_UPDATE_TOOLS: IToolBtn[];
31
- export declare const MAX_UPLOAD_FILES = 3;
31
+ export declare const MAX_UPLOAD_FILES = 9;
32
32
  export declare const MAX_UPLOAD_FILE_SIZE: number;
33
33
  /**
34
34
  * 关键词高亮类名
@@ -2,7 +2,6 @@ import type { AITippyProps } from '../../../types';
2
2
  import 'tippy.js/dist/tippy.css';
3
3
  export type FileUploadBtnProps = {
4
4
  accept?: string;
5
- maxFiles?: number;
6
5
  multiple?: boolean;
7
6
  tippyOptions?: AITippyProps;
8
7
  };
@@ -17,7 +16,6 @@ declare const __VLS_base: import("vue").DefineComponent<FileUploadBtnProps, {},
17
16
  }>, {
18
17
  multiple: boolean;
19
18
  accept: string;
20
- maxFiles: number;
21
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
20
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
23
21
  declare const _default: typeof __VLS_export;
@@ -1,12 +1,15 @@
1
- import { type UploadFile } from '../../../types';
1
+ import { type UploadFile, type UploadFileVariant } from '../../../types';
2
2
  type __VLS_Props = {
3
3
  files: Partial<UploadFile>[];
4
4
  readonly?: boolean;
5
+ variant?: UploadFileVariant;
5
6
  };
6
7
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
8
  deleteFile: (file: Partial<UploadFile>) => any;
8
9
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
10
  onDeleteFile?: ((file: Partial<UploadFile>) => any) | undefined;
10
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ }>, {
12
+ variant: UploadFileVariant;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
14
  declare const _default: typeof __VLS_export;
12
15
  export default _default;
@@ -0,0 +1,12 @@
1
+ import type { UploadFile } from '../../../types';
2
+ type __VLS_Props = {
3
+ file: Partial<UploadFile>;
4
+ readonly?: boolean;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ delete: () => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onDelete?: (() => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import type { UploadFileVariant } from '../../../types';
2
+ type __VLS_Props = {
3
+ hasError?: boolean;
4
+ name?: string;
5
+ readonly?: boolean;
6
+ src?: string;
7
+ variant?: UploadFileVariant;
8
+ };
9
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ error: () => void;
11
+ delete: () => void;
12
+ preview: () => void;
13
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
14
+ onError?: (() => any) | undefined;
15
+ onDelete?: (() => any) | undefined;
16
+ onPreview?: (() => any) | undefined;
17
+ }>, {
18
+ variant: UploadFileVariant;
19
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
@@ -19,9 +19,9 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
19
19
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
20
20
  onLayoutChange?: ((layoutInfo: monacoEditor.EditorLayoutInfo) => any) | undefined;
21
21
  }>, {
22
- placeholder: string;
23
22
  disabled: boolean;
24
23
  modelValue: string;
24
+ placeholder: string;
25
25
  prompts: string[];
26
26
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
27
27
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,7 @@
1
+ export interface BuildDefaultPlaceholderOptions {
2
+ hasPrompts: boolean;
3
+ hasResources: boolean;
4
+ hasSkills: boolean;
5
+ isEn: boolean;
6
+ }
7
+ export declare function buildDefaultPlaceholder(options: BuildDefaultPlaceholderOptions): string;
@@ -43,6 +43,7 @@ declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_14: {
43
43
  filename?: string | undefined;
44
44
  id?: string | undefined;
45
45
  mimeType?: string | undefined;
46
+ size?: number | undefined;
46
47
  type?: MessageContentType.Binary | undefined;
47
48
  url?: string | undefined;
48
49
  file?: {
@@ -117,7 +118,6 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
117
118
  "onUpdate:cite"?: ((value: string) => any) | undefined;
118
119
  "onUpdate:selectedModel"?: ((value: string | undefined) => any) | undefined;
119
120
  }>, {
120
- placeholder: string;
121
121
  prompts: string[];
122
122
  skills: ISkillListItem[];
123
123
  resources: IAiSlashMenuItem[];
@@ -22,6 +22,7 @@ export type MessageContainerProps = {
22
22
  onInterruptResume?: OnInterruptResume;
23
23
  onUserAction?: UserActionCallback;
24
24
  renderMode?: RenderMode;
25
+ userMessageTools?: IToolBtn[];
25
26
  updateTools?: IToolBtn[];
26
27
  } & {
27
28
  onUserInputConfirm?: (message: Message, content: UserMessage['content'], docSchema: TagSchema) => Promise<void>;
@@ -5,6 +5,7 @@ import type { Token } from '../../../markdown-it';
5
5
  import type { MessageToolsProps } from '../../message-tools/message-tools.vue';
6
6
  import type { UserQuestionAnsweredCardSlots } from '../interrupt-message/user-question/user-question-answered-card.vue';
7
7
  import type { UserMessageActionsProps } from '../user-message/user-message.vue';
8
+ import type { IToolBtn } from '../../../types';
8
9
  type __VLS_Slots = {
9
10
  answeredQuestion: UserQuestionAnsweredCardSlots['answer'];
10
11
  codeHeader: (props: {
@@ -18,6 +19,7 @@ type __VLS_Slots = {
18
19
  };
19
20
  type __VLS_Props = Partial<UserMessageActionsProps> & Pick<MessageToolsProps, 'onAction' | 'tippyOptions'> & {
20
21
  message: Partial<Message>;
22
+ messageTools?: IToolBtn[];
21
23
  onInterruptResume?: OnInterruptResume;
22
24
  };
23
25
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,5 +1,5 @@
1
1
  import { type InputContent } from '../../../ag-ui/types';
2
- import { type TagSchema, MessageToolsStatus } from '../../../types';
2
+ import { type IToolBtn, type TagSchema, MessageToolsStatus } from '../../../types';
3
3
  import { type MessageToolsProps } from '../../message-tools/message-tools.vue';
4
4
  import type { UserMessage } from '../../../ag-ui/types/messages';
5
5
  export type UserMessageActionsProps = {
@@ -9,9 +9,11 @@ export type UserMessageActionsProps = {
9
9
  };
10
10
  interface UserMessageProps extends UserMessageActionsProps {
11
11
  content?: InputContent[] | string;
12
+ createdAt?: UserMessage['createdAt'];
12
13
  id?: UserMessage['id'];
13
14
  messageId?: UserMessage['messageId'];
14
15
  name?: UserMessage['name'];
16
+ messageTools?: IToolBtn[];
15
17
  onAction?: MessageToolsProps['onAction'];
16
18
  property?: UserMessage['property'];
17
19
  role?: UserMessage['role'];
@@ -20,10 +20,11 @@ import ImagePreviewGroup from './image-preview/image-preview-group.vue';
20
20
  import ImagePreview from './image-preview/image-preview.vue';
21
21
  import AiImage from './image-preview/image.vue';
22
22
  import MessageLoading from './message-loading/message-loading.vue';
23
+ import MessageTime from './message-tools/message-time/message-time.vue';
23
24
  import MessageTools from './message-tools/message-tools.vue';
24
25
  import MessageUserFeedback from './message-tools/user-feedback/user-feedback.vue';
25
26
  import SelectionFooter from './selection-footer/selection-footer.vue';
26
27
  import ToolCallRender from './tool-call/toolcall-render/toolcall-render.vue';
27
28
  export * from './chat-message/interrupt-message';
28
29
  export * from './markdown-token';
29
- export { AiImage, AiLoading, AiSelection, ChatContainer, ChatInput, commonErrorContent, ContentRender, ExecutionSummary, FileIcon, HighlightKeyword, ImagePreview, ImagePreviewGroup, MessageContainer, MessageLoading, MessageRender, MessageTools, MessageUserFeedback, ModelSelector, ScrollBtn, SelectionFooter, ShortcutBtn, ShortcutBtns, ShortcutRender, ToolCallRender, };
30
+ export { AiImage, AiLoading, AiSelection, ChatContainer, ChatInput, commonErrorContent, ContentRender, ExecutionSummary, FileIcon, HighlightKeyword, ImagePreview, ImagePreviewGroup, MessageContainer, MessageLoading, MessageRender, MessageTime, MessageTools, MessageUserFeedback, ModelSelector, ScrollBtn, SelectionFooter, ShortcutBtn, ShortcutBtns, ShortcutRender, ToolCallRender, };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 格式化消息时间,四档规则来自设计稿标注
3
+ * 今天 `12:00`;昨天 `昨天 12:00`;今年内更早 `3-12 12:00`;非今年 `2026-3-12 12:00`
4
+ * @param createdAt 消息创建时间,ISO 字符串或毫秒时间戳
5
+ * @param timezone IANA 时区名;不传则按浏览器时区展示
6
+ * @returns 无值或非法时间时返回空字符串,由调用方决定是否渲染
7
+ */
8
+ export declare const formatMessageTime: (createdAt?: number | string, timezone?: string) => string;
@@ -0,0 +1,8 @@
1
+ export type MessageTimeProps = {
2
+ createdAt?: number | string;
3
+ /** IANA 时区名;优先于全局配置,两者都未配置时按浏览器时区展示 */
4
+ timezone?: string;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<MessageTimeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MessageTimeProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
@@ -9,7 +9,11 @@ export type MessageToolsProps = {
9
9
  tippyOptions?: AITippyProps;
10
10
  updateTools?: IToolBtn[];
11
11
  };
12
- declare const __VLS_export: import("vue").DefineComponent<MessageToolsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
12
+ type __VLS_Slots = {
13
+ append?: () => unknown;
14
+ prepend?: () => unknown;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<MessageToolsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
13
17
  feedback: (tool: IToolBtn, reasonList: string[], otherReason: string) => any;
14
18
  }, string, import("vue").PublicProps, Readonly<MessageToolsProps> & Readonly<{
15
19
  onFeedback?: ((tool: IToolBtn, reasonList: string[], otherReason: string) => any) | undefined;
@@ -17,5 +21,11 @@ declare const __VLS_export: import("vue").DefineComponent<MessageToolsProps, {},
17
21
  messageTools: IToolBtn[];
18
22
  updateTools: IToolBtn[];
19
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
25
  declare const _default: typeof __VLS_export;
21
26
  export default _default;
27
+ type __VLS_WithSlots<T, S> = T & {
28
+ new (): {
29
+ $slots: S;
30
+ };
31
+ };
@@ -1,17 +1,19 @@
1
- import { type ComputedRef, type ShallowRef } from 'vue';
1
+ import { type ComputedRef, type Ref, type ShallowRef } from 'vue';
2
2
  import type { CustomTab } from '../types';
3
3
  export declare const CUSTOM_TAB_TOKEN: unique symbol;
4
4
  export declare const EXECUTION_TAB_NAME = "execution";
5
5
  /** 自定义 Tab 默认排序权重;执行情况固定为 0,业务自定义 Tab 缺省回退到此值 */
6
6
  export declare const DEFAULT_TAB_ORDER = 100;
7
7
  export declare function useCustomTabProvider<T extends Record<string, unknown>>(options: {
8
+ /** 侧栏折叠态;由容器传入受控 ref(如 ChatContainer 的 v-model:asideCollapsed),缺省内部自持 */
9
+ collapsed?: Ref<boolean>;
8
10
  /** 执行情况 Tab 是否展示,缺省 true;传 getter 以保持响应式 */
9
11
  executionTabVisible?: () => boolean | undefined;
10
12
  onTabChange?: (tab: CustomTab<T>) => void;
11
13
  }): {
12
14
  tabs: ShallowRef<CustomTab<T>[], CustomTab<T>[]>;
13
15
  displayTabs: ComputedRef<CustomTab<T>[]>;
14
- selectedTab: import("vue").Ref<{
16
+ selectedTab: Ref<{
15
17
  closable?: boolean | undefined;
16
18
  data?: import("vue").UnwrapRef<T & {
17
19
  messageUid?: string;
@@ -32,7 +34,7 @@ export declare function useCustomTabProvider<T extends Record<string, unknown>>(
32
34
  order?: number | undefined;
33
35
  visible?: boolean | undefined;
34
36
  }>;
35
- isCollapse: ShallowRef<boolean, boolean>;
37
+ isCollapse: Ref<boolean, boolean>;
36
38
  addCustomTab: (tab: CustomTab<T>) => void;
37
39
  ensureCustomTab: (tab: CustomTab<T>) => void;
38
40
  removeCustomTab: (tabName: CustomTab<T>["name"]) => void;
@@ -4,9 +4,12 @@ export type AiSizeMode = 'normal' | 'small';
4
4
  export type GlobalConfig = {
5
5
  size?: ComputedRef<AiSizeMode>;
6
6
  supportUpload: ComputedRef<boolean>;
7
+ /** IANA 时区名,用于消息时间展示;未配置时按浏览器时区展示 */
8
+ timezone?: ComputedRef<string | undefined>;
7
9
  };
8
10
  export declare const useGlobalConfig: (options: GlobalConfig) => {
9
11
  size: ComputedRef<AiSizeMode> | undefined;
10
12
  supportUpload: ComputedRef<boolean>;
13
+ timezone: ComputedRef<string | undefined> | undefined;
11
14
  };
12
15
  export declare const injectGlobalConfig: () => GlobalConfig | undefined;