mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-03 06:00:49 +00:00
fix: enhance 429 error handling and fix failed cases
This commit is contained in:
parent
3056f8a63d
commit
50e3a6ee0a
7 changed files with 68 additions and 43 deletions
|
|
@ -13,7 +13,11 @@ import type {
|
|||
ServerGeminiStreamEvent,
|
||||
TaskResultDisplay,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import { GeminiEventType, ToolErrorType } from '@qwen-code/qwen-code-core';
|
||||
import {
|
||||
GeminiEventType,
|
||||
ToolErrorType,
|
||||
parseAndFormatApiError,
|
||||
} from '@qwen-code/qwen-code-core';
|
||||
import type { Part, GenerateContentResponseUsageMetadata } from '@google/genai';
|
||||
import type {
|
||||
CLIAssistantMessage,
|
||||
|
|
@ -600,6 +604,18 @@ export abstract class BaseJsonOutputAdapter {
|
|||
}
|
||||
this.finalizePendingBlocks(state, null);
|
||||
break;
|
||||
case GeminiEventType.Error: {
|
||||
// Format the error message using parseAndFormatApiError for consistency
|
||||
// with interactive mode error display
|
||||
const errorText = parseAndFormatApiError(
|
||||
event.value.error,
|
||||
this.config.getContentGeneratorConfig()?.authType,
|
||||
undefined,
|
||||
this.config.getModel(),
|
||||
);
|
||||
this.appendText(state, errorText, null);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue