@huyooo/ai-chat-frontend-react 0.2.12 → 0.2.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -84
- package/dist/KaTeX_AMS-Regular-CYEKBG2K.woff +0 -0
- package/dist/KaTeX_AMS-Regular-JKX5W2C4.ttf +0 -0
- package/dist/KaTeX_AMS-Regular-U6PRYMIZ.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-5QL5CMTE.woff2 +0 -0
- package/dist/KaTeX_Caligraphic-Bold-WZ3QSGD3.woff +0 -0
- package/dist/KaTeX_Caligraphic-Bold-ZTS3R3HK.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-3LKEU76G.woff +0 -0
- package/dist/KaTeX_Caligraphic-Regular-A7XRTZ5Q.ttf +0 -0
- package/dist/KaTeX_Caligraphic-Regular-KX5MEWCF.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-2QVFK6NQ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Bold-T4SWXBMT.woff +0 -0
- package/dist/KaTeX_Fraktur-Bold-WGHVTYOR.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-2PEIFJSJ.woff2 +0 -0
- package/dist/KaTeX_Fraktur-Regular-5U4OPH2X.ttf +0 -0
- package/dist/KaTeX_Fraktur-Regular-PQMHCIK6.woff +0 -0
- package/dist/KaTeX_Main-Bold-2GA4IZIN.woff +0 -0
- package/dist/KaTeX_Main-Bold-W5FBVCZM.ttf +0 -0
- package/dist/KaTeX_Main-Bold-YP5VVQRP.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-4P4C7HJH.woff +0 -0
- package/dist/KaTeX_Main-BoldItalic-N4V3DX7S.woff2 +0 -0
- package/dist/KaTeX_Main-BoldItalic-ODMLBJJQ.ttf +0 -0
- package/dist/KaTeX_Main-Italic-I43T2HSR.ttf +0 -0
- package/dist/KaTeX_Main-Italic-RELBIK7M.woff2 +0 -0
- package/dist/KaTeX_Main-Italic-SASNQFN2.woff +0 -0
- package/dist/KaTeX_Main-Regular-ARRPAO67.woff2 +0 -0
- package/dist/KaTeX_Main-Regular-P5I74A2A.woff +0 -0
- package/dist/KaTeX_Main-Regular-W74P5G27.ttf +0 -0
- package/dist/KaTeX_Math-BoldItalic-6EBV3DK5.woff +0 -0
- package/dist/KaTeX_Math-BoldItalic-K4WTGH3J.woff2 +0 -0
- package/dist/KaTeX_Math-BoldItalic-VB447A4D.ttf +0 -0
- package/dist/KaTeX_Math-Italic-6KGCHLFN.woff2 +0 -0
- package/dist/KaTeX_Math-Italic-KKK3USB2.woff +0 -0
- package/dist/KaTeX_Math-Italic-SON4MRCA.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-RRNVJFFW.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Bold-STQ6RXC7.ttf +0 -0
- package/dist/KaTeX_SansSerif-Bold-X5M5EMOD.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-HMPFTM52.woff2 +0 -0
- package/dist/KaTeX_SansSerif-Italic-PSN4QKYX.woff +0 -0
- package/dist/KaTeX_SansSerif-Italic-WTBAZBGY.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-2TL3USAE.ttf +0 -0
- package/dist/KaTeX_SansSerif-Regular-OQCII6EP.woff +0 -0
- package/dist/KaTeX_SansSerif-Regular-XIQ62X4E.woff2 +0 -0
- package/dist/KaTeX_Script-Regular-72OLXYNA.ttf +0 -0
- package/dist/KaTeX_Script-Regular-A5IFOEBS.woff +0 -0
- package/dist/KaTeX_Script-Regular-APUWIHLP.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-4HRHTS65.woff +0 -0
- package/dist/KaTeX_Size1-Regular-5LRUTBFT.woff2 +0 -0
- package/dist/KaTeX_Size1-Regular-7K6AASVL.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-222HN3GT.ttf +0 -0
- package/dist/KaTeX_Size2-Regular-K5ZHAIS6.woff +0 -0
- package/dist/KaTeX_Size2-Regular-LELKET5D.woff2 +0 -0
- package/dist/KaTeX_Size3-Regular-TLFPAHDE.woff +0 -0
- package/dist/KaTeX_Size3-Regular-UFCO6WCA.ttf +0 -0
- package/dist/KaTeX_Size3-Regular-WQRQ47UD.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-7PGNVPQK.ttf +0 -0
- package/dist/KaTeX_Size4-Regular-CDMV7U5C.woff2 +0 -0
- package/dist/KaTeX_Size4-Regular-PKMWZHNC.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-3F5K6SQ6.ttf +0 -0
- package/dist/KaTeX_Typewriter-Regular-MJMFSK64.woff +0 -0
- package/dist/KaTeX_Typewriter-Regular-VBYJ4NRC.woff2 +0 -0
- package/dist/index.css +2156 -603
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +126 -92
- package/dist/index.js +1605 -976
- package/dist/index.js.map +1 -1
- package/dist/style.css +130 -0
- package/package.json +3 -3
- package/src/components/ChatPanel.tsx +82 -19
- package/src/components/common/SettingsPanel.css +81 -0
- package/src/components/common/SettingsPanel.tsx +96 -1
- package/src/components/input/ChatInput.css +0 -1
- package/src/components/input/ChatInput.tsx +48 -26
- package/src/components/input/DropdownSelector.css +66 -0
- package/src/components/input/DropdownSelector.tsx +157 -19
- package/src/components/message/MessageBubble.css +5 -2
- package/src/components/message/MessageBubble.tsx +44 -35
- package/src/components/message/PartsRenderer.css +8 -0
- package/src/components/message/PartsRenderer.tsx +137 -83
- package/src/components/message/parts/CollapsibleCard.css +4 -2
- package/src/components/message/parts/CollapsibleCard.tsx +4 -1
- package/src/components/message/parts/ImagePart.css +0 -1
- package/src/components/message/parts/TextPart.css +574 -5
- package/src/components/message/parts/TextPart.tsx +201 -8
- package/src/components/message/parts/ToolCallPart.css +139 -115
- package/src/components/message/parts/ToolCallPart.tsx +138 -134
- package/src/components/message/parts/ToolResultPart.css +0 -1
- package/src/components/message/parts/index.ts +3 -1
- package/src/components/message/parts/visual-predicate.ts +43 -0
- package/src/components/message/parts/visual-render.ts +19 -0
- package/src/components/message/parts/visual.ts +12 -0
- package/src/context/RenderersContext.tsx +19 -25
- package/src/hooks/useChat.ts +567 -79
- package/src/hooks/useImageUpload.ts +104 -12
- package/src/hooks/useVoiceInput.ts +17 -0
- package/src/index.ts +19 -16
- package/src/styles.css +130 -0
- package/src/types/index.ts +52 -68
- package/src/components/message/ContentRenderer.tsx +0 -63
- package/src/components/message/ToolResultRenderer.tsx +0 -21
- package/src/components/message/blocks/CodeBlock.tsx +0 -60
- package/src/components/message/blocks/TextBlock.tsx +0 -15
- package/src/components/message/blocks/blocks.css +0 -141
- package/src/components/message/blocks/index.ts +0 -6
- package/src/components/message/parts/ToolResultPart.tsx +0 -96
- package/src/components/message/tool-results/DefaultToolResult.tsx +0 -26
- package/src/components/message/tool-results/SearchResults.tsx +0 -69
- package/src/components/message/tool-results/WeatherCard.tsx +0 -63
- package/src/components/message/tool-results/index.ts +0 -7
- package/src/components/message/tool-results/tool-results.css +0 -181
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { ChatMode as ChatMode$1, ThinkingMode, ModelOption as ModelOption$1, Ses
|
|
|
2
2
|
export { ChatAdapter, ChatEvent, ChatEventType, ChatMode, ChatOptions, MessageRecord, ModelOption, ProviderType, SessionRecord, ThinkingMode } from '@huyooo/ai-chat-bridge-electron/renderer';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { FC, ReactNode, ComponentType } from 'react';
|
|
5
|
-
|
|
6
|
-
export { CodeBlock as CodeBlockType, ContentBlock, ContentBlockType, SearchResultItem, TextBlock as TextBlockType, ToolRendererProps, WeatherData, getLanguageDisplayName, highlightCode, parseContent, renderMarkdown } from '@huyooo/ai-chat-shared';
|
|
5
|
+
export { CodeBlock as CodeBlockType, ContentBlock, ContentBlockType, SearchResultItem, TextBlock as TextBlockType, WeatherData, getLanguageDisplayName, highlightCode, parseContent, renderMarkdown } from '@huyooo/ai-chat-shared';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Chat Adapter 辅助类型和工具
|
|
@@ -77,58 +76,79 @@ interface SearchResult {
|
|
|
77
76
|
snippet: string;
|
|
78
77
|
}
|
|
79
78
|
/** 文本内容 Part */
|
|
80
|
-
interface TextPart {
|
|
79
|
+
interface TextPart$1 {
|
|
81
80
|
type: 'text';
|
|
82
81
|
text: string;
|
|
83
82
|
}
|
|
83
|
+
/** 代码块 Part(从 text 中解析,或直接返回)*/
|
|
84
|
+
interface CodePart {
|
|
85
|
+
type: 'code';
|
|
86
|
+
content: string;
|
|
87
|
+
language?: string;
|
|
88
|
+
}
|
|
84
89
|
/** 思考过程 Part */
|
|
85
|
-
interface ThinkingPart {
|
|
90
|
+
interface ThinkingPart$1 {
|
|
86
91
|
type: 'thinking';
|
|
87
92
|
text: string;
|
|
88
93
|
status: 'running' | 'done';
|
|
89
94
|
duration?: number;
|
|
90
95
|
}
|
|
91
96
|
/** 搜索 Part */
|
|
92
|
-
interface SearchPart {
|
|
97
|
+
interface SearchPart$1 {
|
|
93
98
|
type: 'search';
|
|
94
99
|
query?: string;
|
|
95
100
|
results?: SearchResult[];
|
|
96
101
|
status: 'running' | 'done';
|
|
97
102
|
}
|
|
98
|
-
/** 工具调用 Part
|
|
99
|
-
interface ToolCallPart {
|
|
103
|
+
/** 工具调用 Part(仅展示执行过程,结果由具体类型 Part 渲染)*/
|
|
104
|
+
interface ToolCallPart$1 {
|
|
100
105
|
type: 'tool_call';
|
|
101
106
|
id: string;
|
|
102
107
|
name: string;
|
|
103
108
|
args?: Record<string, unknown>;
|
|
104
109
|
status: 'pending' | 'running' | 'done' | 'error' | 'cancelled' | 'skipped';
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
id: string;
|
|
111
|
-
name: string;
|
|
112
|
-
args?: Record<string, unknown>;
|
|
113
|
-
result: unknown;
|
|
114
|
-
status: 'done' | 'error' | 'cancelled' | 'skipped';
|
|
110
|
+
/** 工具执行输出(用于 execute_command 等需要展示 stdout/stderr 的工具) */
|
|
111
|
+
output?: {
|
|
112
|
+
stdout?: string;
|
|
113
|
+
stderr?: string;
|
|
114
|
+
};
|
|
115
115
|
}
|
|
116
116
|
/** 图片 Part */
|
|
117
|
-
interface ImagePart {
|
|
117
|
+
interface ImagePart$1 {
|
|
118
118
|
type: 'image';
|
|
119
119
|
url: string;
|
|
120
120
|
}
|
|
121
121
|
/** 错误 Part */
|
|
122
|
-
interface ErrorPart {
|
|
122
|
+
interface ErrorPart$1 {
|
|
123
123
|
type: 'error';
|
|
124
124
|
message: string;
|
|
125
125
|
category?: string;
|
|
126
126
|
retryable?: boolean;
|
|
127
127
|
}
|
|
128
|
-
/**
|
|
129
|
-
|
|
128
|
+
/** 天气 Part(由 get_weather 工具生成)*/
|
|
129
|
+
interface WeatherPart {
|
|
130
|
+
type: 'weather';
|
|
131
|
+
city: string;
|
|
132
|
+
temperature: number;
|
|
133
|
+
condition: string;
|
|
134
|
+
humidity: number;
|
|
135
|
+
wind: string;
|
|
136
|
+
reportTime?: string;
|
|
137
|
+
province?: string;
|
|
138
|
+
}
|
|
139
|
+
/** 自定义 Part 基础接口(用于扩展)*/
|
|
140
|
+
interface CustomPart {
|
|
141
|
+
type: string;
|
|
142
|
+
[key: string]: unknown;
|
|
143
|
+
}
|
|
144
|
+
/** 内置 Part 联合类型 */
|
|
145
|
+
type BuiltinPart = TextPart$1 | CodePart | ThinkingPart$1 | SearchPart$1 | ToolCallPart$1 | ImagePart$1 | ErrorPart$1;
|
|
146
|
+
/** 内容 Part 联合类型(包含内置和扩展类型)*/
|
|
147
|
+
type ContentPart = BuiltinPart | WeatherPart | CustomPart;
|
|
130
148
|
/** 内容 Part 类型字符串 */
|
|
131
|
-
type ContentPartType =
|
|
149
|
+
type ContentPartType = string;
|
|
150
|
+
/** 步骤折叠模式 */
|
|
151
|
+
type StepsExpandedType = 'open' | 'close' | 'auto';
|
|
132
152
|
/** 错误详情(结构化错误信息) */
|
|
133
153
|
interface ErrorDetails {
|
|
134
154
|
category?: string;
|
|
@@ -159,7 +179,7 @@ interface ChatMessage {
|
|
|
159
179
|
/** 是否已复制 */
|
|
160
180
|
copied?: boolean;
|
|
161
181
|
/** 消息时间戳 */
|
|
162
|
-
timestamp?:
|
|
182
|
+
timestamp?: number;
|
|
163
183
|
/** 错误详情(如果有错误) */
|
|
164
184
|
error?: ErrorDetails;
|
|
165
185
|
/** 是否被用户中止 */
|
|
@@ -240,7 +260,7 @@ declare function useChat(options: UseChatOptions): {
|
|
|
240
260
|
cancelRequest: () => void;
|
|
241
261
|
copyMessage: (messageId: string) => Promise<void>;
|
|
242
262
|
regenerateMessage: (messageIndex: number) => void;
|
|
243
|
-
resendFromIndex: (index: number, text: string) => void
|
|
263
|
+
resendFromIndex: (index: number, text: string) => Promise<void>;
|
|
244
264
|
setMode: (value: ChatMode$1) => void;
|
|
245
265
|
setModel: (value: string) => void;
|
|
246
266
|
setWebSearch: (value: boolean) => void;
|
|
@@ -249,6 +269,12 @@ declare function useChat(options: UseChatOptions): {
|
|
|
249
269
|
autoRunConfig: AutoRunConfig;
|
|
250
270
|
loadAutoRunConfig: () => Promise<void>;
|
|
251
271
|
saveAutoRunConfig: (config: AutoRunConfig) => Promise<void>;
|
|
272
|
+
enabledTools: string[] | undefined;
|
|
273
|
+
allTools: {
|
|
274
|
+
name: string;
|
|
275
|
+
description: string;
|
|
276
|
+
}[];
|
|
277
|
+
saveEnabledTools: (tools: string[] | undefined) => Promise<void>;
|
|
252
278
|
};
|
|
253
279
|
|
|
254
280
|
/**
|
|
@@ -277,24 +303,21 @@ interface ChatInputProviderProps {
|
|
|
277
303
|
declare const ChatInputProvider: FC<ChatInputProviderProps>;
|
|
278
304
|
declare function useChatInputContext(): ChatInputContextValue | null;
|
|
279
305
|
|
|
280
|
-
/**
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
type
|
|
286
|
-
/**
|
|
287
|
-
declare const
|
|
288
|
-
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
interface RenderersProviderProps {
|
|
292
|
-
blockRenderers?: BlockRenderers;
|
|
293
|
-
toolRenderers?: ToolRenderers;
|
|
306
|
+
/** Part 渲染器 Props(每个自定义渲染器接收的 props) */
|
|
307
|
+
interface PartRendererProps {
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
}
|
|
310
|
+
/** Part 渲染器映射(key: part.type, value: 渲染组件) */
|
|
311
|
+
type PartRenderers$1 = Record<string, ComponentType<PartRendererProps>>;
|
|
312
|
+
/** Part 渲染器上下文 */
|
|
313
|
+
declare const PartRenderersContext: react.Context<PartRenderers$1>;
|
|
314
|
+
/** Part 渲染器 Provider Props */
|
|
315
|
+
interface PartRenderersProviderProps {
|
|
316
|
+
partRenderers?: PartRenderers$1;
|
|
294
317
|
children: ReactNode;
|
|
295
318
|
}
|
|
296
|
-
/** 渲染器 Provider */
|
|
297
|
-
declare const
|
|
319
|
+
/** Part 渲染器 Provider */
|
|
320
|
+
declare const PartRenderersProvider: FC<PartRenderersProviderProps>;
|
|
298
321
|
|
|
299
322
|
/** 功能项 */
|
|
300
323
|
interface WelcomeFeature {
|
|
@@ -356,8 +379,8 @@ interface ChatPanelProps {
|
|
|
356
379
|
className?: string;
|
|
357
380
|
/** 欢迎页配置 */
|
|
358
381
|
welcomeConfig?: Partial<WelcomeConfig>;
|
|
359
|
-
/**
|
|
360
|
-
|
|
382
|
+
/** 自定义 Part 渲染器 - 根据 part.type 选择渲染组件(如 weather, stock 等) */
|
|
383
|
+
partRenderers?: PartRenderers$1;
|
|
361
384
|
/**
|
|
362
385
|
* 执行步骤折叠模式
|
|
363
386
|
* - 'open': 始终展开
|
|
@@ -397,69 +420,77 @@ interface MessageBubbleProps {
|
|
|
397
420
|
stepsExpandedType?: 'open' | 'close' | 'auto';
|
|
398
421
|
/** 工具调用相关 - 通过 props 传递 */
|
|
399
422
|
adapter?: ChatAdapter;
|
|
423
|
+
/** 取消工具调用(通常会中止当前请求/流式输出) */
|
|
424
|
+
onCancelToolCall?: (toolCallId: string) => void;
|
|
400
425
|
autoRunConfig?: AutoRunConfig;
|
|
401
426
|
onSaveConfig?: (config: AutoRunConfig) => Promise<void>;
|
|
402
427
|
}
|
|
403
428
|
declare const MessageBubble: FC<MessageBubbleProps>;
|
|
404
429
|
|
|
405
|
-
/**
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
onCodeCopy?: (code: string) => void;
|
|
430
|
+
/** Part 渲染器映射类型 */
|
|
431
|
+
type PartRenderers = Record<string, ComponentType<Record<string, unknown>>>;
|
|
432
|
+
interface PartsRendererProps {
|
|
433
|
+
parts: ContentPart[];
|
|
434
|
+
expandedType?: StepsExpandedType;
|
|
435
|
+
/** 自定义 Part 渲染器(props 传入优先级高于 context) */
|
|
436
|
+
partRenderers?: PartRenderers;
|
|
437
|
+
adapter?: ChatAdapter;
|
|
438
|
+
onCancelToolCall?: (toolCallId: string) => void;
|
|
439
|
+
autoRunConfig?: AutoRunConfig;
|
|
440
|
+
onSaveConfig?: (config: AutoRunConfig) => Promise<void>;
|
|
417
441
|
}
|
|
418
|
-
declare const
|
|
442
|
+
declare const PartsRenderer: FC<PartsRendererProps>;
|
|
419
443
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
*/
|
|
423
|
-
|
|
424
|
-
interface TextBlockProps {
|
|
425
|
-
block: TextBlock$1;
|
|
444
|
+
interface TextPartProps {
|
|
445
|
+
text: string;
|
|
426
446
|
}
|
|
427
|
-
declare const
|
|
428
|
-
|
|
429
|
-
/**
|
|
430
|
-
* 代码块组件
|
|
431
|
-
*/
|
|
447
|
+
declare const TextPart: FC<TextPartProps>;
|
|
432
448
|
|
|
433
|
-
interface
|
|
434
|
-
|
|
435
|
-
|
|
449
|
+
interface ThinkingPartProps {
|
|
450
|
+
text: string;
|
|
451
|
+
status: 'running' | 'done';
|
|
452
|
+
duration?: number;
|
|
453
|
+
expandedType?: StepsExpandedType;
|
|
436
454
|
}
|
|
437
|
-
declare const
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* 工具结果渲染器
|
|
441
|
-
* 根据工具名称选择合适的渲染组件
|
|
442
|
-
*/
|
|
443
|
-
|
|
444
|
-
declare const ToolResultRenderer: FC<ToolRendererProps>;
|
|
445
|
-
|
|
446
|
-
/**
|
|
447
|
-
* 默认工具结果渲染器
|
|
448
|
-
*/
|
|
449
|
-
|
|
450
|
-
declare const DefaultToolResult: FC<ToolRendererProps>;
|
|
455
|
+
declare const ThinkingPart: FC<ThinkingPartProps>;
|
|
451
456
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
457
|
+
interface SearchPartProps {
|
|
458
|
+
query?: string;
|
|
459
|
+
results?: SearchResult[];
|
|
460
|
+
status: 'running' | 'done';
|
|
461
|
+
expandedType?: StepsExpandedType;
|
|
462
|
+
}
|
|
463
|
+
declare const SearchPart: FC<SearchPartProps>;
|
|
455
464
|
|
|
456
|
-
|
|
465
|
+
interface ToolCallPartProps {
|
|
466
|
+
id: string;
|
|
467
|
+
name: string;
|
|
468
|
+
args?: Record<string, unknown>;
|
|
469
|
+
output?: {
|
|
470
|
+
stdout?: string;
|
|
471
|
+
stderr?: string;
|
|
472
|
+
};
|
|
473
|
+
status: 'pending' | 'running' | 'done' | 'error' | 'cancelled' | 'skipped';
|
|
474
|
+
expandedType?: StepsExpandedType;
|
|
475
|
+
adapter?: ChatAdapter;
|
|
476
|
+
onCancelToolCall?: (toolCallId: string) => void;
|
|
477
|
+
autoRunConfig?: AutoRunConfig;
|
|
478
|
+
onSaveConfig?: (config: AutoRunConfig) => Promise<void>;
|
|
479
|
+
}
|
|
480
|
+
declare const ToolCallPart: FC<ToolCallPartProps>;
|
|
457
481
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
482
|
+
interface ImagePartProps {
|
|
483
|
+
url: string;
|
|
484
|
+
alt?: string;
|
|
485
|
+
}
|
|
486
|
+
declare const ImagePart: FC<ImagePartProps>;
|
|
461
487
|
|
|
462
|
-
|
|
488
|
+
interface ErrorPartProps {
|
|
489
|
+
message: string;
|
|
490
|
+
category?: string;
|
|
491
|
+
retryable?: boolean;
|
|
492
|
+
}
|
|
493
|
+
declare const ErrorPart: FC<ErrorPartProps>;
|
|
463
494
|
|
|
464
495
|
/** ChatInput 暴露给外部的方法 */
|
|
465
496
|
interface ChatInputHandle {
|
|
@@ -479,9 +510,12 @@ interface ChatInputProps {
|
|
|
479
510
|
variant?: 'input' | 'message';
|
|
480
511
|
/** 受控值(用于历史消息编辑) */
|
|
481
512
|
value?: string;
|
|
513
|
+
/** 图片数据(用于历史消息编辑) */
|
|
514
|
+
images?: string[];
|
|
482
515
|
isLoading?: boolean;
|
|
483
516
|
mode?: ChatMode;
|
|
484
517
|
model?: string;
|
|
518
|
+
/** 模型列表(tooltip 由后端下发,前端仅透传渲染) */
|
|
485
519
|
models?: ModelOption[];
|
|
486
520
|
webSearchEnabled?: boolean;
|
|
487
521
|
thinkingEnabled?: boolean;
|
|
@@ -579,4 +613,4 @@ interface ToastProps {
|
|
|
579
613
|
}
|
|
580
614
|
declare const Toast: FC<ToastProps>;
|
|
581
615
|
|
|
582
|
-
export {
|
|
616
|
+
export { ChatHeader, ChatInput, type ChatInputContextValue, type ChatInputOptions, ChatInputProvider, type ChatMessage, ChatPanel, type ChatPanelHandle, ConfirmDialog, type ContentPart, type ContentPartType, type CreateSessionOptions, type ErrorDetails, type ErrorPart$1 as ErrorPart, ErrorPart as ErrorPartComponent, type ImageData, type ImagePart$1 as ImagePart, ImagePart as ImagePartComponent, MessageBubble, type PartRendererProps, type PartRenderers$1 as PartRenderers, PartRenderersContext, PartRenderersProvider, PartsRenderer, type SaveMessageOptions, type SearchPart$1 as SearchPart, SearchPart as SearchPartComponent, type SearchResult, type SendMessageOptions, type SideEffect, type TextPart$1 as TextPart, TextPart as TextPartComponent, type ThinkingData, type ThinkingPart$1 as ThinkingPart, ThinkingPart as ThinkingPartComponent, Toast, type ToolCallData, type ToolCallPart$1 as ToolCallPart, ToolCallPart as ToolCallPartComponent, type ToolCompleteEvent, type ToolResultData, type UpdateSessionOptions, type UseChatOptions, type WelcomeConfig, type WelcomeFeature, WelcomeMessage, type WelcomeTask, defaultWelcomeConfig, getMessageText, useChat, useChatInputContext };
|