feat: v0.8.2 安全纵深补全 · 协议保真 · 断链修复 — 图片SSRF/根MEMORY.md保护根治 · Anthropic thinking回传+pause_turn续传 · 2523 用例全量回归 + E2E 扩充
CI / 类型检查 + Lint + 单元测试 (push) Failing after 9m45s
CI / 全量测试 (Electron ABI) (push) Failing after 6m28s
CI / 产物编译验证 (push) Successful in 11m18s

This commit is contained in:
2026-09-08 14:30:27 +08:00
parent 69776e447f
commit 4cd6e997b5
86 changed files with 4303 additions and 956 deletions
+16 -4
View File
@@ -102,8 +102,12 @@ export class OpenAIAdapter extends OpenAICompatibleAdapter {
stream: boolean,
): Record<string, unknown> {
// 推理模型检测(o 系列使用新参数名)
// v0.8.2 P2-6: 正则补边界 — 旧 /^(o\d|gpt-5)/ 对命名变体存在两处漏判/误判:
// ① `chatgpt-5-*` 系列(gpt-5 非前缀)漏判;② 未来 `o10` 等多位数编号无影响
// 但 `o\d` 会把 `openai/...` 路径形态误判(当前配置层不透传路径,防御性加边界)。
// 现改为带词边界的枚举前缀匹配(o<digits> / gpt-5 / chatgpt-5)。
const model = this.config.defaultModel;
const isReasoningModel = /^(o\d|gpt-5)/.test(model);
const isReasoningModel = /^(o\d+(?:[-.][\w.]+)?|gpt-5[\w.-]*|chatgpt-5[\w.-]*)/.test(model);
// 推理模型不支持图片输入 — 前置校验
// v0.6.4 升级: 原实现抛裸 Error 落入 UNKNOWN 错误码;现在抛 ModelCapabilityError
@@ -165,10 +169,18 @@ export class OpenAIAdapter extends OpenAICompatibleAdapter {
}
// 停止序列
// 已知边界(协议限制,待上游放开后移除此注释):o 系列不支持 stop 参数,
// 当前仍透传 —— 若推理模型 + stop 组合触发 400 属上游约束而非本层缺陷。
// v0.8.2 P2-6 根治: 推理模型不支持 stop 参数 —— 旧实现"仍透传,400 属上游约束"
// 的注释性放弃改为前置拦截:推理模型请求丢弃 stop 并告警(与拒图的
// ModelCapabilityError 同思路,但 stop 是可选增强参数,静默丢弃 + 告警优于
// 让整个请求 400 失败)。
if (request.params.stopSequences?.length) {
body.stop = request.params.stopSequences;
if (isReasoningModel) {
log.warn(
`[OpenAI] stop sequences are not supported by reasoning model "${model}" — dropping ${request.params.stopSequences.length} stop sequence(s) for this request`,
);
} else {
body.stop = request.params.stopSequences;
}
}
return body;