feat(chat): 为图片附件添加类型标识以支持多类型附件
在图片消息的接口类型中显式添加 `type: 'image'` 属性,为后续支持多种附件类型(如视频、文件等)做好类型基础。
This commit is contained in:
@@ -15,7 +15,7 @@ export interface ImageAttachment {
|
|||||||
preview: string;
|
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 [input, setInput] = useState('');
|
||||||
const [showCmds, setShowCmds] = useState(false);
|
const [showCmds, setShowCmds] = useState(false);
|
||||||
const [cmdIdx, setCmdIdx] = useState(0);
|
const [cmdIdx, setCmdIdx] = useState(0);
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export function ChatView() {
|
|||||||
}, [removeMessage]);
|
}, [removeMessage]);
|
||||||
|
|
||||||
// Delayed conversation creation
|
// 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;
|
if (creatingRef.current) return;
|
||||||
creatingRef.current = true;
|
creatingRef.current = true;
|
||||||
setPendingMessage({ content, images });
|
setPendingMessage({ content, images });
|
||||||
@@ -126,7 +126,7 @@ export function ChatView() {
|
|||||||
creatingRef.current = false;
|
creatingRef.current = false;
|
||||||
}, [createConversation, selectedAccountId]);
|
}, [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 (quote) { content = `> ${quote}\n\n${content}`; setQuote(null); }
|
||||||
if (conversationId) {
|
if (conversationId) {
|
||||||
send(content, images);
|
send(content, images);
|
||||||
|
|||||||
Reference in New Issue
Block a user