mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
feat: add custom message for 429 errors (#1366)
This commit is contained in:
parent
f7caca5f94
commit
d3f13c71ae
6 changed files with 133 additions and 25 deletions
|
|
@ -398,12 +398,15 @@ export const useGeminiStream = (
|
|||
addItem(
|
||||
{
|
||||
type: MessageType.ERROR,
|
||||
text: parseAndFormatApiError(eventValue.error),
|
||||
text: parseAndFormatApiError(
|
||||
eventValue.error,
|
||||
config.getContentGeneratorConfig().authType,
|
||||
),
|
||||
},
|
||||
userMessageTimestamp,
|
||||
);
|
||||
},
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem],
|
||||
[addItem, pendingHistoryItemRef, setPendingHistoryItem, config],
|
||||
);
|
||||
|
||||
const handleChatCompressionEvent = useCallback(
|
||||
|
|
@ -533,10 +536,6 @@ export const useGeminiStream = (
|
|||
setPendingHistoryItem(null);
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
console.log(
|
||||
'GEMINI_DEBUG: Caught error in useGeminiStream.ts:',
|
||||
JSON.stringify(error),
|
||||
);
|
||||
if (error instanceof UnauthorizedError) {
|
||||
onAuthError();
|
||||
} else if (!isNodeError(error) || error.name !== 'AbortError') {
|
||||
|
|
@ -545,6 +544,7 @@ export const useGeminiStream = (
|
|||
type: MessageType.ERROR,
|
||||
text: parseAndFormatApiError(
|
||||
getErrorMessage(error) || 'Unknown error',
|
||||
config.getContentGeneratorConfig().authType,
|
||||
),
|
||||
},
|
||||
userMessageTimestamp,
|
||||
|
|
@ -566,6 +566,7 @@ export const useGeminiStream = (
|
|||
geminiClient,
|
||||
startNewTurn,
|
||||
onAuthError,
|
||||
config,
|
||||
],
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue