模型错误处理+提示词优化

This commit is contained in:
2026-11-11 23:17:02 +08:00
parent 76af622626
commit 46cbe888ac
6 changed files with 34 additions and 21 deletions
+3 -3
View File
@@ -218,11 +218,11 @@ export async function fetchAvailableModels(config: AppConfig): Promise<string[]>
function mapHttpError(status: number, text: string): string {
if (status === 400) return text || '请求参数错误,请检查模型参数配置'
if (status === 401) return '鉴权失败,请检查 API Key 是否正确'
if (status === 403) return '当前密钥无访问权限,请检查接口授权'
if (status === 401) return text || '该令牌额度已用尽'
if (status === 403) return text || '该令牌状态不可用'
if (status === 404) return '接口地址错误,请检查 BaseURL 是否正确'
if (status === 408) return '请求超时,请稍后重试'
if (status === 429) return '请求超限,请稍后重试'
if (status === 429) return '请求限流,请稍后重试'
if (status >= 500) return '服务端异常,请检查模型服务状态'
return text || `请求失败,状态码:${status}`
}