From ce3fd8d84714e16c369acbfc60e86a45e4e6c890 Mon Sep 17 00:00:00 2001 From: bigsong <35025755+bigsongeth@users.noreply.github.com> Date: Sat, 18 Jul 2026 15:43:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(llm):=20=E6=96=B0=E5=A2=9E=20StepFun=20?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E9=A2=84=E8=AE=BE=EF=BC=9B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20Codex=20OAuth=20=E9=BB=98=E8=AE=A4=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E4=B8=8D=E5=8F=AF=E7=94=A8=20(#836)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit StepFun 预设: - 供应商下拉新增 StepFun(阶跃星辰),预填 https://api.stepfun.com/v1, 默认模型 step-1o-turbo-vision(无思考,流式首字 ~0.3s;step-3.x-flash 系列为推理模型且思考无法关闭,正式内容需等隐藏思考结束,不适合听写润色) - thinking 控制表新增 stepfun → reasoning_effort(开=medium / 关=low), base_url 兜底识别同步支持"自定义"preset 接入 StepFun 的场景 - 补默认 endpoint 映射与两个单元测试 Codex OAuth 默认模型: - gpt-5.3-codex-spark 对 ChatGPT 账号会被后端 400 拒绝 ("model is not supported when using Codex with a ChatGPT account"), 导致每次润色静默失败回退原文;默认与占位改为实测可用的 gpt-5.5 Co-authored-by: Claude Fable 5 --- .../app/src-tauri/src/commands/credentials.rs | 1 + openless-all/app/src-tauri/src/polish.rs | 53 ++++++++++++++++++- openless-all/app/src/i18n/en.ts | 1 + openless-all/app/src/i18n/ja.ts | 1 + openless-all/app/src/i18n/ko.ts | 1 + openless-all/app/src/i18n/zh-CN.ts | 1 + openless-all/app/src/i18n/zh-TW.ts | 1 + .../src/pages/settings/ProvidersSection.tsx | 17 +++++- 8 files changed, 73 insertions(+), 3 deletions(-) diff --git a/openless-all/app/src-tauri/src/commands/credentials.rs b/openless-all/app/src-tauri/src/commands/credentials.rs index 305b0c91..7ed34ba1 100644 --- a/openless-all/app/src-tauri/src/commands/credentials.rs +++ b/openless-all/app/src-tauri/src/commands/credentials.rs @@ -92,6 +92,7 @@ fn llm_provider_default_endpoint(provider: &str) -> Option<&'static str> { "openrouterFree" => Some("https://openrouter.ai/api/v1"), "alibabaCoding" => Some("https://coding-intl.dashscope.aliyuncs.com/v1"), "codingPlanX" => Some("https://api.codingplanx.ai/v1"), + "stepfun" => Some("https://api.stepfun.com/v1"), _ => None, } } diff --git a/openless-all/app/src-tauri/src/polish.rs b/openless-all/app/src-tauri/src/polish.rs index 21c40d20..1ff47baf 100644 --- a/openless-all/app/src-tauri/src/polish.rs +++ b/openless-all/app/src-tauri/src/polish.rs @@ -25,7 +25,10 @@ const DEFAULT_REQUEST_TIMEOUT_SECS: u64 = 30; const BODY_PREVIEW_LIMIT: usize = 200; pub const CODEX_OAUTH_PROVIDER_ID: &str = "codex_oauth"; pub const CODEX_DEFAULT_BASE_URL: &str = "https://chatgpt.com/backend-api"; -pub const CODEX_DEFAULT_MODEL: &str = "gpt-5.3-codex-spark"; +// 注意:gpt-5.3-codex-spark 不能做默认——ChatGPT 账号走 Codex OAuth 时后端会 +// 400 拒绝("model is not supported when using Codex with a ChatGPT account"), +// 每次润色都失败并回退原文。gpt-5.5 是该通道实测可用的模型。 +pub const CODEX_DEFAULT_MODEL: &str = "gpt-5.5"; const CODEX_MIN_TOKEN_TTL_SECS: u64 = 60; #[derive(Clone, Debug)] @@ -1607,7 +1610,9 @@ fn openai_compatible_thinking_control(provider_id: &str) -> Option Some(ThinkingControl::MiniMaxThinking), "openrouterFree" => Some(ThinkingControl::OpenRouterReasoning), "alibabaCoding" => Some(ThinkingControl::EnableThinking), - "openai" | "codingPlanX" => Some(ThinkingControl::ReasoningEffort), + // StepFun step-3.x-flash 系列按官方文档接受 reasoning_effort(low/medium/high, + // 无法完全关闭思考);非推理模型(如 step-1o-turbo-vision)会忽略该字段。 + "openai" | "codingPlanX" | "stepfun" => Some(ThinkingControl::ReasoningEffort), // custom / 其他未声明 provider 走 base_url 兜底识别——用户用自定义 // endpoint 接入 MiniMax 时,根据 base_url 命中即下发官方 thinking 参数。 _ => None, @@ -1643,6 +1648,9 @@ fn openai_compatible_thinking_control_for_base_url(base_url: &str) -> Option