feat(chat): 为图片附件添加类型标识以支持多类型附件
在图片消息的接口类型中显式添加 `type: 'image'` 属性,为后续支持多种附件类型(如视频、文件等)做好类型基础。
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user