feat(rectifier): 请求整流器增加 API Key 账号签名整流支持

新增独立开关控制 API Key 账号的签名整流功能,支持配置自定义
匹配关键词以捕获不同格式的上游错误响应。

- 新增 apikey_signature_enabled 开关(默认关闭)
- 新增 apikey_signature_patterns 自定义关键词配置
- 内置签名检测规则对 API Key 账号同样生效
- 自定义关键词对完整响应体做不区分大小写匹配
- 重试二阶段检测仅做模式匹配,不重复校验开关
- Handler 层校验关键词数量(≤50)和长度(≤500)
- API 响应 nil patterns 统一序列化为空数组
- OAuth/SetupToken/Upstream/Bedrock 账号行为不变
This commit is contained in:
shaw
2026-03-26 16:43:38 +08:00
parent ce96527dd9
commit d571f300e5
8 changed files with 204 additions and 14 deletions

View File

@@ -4473,6 +4473,14 @@ export default {
thinkingSignatureHint: 'Automatically strip signatures and retry when upstream returns thinking block signature validation errors',
thinkingBudget: 'Thinking Budget Rectifier',
thinkingBudgetHint: 'Automatically set budget to 32000 and retry when upstream returns budget_tokens constraint error (≥1024)',
apikeySignature: 'API Key Signature Rectifier',
apikeySignatureHint:
'Automatically strip signatures and retry when API Key accounts receive signature-related errors (built-in patterns always apply)',
apikeyPatterns: 'Custom Match Patterns',
apikeyPatternsHint:
'Additional keywords matched against the response body (case-insensitive). Built-in patterns always apply; use these for supplementary matching.',
apikeyPatternPlaceholder: 'e.g., thinking_error',
addPattern: 'Add Pattern',
saved: 'Rectifier settings saved',
saveFailed: 'Failed to save rectifier settings'
},

View File

@@ -4637,6 +4637,14 @@ export default {
thinkingSignatureHint: '当上游返回 thinking block 签名校验错误时,自动去除签名并重试',
thinkingBudget: 'Thinking Budget 整流',
thinkingBudgetHint: '当上游返回 budget_tokens 约束错误≥1024自动将 budget 设为 32000 并重试',
apikeySignature: 'API Key 签名整流',
apikeySignatureHint:
'当 API Key 账号的上游返回签名相关错误时,自动去除签名并重试(内置规则始终生效)',
apikeyPatterns: '自定义匹配关键词',
apikeyPatternsHint:
'额外的关键词,匹配响应体中的内容(不区分大小写)。内置规则始终生效,此处用于补充额外匹配。',
apikeyPatternPlaceholder: '例如thinking_error 或 签名无效',
addPattern: '添加关键词',
saved: '整流器设置保存成功',
saveFailed: '保存整流器设置失败'
},