@deep-eye/core 0.9.1 → 1.0.0

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 (134) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/README.md +113 -174
  3. package/dist/components/chat/ChatBot.vue.d.ts +48 -17
  4. package/dist/components/chat/ChatBot.vue.d.ts.map +1 -1
  5. package/dist/components/chat/attachmentController.d.ts +25 -0
  6. package/dist/components/chat/attachmentController.d.ts.map +1 -0
  7. package/dist/components/chat/attachments.d.ts +12 -0
  8. package/dist/components/chat/attachments.d.ts.map +1 -0
  9. package/dist/components/chat/chatContext.d.ts +14 -0
  10. package/dist/components/chat/chatContext.d.ts.map +1 -0
  11. package/dist/components/chat/chatErrors.d.ts +16 -0
  12. package/dist/components/chat/chatErrors.d.ts.map +1 -0
  13. package/dist/components/chat/chatQueue.d.ts +6 -0
  14. package/dist/components/chat/chatQueue.d.ts.map +1 -0
  15. package/dist/components/chat/components/ArtifactPreview.vue.d.ts.map +1 -1
  16. package/dist/components/chat/components/ChatActionbar.vue.d.ts +3 -3
  17. package/dist/components/chat/components/ChatActionbar.vue.d.ts.map +1 -1
  18. package/dist/components/chat/components/ChatAttachments.vue.d.ts +12 -0
  19. package/dist/components/chat/components/ChatAttachments.vue.d.ts.map +1 -0
  20. package/dist/components/chat/components/ChatFilePreview.vue.d.ts +45 -0
  21. package/dist/components/chat/components/ChatFilePreview.vue.d.ts.map +1 -0
  22. package/dist/components/chat/components/ChatFilePreviewPanel.vue.d.ts +24 -0
  23. package/dist/components/chat/components/ChatFilePreviewPanel.vue.d.ts.map +1 -0
  24. package/dist/components/chat/components/ChatImageLightbox.vue.d.ts +16 -0
  25. package/dist/components/chat/components/ChatImageLightbox.vue.d.ts.map +1 -0
  26. package/dist/components/chat/components/ChatMediaPreview.vue.d.ts +9 -0
  27. package/dist/components/chat/components/ChatMediaPreview.vue.d.ts.map +1 -0
  28. package/dist/components/chat/components/ChatMessage.vue.d.ts +43 -2
  29. package/dist/components/chat/components/ChatMessage.vue.d.ts.map +1 -1
  30. package/dist/components/chat/components/ChatOfficePreview.vue.d.ts +9 -0
  31. package/dist/components/chat/components/ChatOfficePreview.vue.d.ts.map +1 -0
  32. package/dist/components/chat/components/ChatProvider.vue.d.ts +73 -0
  33. package/dist/components/chat/components/ChatProvider.vue.d.ts.map +1 -0
  34. package/dist/components/chat/components/ChatQueue.vue.d.ts +16 -0
  35. package/dist/components/chat/components/ChatQueue.vue.d.ts.map +1 -0
  36. package/dist/components/chat/components/ChatReasoning.vue.d.ts +21 -0
  37. package/dist/components/chat/components/ChatReasoning.vue.d.ts.map +1 -0
  38. package/dist/components/chat/components/ChatSender.vue.d.ts +34 -17
  39. package/dist/components/chat/components/ChatSender.vue.d.ts.map +1 -1
  40. package/dist/components/chat/components/ChatSidebarResizeHandle.vue.d.ts +13 -0
  41. package/dist/components/chat/components/ChatSidebarResizeHandle.vue.d.ts.map +1 -0
  42. package/dist/components/chat/components/ChatToolGroup.vue.d.ts +28 -0
  43. package/dist/components/chat/components/ChatToolGroup.vue.d.ts.map +1 -0
  44. package/dist/components/chat/components/ConversationList.vue.d.ts +129 -0
  45. package/dist/components/chat/components/ConversationList.vue.d.ts.map +1 -0
  46. package/dist/components/chat/components/InputContentParts.vue.d.ts +8 -0
  47. package/dist/components/chat/components/InputContentParts.vue.d.ts.map +1 -0
  48. package/dist/components/chat/components/MessageBubble.vue.d.ts +43 -2
  49. package/dist/components/chat/components/MessageBubble.vue.d.ts.map +1 -1
  50. package/dist/components/chat/components/TextPartRenderer.vue.d.ts.map +1 -1
  51. package/dist/components/chat/components/ToolCallPart.vue.d.ts +12 -3
  52. package/dist/components/chat/components/ToolCallPart.vue.d.ts.map +1 -1
  53. package/dist/components/chat/components/index.d.ts +9 -0
  54. package/dist/components/chat/components/index.d.ts.map +1 -1
  55. package/dist/components/chat/composables/index.d.ts +0 -1
  56. package/dist/components/chat/composables/index.d.ts.map +1 -1
  57. package/dist/components/chat/composables/useChatVoice.d.ts +45 -0
  58. package/dist/components/chat/composables/useChatVoice.d.ts.map +1 -0
  59. package/dist/components/chat/composables/useConversation.d.ts +1 -5
  60. package/dist/components/chat/composables/useConversation.d.ts.map +1 -1
  61. package/dist/components/chat/composables/useMeasuredHeight.d.ts +11 -0
  62. package/dist/components/chat/composables/useMeasuredHeight.d.ts.map +1 -0
  63. package/dist/components/chat/composables/useStreamSmoothing.d.ts +13 -0
  64. package/dist/components/chat/composables/useStreamSmoothing.d.ts.map +1 -0
  65. package/dist/components/chat/index.d.ts +12 -4
  66. package/dist/components/chat/index.d.ts.map +1 -1
  67. package/dist/components/chat/mdoc/ContentNodes.vue.d.ts.map +1 -1
  68. package/dist/components/chat/mdoc/MediaImageStack.vue.d.ts.map +1 -1
  69. package/dist/components/chat/previewRenderers.d.ts +6 -0
  70. package/dist/components/chat/previewRenderers.d.ts.map +1 -0
  71. package/dist/components/chat/qiniuUpload.d.ts +10 -0
  72. package/dist/components/chat/qiniuUpload.d.ts.map +1 -0
  73. package/dist/components/chat/responseStream.d.ts +17 -0
  74. package/dist/components/chat/responseStream.d.ts.map +1 -0
  75. package/dist/components/chat/toolLabels.d.ts +4 -0
  76. package/dist/components/chat/toolLabels.d.ts.map +1 -0
  77. package/dist/components/chat/toolStatus.d.ts +16 -0
  78. package/dist/components/chat/toolStatus.d.ts.map +1 -0
  79. package/dist/components/chat/types.d.ts +457 -144
  80. package/dist/components/chat/types.d.ts.map +1 -1
  81. package/dist/components/visualization/types.d.ts +8 -7
  82. package/dist/components/visualization/types.d.ts.map +1 -1
  83. package/dist/components/visualization/utils.d.ts +4 -2
  84. package/dist/components/visualization/utils.d.ts.map +1 -1
  85. package/dist/composables/useMindMapTheme.d.ts +4 -7
  86. package/dist/composables/useMindMapTheme.d.ts.map +1 -1
  87. package/dist/errors-CHzikrqu.js +70 -0
  88. package/dist/errors-upLl4kf2.cjs +1 -0
  89. package/dist/index-B4hgICk-.cjs +198 -0
  90. package/dist/index-BJdNN1GV.cjs +33 -0
  91. package/dist/index-Bj9h-xEr.cjs +112 -0
  92. package/dist/index-BufnUXnQ.js +5071 -0
  93. package/dist/index-CnxZBHPD.js +42825 -0
  94. package/dist/index-DF8KmkKX.js +38392 -0
  95. package/dist/index-DPhuLMkO.cjs +1 -0
  96. package/dist/index-Dq4cniDm.cjs +5 -0
  97. package/dist/index-cW_BnxHR.js +1722 -0
  98. package/dist/index-iCVvFIlX.js +28 -0
  99. package/dist/index.cjs +275 -134
  100. package/dist/index.js +20496 -10365
  101. package/dist/media-community-skin-Djo8L1G9.js +302 -0
  102. package/dist/media-community-skin-YI6NjsJg.cjs +1 -0
  103. package/dist/media-core-CkW37AYl.js +3827 -0
  104. package/dist/media-core-Rxz2MNwG.cjs +1 -0
  105. package/dist/media-outlet-CZTh6XmJ.cjs +1 -0
  106. package/dist/media-outlet-D2rcuhYN.js +2 -0
  107. package/dist/media-player-BZrIM0O_.js +387 -0
  108. package/dist/media-player-D_USOhtK.cjs +1 -0
  109. package/dist/media-ui-DfPbRfFS.js +2832 -0
  110. package/dist/media-ui-zZVnK1ts.cjs +1 -0
  111. package/dist/prod-Ba2x-T01.cjs +4 -0
  112. package/dist/prod-DBMM0zDd.js +992 -0
  113. package/dist/provider-B7wAEcCR.js +163 -0
  114. package/dist/provider-BPphQwpc.cjs +1 -0
  115. package/dist/provider-BSeBwvzM.cjs +1 -0
  116. package/dist/provider-DgSZc2dM.js +162 -0
  117. package/dist/provider-EKFFiZS1.js +27 -0
  118. package/dist/provider-O8r0RFmF.cjs +1 -0
  119. package/dist/provider-WrRdjcjY.js +483 -0
  120. package/dist/provider-sqICX3H9.cjs +1 -0
  121. package/dist/srt-parser-BECMkbXb.cjs +2 -0
  122. package/dist/srt-parser-BR28Llpk.js +27 -0
  123. package/dist/ssa-parser-BJTK0kd-.js +209 -0
  124. package/dist/ssa-parser-CuKkTpK_.cjs +4 -0
  125. package/dist/style.css +1 -1
  126. package/package.json +7 -2
  127. package/dist/components/chat/AiConversation.vue.d.ts +0 -28
  128. package/dist/components/chat/AiConversation.vue.d.ts.map +0 -1
  129. package/dist/components/chat/components/AssistantTrace.vue.d.ts +0 -27
  130. package/dist/components/chat/components/AssistantTrace.vue.d.ts.map +0 -1
  131. package/dist/components/chat/composables/useConversationStream.d.ts +0 -3
  132. package/dist/components/chat/composables/useConversationStream.d.ts.map +0 -1
  133. package/dist/components/chat/presentation.d.ts +0 -27
  134. package/dist/components/chat/presentation.d.ts.map +0 -1
@@ -1,26 +1,183 @@
1
1
  import type { Component, Ref } from 'vue';
2
- /** The three OpenAI chat roles rendered by AiConversation. */
3
- export type ConversationRole = 'user' | 'assistant' | 'tool';
2
+ export type ConversationRole = 'system' | 'user' | 'assistant' | 'tool';
4
3
  export type AutoScrollMode = 'always' | 'smart' | 'off';
5
- export type ConversationStreamStatus = 'idle' | 'streaming' | 'completed' | 'aborted' | 'error';
6
- export type ToolCallStatus = 'pending' | 'running' | 'success' | 'error';
7
- /**
8
- * OpenAI-compatible message data accepted by AiConversation.
9
- *
10
- * `isStreaming` is an optional rendering hint maintained by useConversation;
11
- * callers passing static OpenAI messages never need to set it.
12
- */
13
- export interface ConversationMessage {
4
+ export type ConversationStreamStatus = 'idle' | 'streaming' | 'completed' | 'incomplete' | 'aborted' | 'error';
5
+ export type ToolCallStatus = 'pending' | 'requires-approval' | 'running' | 'success' | 'error' | 'denied' | 'cancelled' | 'requires-action';
6
+ export interface ChatToolState {
7
+ status: ToolCallStatus;
8
+ error?: string;
9
+ arguments?: string;
10
+ isArgumentsEditable?: boolean;
11
+ }
12
+ export type ChatToolStates = Readonly<Record<string, ChatToolState>>;
13
+ export type ChatColorMode = 'light' | 'dark' | 'auto';
14
+ export type ChatFileCategory = 'image' | 'document' | 'audio' | 'video' | 'unsupported';
15
+ export type ChatPreviewKind = 'image' | 'pdf' | 'docx' | 'excel' | 'pptx' | 'html' | 'text' | 'audio' | 'video' | 'unsupported';
16
+ export interface ChatResourceFile {
17
+ fileName: string;
18
+ fileType: string;
19
+ size: number;
20
+ url: string;
21
+ }
22
+ export interface QiniuUploadFileItem {
14
23
  id: string;
15
- role: ConversationRole;
16
- content?: string;
17
- /** Visible reasoning text, rendered separately from the final answer. */
18
- reasoning?: string;
19
- isStreaming?: boolean;
20
- tool_calls?: ConversationToolCall[];
21
- toolStatus?: ToolCallStatus;
22
- toolResult?: unknown;
23
- toolError?: string;
24
+ bucketType: number;
25
+ fileKey: string;
26
+ fileName: string;
27
+ fileType: string;
28
+ fileMineType: string;
29
+ mimeType: string;
30
+ size: number;
31
+ duration: number;
32
+ w: number;
33
+ h: number;
34
+ status: number;
35
+ url: string;
36
+ }
37
+ export interface ChatAttachmentLimits {
38
+ maxFiles: number;
39
+ imageMaxSize: number;
40
+ documentMaxSize: number;
41
+ audioMaxSize: number;
42
+ videoMaxSize: number;
43
+ }
44
+ export interface ChatUploadConfig {
45
+ cloudBaseUrl: string;
46
+ credentialHeaders?: () => HeadersInit | Promise<HeadersInit>;
47
+ dir?: string;
48
+ limits?: Partial<ChatAttachmentLimits>;
49
+ }
50
+ export interface ChatAttachmentMenuItem {
51
+ id: string;
52
+ label: string;
53
+ icon: Component;
54
+ disabled?: boolean;
55
+ }
56
+ /** A quick-access mode button rendered after the `+` attachment icon (Doubao-style). */
57
+ export interface ChatSenderQuickAction {
58
+ id: string;
59
+ label: string;
60
+ icon?: Component;
61
+ /** Overrides the textarea placeholder while this action is active. */
62
+ placeholder?: string;
63
+ }
64
+ export interface QiniuUploadCredential {
65
+ uptoken: string;
66
+ fileKey: string;
67
+ uploadUrl: string;
68
+ }
69
+ export interface ChatAttachmentError {
70
+ code: 'unsupported_type' | 'file_too_large' | 'too_many_files' | 'duplicate_file' | 'missing_config' | 'credential_error' | 'upload_error' | 'invalid_response';
71
+ message: string;
72
+ }
73
+ interface ChatComposerAttachmentBase {
74
+ id: string;
75
+ previewUrl?: string;
76
+ }
77
+ export interface UploadingChatAttachment extends ChatComposerAttachmentBase {
78
+ status: 'uploading';
79
+ file: File;
80
+ progress: number;
81
+ }
82
+ export interface FailedChatAttachment extends ChatComposerAttachmentBase {
83
+ status: 'error';
84
+ file: File;
85
+ progress: number;
86
+ error: ChatAttachmentError;
87
+ }
88
+ export interface UploadedChatAttachment extends ChatComposerAttachmentBase {
89
+ status: 'uploaded';
90
+ uploadResult: QiniuUploadFileItem;
91
+ resource: ChatResourceFile;
92
+ }
93
+ export type ChatComposerAttachment = UploadingChatAttachment | FailedChatAttachment | UploadedChatAttachment;
94
+ export interface ImagePixelLimit {
95
+ max_pixels?: number;
96
+ min_pixels?: number;
97
+ }
98
+ export interface ConversationTextPart {
99
+ type: 'text';
100
+ text: string;
101
+ }
102
+ export interface ConversationImagePart {
103
+ type: 'image_url';
104
+ image_url: ({
105
+ url: string;
106
+ file_id?: never;
107
+ } | {
108
+ url?: never;
109
+ file_id: string;
110
+ }) & {
111
+ detail?: 'low' | 'high' | 'xhigh';
112
+ image_pixel_limit?: ImagePixelLimit | null;
113
+ };
114
+ }
115
+ export interface ConversationVideoPart {
116
+ type: 'video_url';
117
+ video_url: ({
118
+ url: string;
119
+ file_id?: never;
120
+ } | {
121
+ url?: never;
122
+ file_id: string;
123
+ }) & {
124
+ detail?: string;
125
+ fps?: number;
126
+ image_pixel_limit?: ImagePixelLimit | null;
127
+ };
128
+ }
129
+ export interface ConversationAudioPart {
130
+ type: 'input_audio';
131
+ input_audio: {
132
+ url: string;
133
+ file_id?: never;
134
+ data?: never;
135
+ format?: string;
136
+ } | {
137
+ url?: never;
138
+ file_id: string;
139
+ data?: never;
140
+ format?: string;
141
+ } | {
142
+ url?: never;
143
+ file_id?: never;
144
+ data: string;
145
+ format: string;
146
+ };
147
+ }
148
+ export interface ConversationFilePart {
149
+ type: 'file';
150
+ file: {
151
+ file_url: string;
152
+ file_id?: never;
153
+ file_data?: never;
154
+ filename?: string;
155
+ } | {
156
+ file_url?: never;
157
+ file_id: string;
158
+ file_data?: never;
159
+ filename?: string;
160
+ } | {
161
+ file_url?: never;
162
+ file_id?: never;
163
+ file_data: string;
164
+ filename: string;
165
+ };
166
+ }
167
+ export type ConversationContentPart = ConversationTextPart | ConversationImagePart | ConversationVideoPart | ConversationAudioPart | ConversationFilePart;
168
+ export type ConversationInputContent = string | ConversationContentPart[];
169
+ export interface SystemMessage {
170
+ id?: string;
171
+ role: 'system';
172
+ content: ConversationInputContent;
173
+ name?: string;
174
+ }
175
+ export interface UserMessage {
176
+ id?: string;
177
+ role: 'user';
178
+ content: ConversationInputContent;
179
+ resource_files: ChatResourceFile[];
180
+ name?: string;
24
181
  }
25
182
  export interface ConversationToolCall {
26
183
  id: string;
@@ -30,90 +187,65 @@ export interface ConversationToolCall {
30
187
  arguments: string;
31
188
  };
32
189
  }
190
+ export interface ChatToolActionPayload {
191
+ action: 'approve' | 'deny' | 'cancel' | 'submit-action';
192
+ toolCall: ConversationToolCall;
193
+ arguments: string;
194
+ }
195
+ export interface AssistantMessage {
196
+ id?: string;
197
+ role: 'assistant';
198
+ content?: string;
199
+ encrypted_content?: string;
200
+ name?: string;
201
+ reasoning_content?: string;
202
+ tool_calls?: ConversationToolCall[];
203
+ /** GA-only original file metadata surfaced from `response.output_item.done`. */
204
+ resource_files?: Record<string, unknown>[];
205
+ }
206
+ export interface ToolMessage {
207
+ id?: string;
208
+ role: 'tool';
209
+ content: string;
210
+ tool_call_id: string;
211
+ name?: string;
212
+ }
213
+ export type ConversationMessage = SystemMessage | UserMessage | AssistantMessage | ToolMessage;
214
+ export interface ChatModelInput {
215
+ role: 'user';
216
+ content: ConversationContentPart[];
217
+ }
218
+ export interface ChatSendPayload {
219
+ message: UserMessage;
220
+ modelInput: ChatModelInput;
221
+ attachments: readonly UploadedChatAttachment[];
222
+ }
223
+ export interface ChatQueueItem {
224
+ id: string;
225
+ payload: ChatSendPayload;
226
+ }
33
227
  export interface OpenGenUIContent {
34
228
  type: string;
35
229
  [key: string]: unknown;
36
230
  }
37
231
  export type ToolRenderer = Component;
232
+ export type ChatPreviewRenderer = Component;
233
+ export type ChatPreviewRendererMap = Partial<Record<ChatPreviewKind | string, ChatPreviewRenderer>>;
234
+ export type ChatToolRendererMap = Record<string, ToolRenderer>;
38
235
  export interface ChatActionbarCopyPayload {
39
- message: ConversationMessage;
236
+ message: AssistantMessage;
40
237
  text: string;
41
238
  }
42
239
  export interface ChatMessageProps {
43
240
  message: ConversationMessage;
241
+ streaming?: boolean;
242
+ toolMessages?: readonly ToolMessage[];
44
243
  theme?: ConversationTheme;
45
244
  userAvatar?: string;
46
245
  assistantAvatar?: string;
246
+ toolStates?: ChatToolStates;
47
247
  }
48
- export interface ConversationToolCallDelta {
49
- /** Index into the assistant message's tool_calls array. */
50
- index: number;
51
- id?: string;
52
- function?: {
53
- name?: string;
54
- argumentsDelta?: string;
55
- };
56
- /** Required for unambiguous lifecycle updates when several tools are active. */
57
- toolStatus?: ToolCallStatus;
58
- toolResult?: unknown;
59
- toolError?: string;
60
- }
61
- /**
62
- * A frontend-friendly form of `choices[0].delta`.
63
- *
64
- * `id` is the local ConversationMessage id.
65
- */
66
- export interface ConversationDelta {
67
- id: string;
68
- role?: ConversationRole;
69
- contentDelta?: string;
70
- /** Incremental visible reasoning text. */
71
- reasoningDelta?: string;
72
- done?: boolean;
73
- }
74
- /** A function call delta in an OpenAI-compatible chat completion chunk. */
75
- export interface OpenAiChatCompletionToolCallDelta {
76
- index: number;
77
- id?: string;
78
- type?: 'function';
79
- function?: {
80
- name?: string;
81
- arguments?: string;
82
- };
83
- }
84
- /** The `choices[].delta` payload in an OpenAI-compatible SSE chunk. */
85
- export interface OpenAiChatCompletionDelta {
86
- role?: 'assistant';
87
- content?: string | null;
88
- /** Used by reasoning-capable OpenAI-compatible providers. */
89
- reasoning_content?: string | null;
90
- /** Alternate field used by some OpenAI-compatible providers. */
91
- reasoning?: string | null;
92
- tool_calls?: OpenAiChatCompletionToolCallDelta[];
93
- }
94
- /** One choice in an OpenAI-compatible `chat.completion.chunk` response. */
95
- export interface OpenAiChatCompletionChoice {
96
- index: number;
97
- delta: OpenAiChatCompletionDelta;
98
- /** `null`, `"null"`, and `""` mean that streaming continues. */
99
- finish_reason: string | null;
100
- }
101
- /**
102
- * OpenAI-compatible SSE payload accepted by `useConversation().appendDelta`.
103
- * `session_id` is included for compatible backends.
104
- */
105
- export interface OpenAiChatCompletionChunk {
106
- id: string;
107
- object: 'chat.completion.chunk';
108
- created: number;
109
- model: string;
110
- session_id?: string;
111
- choices: OpenAiChatCompletionChoice[];
112
- }
113
- /** Input accepted by `useConversation().appendDelta`. */
114
- export type ConversationStreamInput = ConversationDelta | OpenAiChatCompletionChunk | string;
115
- export interface ConversationTheme {
116
- /** CSS custom-property references supplied by the consuming design system. */
248
+ export interface ChatTheme {
117
249
  userBubbleBg?: string;
118
250
  userBubbleColor?: string;
119
251
  userBubbleBorderColor?: string;
@@ -128,103 +260,284 @@ export interface ConversationTheme {
128
260
  toolErrorColor?: string;
129
261
  borderRadius?: string;
130
262
  spacing?: string;
263
+ inputBg?: string;
264
+ inputBorder?: string;
265
+ inputFocusBorder?: string;
266
+ buttonPrimaryBg?: string;
267
+ buttonPrimaryColor?: string;
268
+ buttonSecondaryBg?: string;
269
+ buttonSecondaryColor?: string;
131
270
  }
271
+ export type ConversationTheme = ChatTheme;
132
272
  export interface ConversationAskFormAnswer {
133
273
  formId: string;
134
274
  question: string;
135
275
  value: string;
136
276
  label?: string;
137
- /** True when an optional question was skipped. */
138
277
  skipped?: boolean;
139
278
  }
140
- /** Bubbled from interactive content tags such as ask-form or artifact. */
141
279
  export interface ConversationUiAction {
142
280
  type: 'submit' | 'open-artifact';
143
281
  value?: string;
144
282
  label?: string;
145
283
  source?: string;
146
- /** Stable form identifier from `ask-form id`; falls back to the parsed node id. */
147
284
  formId?: string;
148
- /** The ask-form question associated with this submission. */
149
285
  question?: string;
150
- /** All answers from a multi-question ask-form submission, in display order. */
151
286
  answers?: ConversationAskFormAnswer[];
152
- /** `open-artifact` payload: stable id from `artifact id`, falls back to the parsed node id. */
153
287
  artifactId?: string;
154
- /** `open-artifact` payload: card title. */
155
288
  title?: string;
156
- /** `open-artifact` payload: html|code|markdown|text (text) or pdf|word|excel|ppt|zip|file (file). */
157
289
  artifactType?: string;
158
- /** `open-artifact` payload: language annotation when artifactType is `code`. */
159
290
  language?: string;
160
- /** `open-artifact` payload: inline content for text-type artifacts (from `slotText`). */
161
291
  content?: string;
162
- /** `open-artifact` payload: file URL for file-type artifacts. */
163
292
  src?: string;
164
293
  }
165
- export interface AiConversationProps {
166
- /** Accepts a static array or the messages Ref returned by conversation composables. */
167
- messages: readonly ConversationMessage[] | Ref<readonly ConversationMessage[]>;
294
+ export interface ConversationListConfig {
168
295
  theme?: ConversationTheme;
169
296
  autoScroll?: AutoScrollMode;
170
- /** 用户头像 URL;未传且无 `#user-avatar` 插槽时不显示头像 */
171
297
  userAvatar?: string;
172
- /** 助手头像 URL;未传时使用内置标识 */
173
298
  assistantAvatar?: string;
299
+ toolStates?: ChatToolStates;
174
300
  }
175
- export interface AiConversationExpose {
301
+ export interface ConversationListProps extends ConversationListConfig {
302
+ messages: readonly ConversationMessage[];
303
+ streamingMessageIndex?: number;
304
+ status?: ConversationStreamStatus;
305
+ }
306
+ export interface ConversationListExpose {
176
307
  scrollToBottom: () => void;
177
308
  }
178
309
  export interface UseConversationReturn {
179
310
  messages: Ref<ConversationMessage[]>;
180
- appendDelta: (delta: ConversationStreamInput) => void;
181
- setMessages: (messages: ConversationMessage[]) => void;
182
- reset: () => void;
183
- }
184
- export interface ConversationStreamConsumeOptions {
185
- /** Continue the last assistant message and ignore already consumed event IDs. */
186
- resume?: boolean;
187
- signal?: AbortSignal;
188
- }
189
- export type ConversationStreamSource = Response | Promise<Response> | ReadableStream<Uint8Array>;
190
- export interface UseConversationStreamReturn {
191
- messages: Ref<ConversationMessage[]>;
192
- status: Ref<ConversationStreamStatus>;
193
- error: Ref<Error | null>;
194
- /** `event: session` data used only by the runKeep resume request. */
195
- runSessionId: Ref<string | null>;
196
- /** Chunk `session_id` used by the next runKeep chat request. */
197
- chatSessionId: Ref<string | null>;
198
- /** Last successfully consumed numeric SSE id; `-1` before the first event. */
199
- lastEventId: Ref<number>;
200
- consume: (input: ConversationStreamSource, options?: ConversationStreamConsumeOptions) => Promise<void>;
201
- abort: () => void;
311
+ appendMessage: (message: ConversationMessage) => void;
312
+ setMessages: (messages: readonly ConversationMessage[]) => void;
202
313
  reset: () => void;
203
314
  }
204
- export interface ChatSenderTheme {
205
- inputBg?: string;
206
- inputBorder?: string;
207
- inputFocusBorder?: string;
208
- buttonPrimaryBg?: string;
209
- buttonPrimaryColor?: string;
210
- buttonSecondaryBg?: string;
211
- buttonSecondaryColor?: string;
212
- }
213
315
  export interface ChatSenderProps {
214
316
  placeholder?: string;
215
317
  disabled?: boolean;
216
318
  showAttachment?: boolean;
217
- showToolbar?: boolean;
218
319
  maxRows?: number;
219
- modelValue?: string;
220
- theme?: ChatSenderTheme;
320
+ draft?: string;
321
+ attachments?: readonly ChatComposerAttachment[];
322
+ uploadConfig?: ChatUploadConfig;
323
+ attachmentLimits?: Partial<ChatAttachmentLimits>;
324
+ streaming?: boolean;
325
+ theme?: ChatTheme;
326
+ showScreenshot?: boolean;
327
+ customMenuItems?: readonly ChatAttachmentMenuItem[];
328
+ quickActions?: readonly ChatSenderQuickAction[];
329
+ activeQuickAction?: string | null;
330
+ }
331
+ export type ResponseStatus = 'in_progress' | 'completed' | 'incomplete' | 'failed';
332
+ export type ResponseOutputItemStatus = 'in_progress' | 'completed' | 'incomplete' | 'failed';
333
+ export interface ResponseOutputTextPart {
334
+ type: 'output_text';
335
+ text: string;
336
+ [key: string]: unknown;
337
+ }
338
+ export interface ResponseUnknownContentPart {
339
+ type: string;
340
+ [key: string]: unknown;
341
+ }
342
+ export type ResponseMessageContentPart = ResponseOutputTextPart | ResponseUnknownContentPart;
343
+ export interface ResponseOutputMessage {
344
+ type: 'message';
345
+ id?: string;
346
+ role: 'assistant';
347
+ content: ResponseMessageContentPart[];
348
+ status?: ResponseOutputItemStatus;
349
+ [key: string]: unknown;
350
+ }
351
+ export interface ResponseReasoningSummaryPart {
352
+ type: 'summary_text';
353
+ text?: string;
354
+ [key: string]: unknown;
355
+ }
356
+ export interface ResponseReasoningTextPart {
357
+ type: 'reasoning_text';
358
+ text: string;
359
+ [key: string]: unknown;
360
+ }
361
+ export interface ResponseReasoningItem {
362
+ type: 'reasoning';
363
+ id?: string;
364
+ summary?: ResponseReasoningSummaryPart[];
365
+ content?: ResponseReasoningTextPart[];
366
+ encrypted_content?: string;
367
+ status?: ResponseOutputItemStatus;
368
+ [key: string]: unknown;
369
+ }
370
+ export interface ResponseFunctionCallItem {
371
+ type: 'function_call';
372
+ id?: string;
373
+ call_id: string;
374
+ name: string;
375
+ arguments: string;
376
+ status?: ResponseOutputItemStatus;
377
+ [key: string]: unknown;
378
+ }
379
+ export interface ResponseUnknownOutputItem {
380
+ type: string;
381
+ id?: string;
382
+ status?: string;
383
+ [key: string]: unknown;
384
+ }
385
+ export type ResponseOutputItem = ResponseOutputMessage | ResponseReasoningItem | ResponseFunctionCallItem | ResponseUnknownOutputItem;
386
+ export interface ResponseError {
387
+ code?: string | null;
388
+ message: string;
389
+ [key: string]: unknown;
390
+ }
391
+ export interface ResponseObject {
392
+ created_at: number;
393
+ id: string;
394
+ max_output_tokens?: number | null;
395
+ model: string;
396
+ object: 'response';
397
+ output?: ResponseOutputItem[];
398
+ status?: ResponseStatus;
399
+ error?: ResponseError | null;
400
+ incomplete_details?: {
401
+ reason?: string;
402
+ [key: string]: unknown;
403
+ } | null;
404
+ instructions?: string | null;
405
+ previous_response_id?: string | null;
406
+ thinking?: {
407
+ type: 'enabled' | 'disabled' | 'auto';
408
+ [key: string]: unknown;
409
+ } | null;
410
+ service_tier?: string;
411
+ text?: Record<string, unknown>;
412
+ tools?: unknown[];
413
+ top_p?: number | null;
414
+ temperature?: number | null;
415
+ usage?: Record<string, unknown> | null;
416
+ store?: boolean;
417
+ caching?: Record<string, unknown>;
418
+ expire_at?: number | null;
419
+ context_management?: Record<string, unknown>;
420
+ [key: string]: unknown;
421
+ }
422
+ interface ResponseStreamEventBase<T extends string> {
423
+ type: T;
424
+ sequence_number: number;
425
+ }
426
+ interface ResponseLifecycleEvent<T extends string> extends ResponseStreamEventBase<T> {
427
+ response: ResponseObject;
428
+ }
429
+ export type ResponseCreatedEvent = ResponseLifecycleEvent<'response.created'>;
430
+ export type ResponseInProgressEvent = ResponseLifecycleEvent<'response.in_progress'>;
431
+ export type ResponseCompletedEvent = ResponseLifecycleEvent<'response.completed'>;
432
+ export type ResponseIncompleteEvent = ResponseLifecycleEvent<'response.incomplete'>;
433
+ export type ResponseFailedEvent = ResponseLifecycleEvent<'response.failed'>;
434
+ export interface ResponseOutputItemAddedEvent extends ResponseStreamEventBase<'response.output_item.added'> {
435
+ output_index: number;
436
+ item: ResponseOutputItem;
437
+ }
438
+ export interface ResponseOutputItemDoneEvent extends ResponseStreamEventBase<'response.output_item.done'> {
439
+ output_index: number;
440
+ item: ResponseOutputItem;
441
+ /** GA-only original file metadata attached to the completed output item. */
442
+ resource_files?: Record<string, unknown>;
443
+ }
444
+ export interface ResponseContentPartAddedEvent extends ResponseStreamEventBase<'response.content_part.added'> {
445
+ item_id: string;
446
+ output_index: number;
447
+ content_index: number;
448
+ part: ResponseMessageContentPart;
449
+ }
450
+ export interface ResponseContentPartDoneEvent extends ResponseStreamEventBase<'response.content_part.done'> {
451
+ item_id: string;
452
+ output_index: number;
453
+ content_index: number;
454
+ part: ResponseMessageContentPart;
455
+ }
456
+ export interface ResponseOutputTextDeltaEvent extends ResponseStreamEventBase<'response.output_text.delta'> {
457
+ item_id: string;
458
+ output_index: number;
459
+ content_index: number;
460
+ delta: string;
461
+ }
462
+ export interface ResponseOutputTextDoneEvent extends ResponseStreamEventBase<'response.output_text.done'> {
463
+ item_id: string;
464
+ output_index: number;
465
+ content_index: number;
466
+ text: string;
221
467
  }
468
+ export interface ResponseReasoningSummaryPartAddedEvent extends ResponseStreamEventBase<'response.reasoning_summary_part.added'> {
469
+ item_id: string;
470
+ output_index: number;
471
+ summary_index: number;
472
+ part: ResponseReasoningSummaryPart;
473
+ }
474
+ export interface ResponseReasoningSummaryPartDoneEvent extends ResponseStreamEventBase<'response.reasoning_summary_part.done'> {
475
+ item_id: string;
476
+ output_index: number;
477
+ summary_index: number;
478
+ part: ResponseReasoningSummaryPart;
479
+ }
480
+ export interface ResponseReasoningSummaryTextDeltaEvent extends ResponseStreamEventBase<'response.reasoning_summary_text.delta'> {
481
+ item_id: string;
482
+ output_index: number;
483
+ summary_index: number;
484
+ delta: string;
485
+ }
486
+ export interface ResponseReasoningSummaryTextDoneEvent extends ResponseStreamEventBase<'response.reasoning_summary_text.done'> {
487
+ item_id: string;
488
+ output_index: number;
489
+ summary_index: number;
490
+ text: string;
491
+ }
492
+ export interface ResponseFunctionCallArgumentsDeltaEvent extends ResponseStreamEventBase<'response.function_call_arguments.delta'> {
493
+ item_id: string;
494
+ output_index: number;
495
+ delta: string;
496
+ }
497
+ export interface ResponseFunctionCallArgumentsDoneEvent extends ResponseStreamEventBase<'response.function_call_arguments.done'> {
498
+ item_id: string;
499
+ output_index: number;
500
+ arguments: string;
501
+ }
502
+ export interface ResponseApiErrorEvent extends ResponseStreamEventBase<'error'> {
503
+ code?: string | null;
504
+ message: string;
505
+ param?: string | null;
506
+ }
507
+ export type ResponseStreamEvent = ResponseCreatedEvent | ResponseInProgressEvent | ResponseCompletedEvent | ResponseIncompleteEvent | ResponseFailedEvent | ResponseOutputItemAddedEvent | ResponseOutputItemDoneEvent | ResponseContentPartAddedEvent | ResponseContentPartDoneEvent | ResponseOutputTextDeltaEvent | ResponseOutputTextDoneEvent | ResponseReasoningSummaryPartAddedEvent | ResponseReasoningSummaryPartDoneEvent | ResponseReasoningSummaryTextDeltaEvent | ResponseReasoningSummaryTextDoneEvent | ResponseFunctionCallArgumentsDeltaEvent | ResponseFunctionCallArgumentsDoneEvent | ResponseApiErrorEvent;
508
+ export interface ResponseSseFrame {
509
+ event?: string;
510
+ id?: string;
511
+ retry?: number;
512
+ data: string;
513
+ raw: string;
514
+ }
515
+ export interface ChatBotConsumeOptions {
516
+ signal?: AbortSignal;
517
+ onEvent?: (event: ResponseStreamEvent, frame: ResponseSseFrame) => void;
518
+ }
519
+ export type ResponseStreamSource = Response | Promise<Response>;
222
520
  export interface ChatBotProps {
223
- messages: readonly ConversationMessage[] | Ref<readonly ConversationMessage[]>;
521
+ messages: readonly ConversationMessage[];
522
+ draft?: string;
523
+ attachments?: readonly ChatComposerAttachment[];
224
524
  showSidebar?: boolean;
225
525
  sidebarWidth?: string | number;
226
526
  senderConfig?: Partial<ChatSenderProps>;
227
- conversationConfig?: Partial<AiConversationProps>;
228
- theme?: ConversationTheme;
527
+ conversationConfig?: ConversationListConfig;
528
+ theme?: ChatTheme;
529
+ colorMode?: ChatColorMode;
530
+ uploadConfig?: ChatUploadConfig;
531
+ attachmentLimits?: Partial<ChatAttachmentLimits>;
532
+ previewRenderers?: ChatPreviewRendererMap;
533
+ toolRenderers?: ChatToolRendererMap;
534
+ toolStates?: ChatToolStates;
535
+ }
536
+ export interface ChatBotExpose {
537
+ consume: (input: ResponseStreamSource, options?: ChatBotConsumeOptions) => Promise<void>;
538
+ abort: () => void;
539
+ scrollToBottom: () => void;
540
+ sendNextQueued: () => void;
229
541
  }
542
+ export {};
230
543
  //# sourceMappingURL=types.d.ts.map