修复首次会话等待与上游饱和重试
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { proxyAwareFetch } from '../../utils/proxy-fetch';
|
||||
import { logger } from '../../utils/logger';
|
||||
import { getOpencodeErrorKind } from '../../../shared/opencode-error-kind';
|
||||
import { isOpencodeUpstreamSaturated } from '../../../shared/opencode-error-details';
|
||||
|
||||
const AI_PROXY_PREFIX = '/api/ai-proxy/v1';
|
||||
const MAX_ERROR_LOG_MESSAGE_LENGTH = 600;
|
||||
@@ -81,6 +82,9 @@ function getForwardedOneApiStatus(status: number, bodyText: string): number {
|
||||
if (status === 429 && getOpencodeErrorKind(bodyText) === 'quota_exhausted') {
|
||||
return 402;
|
||||
}
|
||||
if (status === 429 && isOpencodeUpstreamSaturated(bodyText)) {
|
||||
return 400;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user