fix(chat): enhance file handling and error reporting in ChatInput (#80)

This commit is contained in:
Haze
2026-02-13 20:43:42 +08:00
committed by GitHub
Unverified
parent d61bc24306
commit 8a49c66891
2 changed files with 44 additions and 4 deletions

View File

@@ -523,6 +523,10 @@ export const useChatStore = create<ChatState>((set, get) => ({
try {
const idempotencyKey = crypto.randomUUID();
const hasMedia = attachments && attachments.length > 0;
console.log(`[sendMessage] hasMedia=${hasMedia}, attachmentCount=${attachments?.length ?? 0}`);
if (hasMedia) {
console.log('[sendMessage] Media paths:', attachments!.map(a => a.stagedPath));
}
let result: { success: boolean; result?: { runId?: string }; error?: string };
@@ -557,6 +561,8 @@ export const useChatStore = create<ChatState>((set, get) => ({
) as { success: boolean; result?: { runId?: string }; error?: string };
}
console.log(`[sendMessage] RPC result: success=${result.success}, error=${result.error || 'none'}, runId=${result.result?.runId || 'none'}`);
if (!result.success) {
set({ error: result.error || 'Failed to send message', sending: false });
} else if (result.result?.runId) {