import { ViewStyle, TextStyle, StyleProp } from 'react-native'; import { ChatMessage } from '../DbChatMessage/DbChatMessage.types'; export type AIMessageRole = 'user' | 'assistant' | 'system'; export interface AIMessage extends ChatMessage { role: AIMessageRole; /** 是否正在打字机效果中 */ isTyping?: boolean; /** 打字机效果的完整内容(用于正在输入时) */ fullContent?: string; /** 是否显示思考过程 */ showThinking?: boolean; /** 思考过程内容 */ thinkingContent?: string; /** 消息来源模型 */ model?: string; /** 生成耗时(毫秒) */ generationTime?: number; /** token 数量 */ tokenCount?: number; /** 是否支持重新生成 */ regeneratable?: boolean; /** 是否支持编辑 */ editable?: boolean; /** 附件(代码、图片等) */ attachments?: Attachment[]; } export interface Attachment { id: string; type: 'code' | 'image' | 'file' | 'link'; name?: string; url?: string; content?: string; language?: string; } export interface DbAIChatProps { /** 消息列表 */ messages: AIMessage[]; /** 当前正在输入的消息(流式) */ streamingMessage?: string; /** 是否正在思考中 */ isThinking?: boolean; /** 是否正在生成中 */ isGenerating?: boolean; /** 当前用户输入 */ inputValue?: string; /** 输入占位符 */ inputPlaceholder?: string; /** 是否显示输入框 */ showInput?: boolean; /** 是否可发送 */ canSend?: boolean; /** AI 名称 */ aiName?: string; /** AI 头像 */ aiAvatar?: string; /** 用户头像 */ userAvatar?: string; /** 打字机效果速度(毫秒/字符) */ typewriterSpeed?: number; /** 是否启用打字机效果 */ enableTypewriter?: boolean; /** 是否显示重新生成按钮 */ showRegenerate?: boolean; /** 是否显示停止生成按钮 */ showStop?: boolean; /** 是否显示复制按钮 */ showCopy?: boolean; /** 代码块主题 */ codeTheme?: 'light' | 'dark'; /** 是否支持 Markdown */ supportMarkdown?: boolean; /** 发送消息回调 */ onSend?: (message: string) => void; /** 输入变化回调 */ onInputChange?: (text: string) => void; /** 重新生成回调 */ onRegenerate?: (messageId: string) => void; /** 停止生成回调 */ onStop?: () => void; /** 复制消息回调 */ onCopy?: (content: string) => void; /** 编辑消息回调 */ onEdit?: (messageId: string, newContent: string) => void; /** 删除消息回调 */ onDelete?: (messageId: string) => void; /** 点击代码块回调 */ onCodePress?: (code: string, language?: string) => void; /** 消息长按回调 */ onMessageLongPress?: (message: AIMessage) => void; /** 加载更多历史消息 */ onLoadMore?: () => void; /** 是否还有更多历史 */ hasMore?: boolean; /** 欢迎消息 */ welcomeMessage?: string; /** 空状态提示 */ emptyPrompt?: string; /** 快捷输入选项 */ quickReplies?: QuickReply[]; /** 点击快捷回复 */ onQuickReply?: (reply: QuickReply) => void; /** 自定义样式 */ style?: ViewStyle; messageContainerStyle?: ViewStyle; inputContainerStyle?: ViewStyle; bubbleStyle?: ViewStyle; textStyle?: TextStyle; } export interface QuickReply { id: string; text: string; icon?: string; description?: string; } export interface TypewriterTextProps { /** 要显示的文本 */ text: string; /** 打字速度(毫秒/字符) */ speed?: number; /** 是否支持 Markdown */ supportMarkdown?: boolean; /** 打字完成回调 */ onComplete?: () => void; /** 每打一个字回调 */ onType?: (currentText: string) => void; /** 是否自动开始 */ autoStart?: boolean; /** 文本样式 */ style?: StyleProp; /** 代码块样式 */ codeStyle?: ViewStyle; } export interface AIChatInputProps { value?: string; placeholder?: string; disabled?: boolean; loading?: boolean; multiline?: boolean; maxLines?: number; onChangeText?: (text: string) => void; onSend?: () => void; onFocus?: () => void; onBlur?: () => void; showAttachment?: boolean; onAttachmentPress?: () => void; }