fix(desktop): error response improvements — content, retry, model selector
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

P1: onError callback now sets content to error message instead of empty string.
    Previously API errors (404/429) produced empty assistant messages with only
    a visual error badge — now the error text is persisted in message content.

P3: Retry button now re-sends the preceding user message via sendToGateway
    instead of copying to input. Works for both virtualized and non-virtualized
    message lists. Removed unused setInput prop from MessageBubble.

Also hides model selector in Tauri runtime (SaaS token pool routes models).
This commit is contained in:
iven
2026-04-09 18:52:27 +08:00
parent 125da57436
commit 5c6964f52a
2 changed files with 46 additions and 16 deletions

View File

@@ -502,10 +502,17 @@ export const useStreamStore = create<StreamState>()(
}
},
onError: (error: string) => {
// Flush any remaining buffered deltas before erroring
if (flushTimer !== null) {
clearTimeout(flushTimer);
flushTimer = null;
}
flushBuffers();
_chat?.updateMessages(msgs =>
msgs.map(m =>
m.id === assistantId
? { ...m, content: '', streaming: false, error }
? { ...m, content: error, streaming: false, error }
: m.role === 'user' && m.optimistic && m.timestamp.getTime() >= streamStartTime
? { ...m, optimistic: false }
: m