@blueking/chat-x 0.0.1-beta.5 → 0.0.1-beta.7

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 (32) hide show
  1. package/dist/ag-ui/types/constants.d.ts +2 -0
  2. package/dist/ag-ui/types/contents.d.ts +10 -0
  3. package/dist/ag-ui/types/messages.d.ts +4 -4
  4. package/dist/common/constants.d.ts +2 -0
  5. package/dist/components/ai-buttons/file-upload-btn/file-upload-btn.vue.d.ts +26 -0
  6. package/dist/components/ai-buttons/tool-btn/tool-btn.vue.d.ts +6 -2
  7. package/dist/components/chat-content/common-error-content/common-error-content.vue.d.ts +1 -1
  8. package/dist/components/chat-content/file-content/file-content.vue.d.ts +12 -0
  9. package/dist/components/chat-content/markdown-content/markdown-content.vue.d.ts +1 -1
  10. package/dist/components/chat-content/reference-content/reference-content.vue.d.ts +2 -2
  11. package/dist/components/chat-input/ai-slash-input/ai-slash-input.vue.d.ts +3 -0
  12. package/dist/components/chat-input/chat-input.vue.d.ts +40 -7
  13. package/dist/components/chat-message/message-container/message-container.vue.d.ts +88 -50
  14. package/dist/components/chat-message/message-render/message-render.vue.d.ts +2 -1
  15. package/dist/components/chat-message/user-message/user-message.vue.d.ts +7 -1
  16. package/dist/components/message-tools/message-tools.vue.d.ts +5 -2
  17. package/dist/components/message-tools/user-feedback/user-feedback.vue.d.ts +1 -0
  18. package/dist/icons/content.d.ts +6 -0
  19. package/dist/icons/index.d.ts +1 -0
  20. package/dist/icons/input.d.ts +12 -0
  21. package/dist/icons/messages.d.ts +0 -3
  22. package/dist/icons/tools.d.ts +12 -0
  23. package/dist/index.css +1 -1
  24. package/dist/index.js +764 -335
  25. package/dist/index.js.map +1 -1
  26. package/dist/lang/lang.d.ts +4 -1
  27. package/dist/types/input.d.ts +10 -0
  28. package/dist/types/tool.d.ts +6 -2
  29. package/dist/utils/file.d.ts +24 -0
  30. package/dist/utils/index.d.ts +1 -0
  31. package/package.json +4 -4
  32. package/dist/components/chat-content/x-content/x-content.vue.d.ts +0 -17
@@ -2,7 +2,9 @@ export declare enum MessageContentType {
2
2
  Binary = "binary",
3
3
  Function = "function",
4
4
  KeyValue = "key-value",
5
+ KnowledgeRag = "knowledge-rag",
5
6
  Other = "other",
7
+ ReferenceDocument = "reference-document",
6
8
  Text = "text"
7
9
  }
8
10
  export declare enum MessageRole {
@@ -14,11 +14,21 @@ export type ContentMap = AIBluekingContentMap & {
14
14
  key: string;
15
15
  value: string;
16
16
  }[];
17
+ [MessageContentType.KnowledgeRag]: {
18
+ content: string;
19
+ referenceDocument: ReferenceDocumentContent[];
20
+ };
17
21
  [MessageContentType.Other]: any;
22
+ [MessageContentType.ReferenceDocument]: ReferenceDocumentContent[];
18
23
  [MessageContentType.Text]: string;
19
24
  };
20
25
  export type ContentType = keyof ContentMap;
21
26
  export type InputContent = BinaryInputContent | TextInputContent;
27
+ export type ReferenceDocumentContent = {
28
+ name: string;
29
+ originFile: string;
30
+ url: string;
31
+ };
22
32
  export type TextInputContent = {
23
33
  text: string;
24
34
  type: MessageContentType.Text;
@@ -1,8 +1,8 @@
1
1
  import type { OldShortcut, Shortcut } from '../../types';
2
2
  import type { MessageContentType, MessageRole, MessageStatus } from './constants';
3
- import type { InputContent } from './contents';
4
- export interface ActivityMessage extends BaseMessage<MessageRole.Activity, Record<string, unknown>[]> {
5
- activityType: string;
3
+ import type { ContentMap, InputContent } from './contents';
4
+ export interface ActivityMessage extends BaseMessage<MessageRole.Activity, ContentMap[MessageContentType.KnowledgeRag] | ContentMap[MessageContentType.ReferenceDocument]> {
5
+ activityType: MessageContentType.KnowledgeRag | MessageContentType.ReferenceDocument | string;
6
6
  }
7
7
  export interface AssistantMessage extends BaseMessage<MessageRole.Assistant> {
8
8
  toolCalls?: ToolCall[];
@@ -13,7 +13,7 @@ declare global {
13
13
  }
14
14
  export interface BaseMessage<T extends MessageType, C = string> {
15
15
  content: C;
16
- id: string;
16
+ id: number | string;
17
17
  messageId: number | string;
18
18
  name?: string;
19
19
  role: T;
@@ -28,3 +28,5 @@ 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;
32
+ export declare const MAX_UPLOAD_FILE_SIZE: number;
@@ -0,0 +1,26 @@
1
+ export type FileUploadBtnProps = {
2
+ accept?: string;
3
+ maxFiles?: number;
4
+ multiple?: boolean;
5
+ };
6
+ declare var __VLS_1: {};
7
+ type __VLS_Slots = {} & {
8
+ default?: (props: typeof __VLS_1) => any;
9
+ };
10
+ declare const __VLS_base: import("vue").DefineComponent<FileUploadBtnProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
11
+ upload: (files: File[]) => any;
12
+ }, string, import("vue").PublicProps, Readonly<FileUploadBtnProps> & Readonly<{
13
+ onUpload?: ((files: File[]) => any) | undefined;
14
+ }>, {
15
+ multiple: boolean;
16
+ accept: string;
17
+ maxFiles: number;
18
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
19
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
20
+ declare const _default: typeof __VLS_export;
21
+ export default _default;
22
+ type __VLS_WithSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -1,7 +1,11 @@
1
1
  import type { IToolBtn } from '../../../types';
2
- declare const __VLS_export: import("vue").DefineComponent<IToolBtn, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
+ type __VLS_Props = IToolBtn & {
3
+ active?: boolean;
4
+ disabled?: boolean;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
3
7
  click: (data: IToolBtn, event: MouseEvent) => any;
4
- }, string, import("vue").PublicProps, Readonly<IToolBtn> & Readonly<{
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
5
9
  onClick?: ((data: IToolBtn, event: MouseEvent) => any) | undefined;
6
10
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
7
11
  declare const _default: typeof __VLS_export;
@@ -1,5 +1,5 @@
1
1
  type __VLS_Props = {
2
- content: string;
2
+ content?: string;
3
3
  };
4
4
  declare const __VLS_export: 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>;
5
5
  declare const _default: typeof __VLS_export;
@@ -0,0 +1,12 @@
1
+ import { type UploadFile } from '../../../types';
2
+ type __VLS_Props = {
3
+ files: Partial<UploadFile>[];
4
+ readonly?: boolean;
5
+ };
6
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
7
+ deleteFile: (file: Partial<UploadFile>) => any;
8
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
9
+ onDeleteFile?: ((file: Partial<UploadFile>) => any) | undefined;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
+ declare const _default: typeof __VLS_export;
12
+ export default _default;
@@ -3,7 +3,7 @@ import 'github-markdown-css/github-markdown-light.css';
3
3
  import 'highlight.js/styles/atom-one-dark.min.css';
4
4
  import 'katex/dist/katex.min.css';
5
5
  type __VLS_Props = {
6
- content: string;
6
+ content?: string;
7
7
  status?: MessageStatus;
8
8
  };
9
9
  declare const __VLS_export: 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,6 +1,6 @@
1
- import type { ActivityMessage } from '../../../ag-ui/types/messages';
1
+ import type { ReferenceDocumentContent } from '../../../ag-ui/types/contents';
2
2
  type __VLS_Props = {
3
- content: ActivityMessage['content'];
3
+ content: ReferenceDocumentContent[];
4
4
  };
5
5
  declare const __VLS_export: 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>;
6
6
  declare const _default: typeof __VLS_export;
@@ -13,6 +13,7 @@ type __VLS_ModelProps = {
13
13
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
14
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
15
15
  cleanup: () => void;
16
+ focus: () => void;
16
17
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
17
18
  "update:modelValue": (value: string | ({
18
19
  text: string;
@@ -27,6 +28,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
27
28
  })[][]) => any;
28
29
  } & {
29
30
  keydown: (event: KeyboardEvent & KeyboardPayload) => any;
31
+ upload: (files: File[]) => any;
30
32
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
31
33
  onKeydown?: ((event: KeyboardEvent & KeyboardPayload) => any) | undefined;
32
34
  "onUpdate:modelValue"?: ((value: string | ({
@@ -40,6 +42,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
40
42
  };
41
43
  type: "tag";
42
44
  })[][]) => any) | undefined;
45
+ onUpload?: ((files: File[]) => any) | undefined;
43
46
  }>, {
44
47
  placeholder: string;
45
48
  prompts: string[];
@@ -1,9 +1,14 @@
1
- import { MessageStatus } from '../../ag-ui/types';
2
- import { type IAiSlashMenuItem, type Shortcut, type TagSchema } from '../../types';
1
+ import { type UserMessage, MessageContentType, MessageStatus } from '../../ag-ui/types';
2
+ import { type IAiSlashMenuItem, type Shortcut, type TagSchema, type UploadFile, UploadStatus } from '../../types';
3
3
  export type ChatInputProps = {
4
+ defaultUploadFiles?: UploadFile[];
5
+ inputMaxHeight?: number;
4
6
  messageStatus?: MessageStatus;
5
- onSendMessage?: (value: string, docSchema: TagSchema) => Promise<void>;
7
+ onSendMessage?: (message: UserMessage['content'], docSchema: TagSchema) => Promise<void>;
6
8
  onStopSending?: () => Promise<void>;
9
+ onUpload?: (files: File) => Promise<{
10
+ download_url?: string;
11
+ }>;
7
12
  placeholder?: string;
8
13
  prompts?: string[];
9
14
  resources?: IAiSlashMenuItem[];
@@ -16,17 +21,44 @@ type __VLS_ModelProps = {
16
21
  'cite'?: string;
17
22
  };
18
23
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
- declare var __VLS_1: {}, __VLS_3: {}, __VLS_30: {}, __VLS_54: {};
24
+ declare var __VLS_1: {}, __VLS_3: {}, __VLS_12: {
25
+ files: {
26
+ data?: string | undefined;
27
+ filename?: string | undefined;
28
+ id?: string | undefined;
29
+ mimeType?: string | undefined;
30
+ type?: MessageContentType.Binary | undefined;
31
+ url?: string | undefined;
32
+ file?: {
33
+ readonly lastModified: number;
34
+ readonly name: string;
35
+ readonly webkitRelativePath: string;
36
+ readonly size: number;
37
+ readonly type: string;
38
+ arrayBuffer: () => Promise<ArrayBuffer>;
39
+ bytes: () => Promise<Uint8Array<ArrayBuffer>>;
40
+ slice: (start?: number, end?: number, contentType?: string) => Blob;
41
+ stream: () => ReadableStream<Uint8Array<ArrayBuffer>>;
42
+ text: () => Promise<string>;
43
+ } | undefined;
44
+ status?: UploadStatus | undefined;
45
+ }[];
46
+ }, __VLS_47: {}, __VLS_71: {};
20
47
  type __VLS_Slots = {} & {
21
48
  top?: (props: typeof __VLS_1) => any;
22
49
  } & {
23
50
  'input-header'?: (props: typeof __VLS_3) => any;
24
51
  } & {
25
- attachment?: (props: typeof __VLS_30) => any;
52
+ files?: (props: typeof __VLS_12) => any;
53
+ } & {
54
+ attachment?: (props: typeof __VLS_47) => any;
26
55
  } & {
27
- 'send-icon'?: (props: typeof __VLS_54) => any;
56
+ 'send-icon'?: (props: typeof __VLS_71) => any;
28
57
  };
29
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
59
+ focus: () => void;
60
+ triggerSendMessage: () => Promise<void>;
61
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
62
  "update:modelValue": (value: string | ({
31
63
  text: string;
32
64
  type: "text";
@@ -61,6 +93,7 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {
61
93
  placeholder: string;
62
94
  prompts: string[];
63
95
  resources: IAiSlashMenuItem[];
96
+ inputMaxHeight: number;
64
97
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
65
98
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
66
99
  declare const _default: typeof __VLS_export;