fix(chat): 修复重连后对话状态丢失导致消息发送失败的问题
在 WebSocket 重连场景下,服务端可能丢失 `conversationId` 状态,导致后续消息发送被拒绝。通过在客户端消息中携带 `conversationId`,并在服务端添加 fallback 恢复逻辑,确保重连后仍能正常发送消息。 同时优化了 `pendingMessage` 类型定义,支持存储待发送的图片附件,修复了延迟发送场景下图片丢失的问题。
This commit is contained in:
@@ -75,7 +75,7 @@ export function ChatInput({ onSend, disabled, connecting }: { onSend: (content:
|
||||
const handleSend = () => {
|
||||
const text = input.trim();
|
||||
if ((!text && images.length === 0) || disabled) return;
|
||||
const imgs = images.length > 0 ? images.map(({ data, mimeType }) => ({ data, mimeType })) : undefined;
|
||||
const imgs = images.length > 0 ? images.map(({ data, mimeType }) => ({ type: 'image' as const, data, mimeType })) : undefined;
|
||||
onSend(text || '(图片)', imgs);
|
||||
setInput('');
|
||||
setImages([]);
|
||||
|
||||
Reference in New Issue
Block a user