From 401cc129b5401fbd16ed64c7d0e3bfa81819d834 Mon Sep 17 00:00:00 2001 From: sion123 <450702724@qq.com> Date: Fri, 8 May 2026 03:16:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(chat):=20=E4=B8=BA=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E9=99=84=E4=BB=B6=E6=B7=BB=E5=8A=A0=E7=B1=BB=E5=9E=8B=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E4=BB=A5=E6=94=AF=E6=8C=81=E5=A4=9A=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在图片消息的接口类型中显式添加 `type: 'image'` 属性,为后续支持多种附件类型(如视频、文件等)做好类型基础。 --- web/client/src/components/chat/ChatInput.tsx | 2 +- web/client/src/components/chat/ChatView.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/client/src/components/chat/ChatInput.tsx b/web/client/src/components/chat/ChatInput.tsx index c4c19d6..a07dc18 100644 --- a/web/client/src/components/chat/ChatInput.tsx +++ b/web/client/src/components/chat/ChatInput.tsx @@ -15,7 +15,7 @@ export interface ImageAttachment { preview: string; } -export function ChatInput({ onSend, disabled, connecting }: { onSend: (content: string, images?: Array<{ data: string; mimeType: string }>) => void; disabled?: boolean; connecting?: boolean }) { +export function ChatInput({ onSend, disabled, connecting }: { onSend: (content: string, images?: Array<{ type: 'image'; data: string; mimeType: string }>) => void; disabled?: boolean; connecting?: boolean }) { const [input, setInput] = useState(''); const [showCmds, setShowCmds] = useState(false); const [cmdIdx, setCmdIdx] = useState(0); diff --git a/web/client/src/components/chat/ChatView.tsx b/web/client/src/components/chat/ChatView.tsx index 19e1c26..78d62a3 100644 --- a/web/client/src/components/chat/ChatView.tsx +++ b/web/client/src/components/chat/ChatView.tsx @@ -108,7 +108,7 @@ export function ChatView() { }, [removeMessage]); // Delayed conversation creation - const handleSendNew = useCallback(async (content: string, images?: Array<{ data: string; mimeType: string }>) => { + const handleSendNew = useCallback(async (content: string, images?: Array<{ type: 'image'; data: string; mimeType: string }>) => { if (creatingRef.current) return; creatingRef.current = true; setPendingMessage({ content, images }); @@ -126,7 +126,7 @@ export function ChatView() { creatingRef.current = false; }, [createConversation, selectedAccountId]); - const handleSend = useCallback((content: string, images?: Array<{ data: string; mimeType: string }>) => { + const handleSend = useCallback((content: string, images?: Array<{ type: 'image'; data: string; mimeType: string }>) => { if (quote) { content = `> ${quote}\n\n${content}`; setQuote(null); } if (conversationId) { send(content, images);