mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
优化停止,出现API Error: Stream ended without receiving any events
优化停止,出现API Error: Stream ended without receiving any events
This commit is contained in:
parent
b777e31b6a
commit
eb5a1b0278
@ -1407,6 +1407,13 @@ export function translateCliMessage(cliMsg: any, sessionId: string): ServerMessa
|
||||
switch (cliMsg.type) {
|
||||
case 'assistant': {
|
||||
if (cliMsg.error || cliMsg.isApiErrorMessage) {
|
||||
// If the user requested stop, suppress API errors caused by the
|
||||
// stream being interrupted (e.g. "Stream ended without receiving
|
||||
// any events"). The result message handler also checks this flag,
|
||||
// but the assistant error arrives first and would leak to the UI.
|
||||
if (sessionStopRequested.has(sessionId)) {
|
||||
return []
|
||||
}
|
||||
const message = extractAssistantText(cliMsg) || cliMsg.error || 'Unknown API error'
|
||||
const code = typeof cliMsg.error === 'string' ? cliMsg.error : 'API_ERROR'
|
||||
streamState.lastApiError = { message, code }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user