fix: restore coding history and quota feedback

This commit is contained in:
inman
2026-09-01 11:46:04 +08:00
parent 38f85f6b5e
commit d523b72cf8
14 changed files with 480 additions and 49 deletions

View File

@@ -3,8 +3,10 @@ export type AIGatewayErrorKind = 'quota_exhausted' | 'authentication_invalid';
export function isTokenBalanceExhausted(message: string | null | undefined): boolean {
const normalized = message?.trim().toLowerCase() ?? '';
return normalized.includes('token_balance_exhausted')
|| normalized.includes('token_point_balance_exhausted')
|| normalized.includes('token balance exhausted')
|| normalized.includes('balance exhausted');
|| normalized.includes('balance exhausted')
|| normalized.includes('词元点数余额不足');
}
export function getAIGatewayErrorKind(message: string | null | undefined): AIGatewayErrorKind | null {

View File

@@ -28,6 +28,7 @@ export type CodingRuntimeErrorCode =
| 'CODING_RUNTIME_READY_TIMEOUT'
| 'CODING_RUNTIME_PROTOCOL_ERROR'
| 'CODING_PROVIDER_AUTH_REQUIRED'
| 'CODING_PROVIDER_QUOTA_EXHAUSTED'
| 'CODING_MODEL_UNAVAILABLE'
| 'CODING_SESSION_UNREADABLE'
| 'CODING_STORAGE_WRITE_FAILED'

View File

@@ -60,6 +60,7 @@ const ERROR_CODES = new Set([
'CODING_RUNTIME_READY_TIMEOUT',
'CODING_RUNTIME_PROTOCOL_ERROR',
'CODING_PROVIDER_AUTH_REQUIRED',
'CODING_PROVIDER_QUOTA_EXHAUSTED',
'CODING_MODEL_UNAVAILABLE',
'CODING_SESSION_UNREADABLE',
'CODING_STORAGE_WRITE_FAILED',