HEL-850: 仅对翻译和润色关闭模型思考 (reasoning_effort none) #19

Merged
leefer merged 1 commits from agent/2/9c4d105d16eb into leefer/hel-731-studio-project 2026-10-25 22:04:29 +08:00
Owner

基线 leefer/hel-731-studio-project@410eade(PR #16 已合并,另开本 PR)。

改动(最小,仅 2 文件)

  • calliope-backend/src/calliope/routers/prompt_tools.py:新增 NO_THINKING_BODY = {"reasoning_effort": "none"};_run 透传 extra_body 到 client.chat;translate/polish 的初次请求与校验失败后的唯一纠正请求均携带(两轮共用同一调用点)。流式与阻塞回退经 LLMClient 既有 extra_body 通路(chat_stream / _chat_blocking 的 _merge_extra_body)自动保留。
  • calliope-backend/tests/test_prompt_tools.py:+4 回归(两动作初次+纠正均带开关、阻塞回退保留开关、普通 LLMClient 调用不受影响)。

开关选用依据(实际服务证据,非按模型名猜测)

  • 引擎:LM Studio(192.168.200.234:1234,原生 /api/v0、/api/v1 均 200,0.4.0+)。
  • 只读 GET /api/v1/models:qwen3.5-4b-uncensored-hauhaucs-aggressive 声明 reasoning.allowed_options=["off","on"], default="on" —— 思考默认开启。
  • 实服务探测(max_tokens=96,能力验证非测速):chat_template_kwargs.enable_thinking=false 被静默忽略(仍 96 reasoning tokens、无正文);reasoning="off" 顶层同样被忽略;reasoning_effort:"none" 流式与阻塞均 0 reasoning tokens、直接出正文。故采用后者,不采用伪成功的 chat_template_kwargs。

保留不变

温度(0.2/0.6)、取消/总超时/块超时、语法映射与还原、一次纠正后 502、预览/替换/撤销、用户所选档案、LLMClient 默认策略与智能体/工作流调用、h3_rewrite 通路。

测试与构建

  • pytest tests/test_prompt_tools.py → 64 passed(含 4 新增)。
  • 相关套件 68 passed;全量 918 passed / 5 failed / 6 skipped,5 个失败在未改动基线上同样失败(stash 验证,存量问题:comfy_mcp/continuity/h3_profile/scene_settings/script_scene_count)。
  • ruff check(0.16.8)本卡两文件通过;其余文件 393 条存量 lint 未触碰。
  • uv/hatchling 构建通过;前端无 diff,未跑全站图阵。
基线 `leefer/hel-731-studio-project@410eade`(PR #16 已合并,另开本 PR)。 ## 改动(最小,仅 2 文件) - `calliope-backend/src/calliope/routers/prompt_tools.py`:新增 `NO_THINKING_BODY = {"reasoning_effort": "none"}`;`_run` 透传 `extra_body` 到 `client.chat`;translate/polish 的初次请求与校验失败后的唯一纠正请求均携带(两轮共用同一调用点)。流式与阻塞回退经 LLMClient 既有 `extra_body` 通路(chat_stream / _chat_blocking 的 `_merge_extra_body`)自动保留。 - `calliope-backend/tests/test_prompt_tools.py`:+4 回归(两动作初次+纠正均带开关、阻塞回退保留开关、普通 LLMClient 调用不受影响)。 ## 开关选用依据(实际服务证据,非按模型名猜测) - 引擎:LM Studio(192.168.200.234:1234,原生 /api/v0、/api/v1 均 200,0.4.0+)。 - 只读 GET /api/v1/models:`qwen3.5-4b-uncensored-hauhaucs-aggressive` 声明 `reasoning.allowed_options=["off","on"], default="on"` —— 思考默认开启。 - 实服务探测(max_tokens=96,能力验证非测速):`chat_template_kwargs.enable_thinking=false` 被静默忽略(仍 96 reasoning tokens、无正文);`reasoning="off"` 顶层同样被忽略;**`reasoning_effort:"none"` 流式与阻塞均 0 reasoning tokens、直接出正文**。故采用后者,不采用伪成功的 chat_template_kwargs。 ## 保留不变 温度(0.2/0.6)、取消/总超时/块超时、语法映射与还原、一次纠正后 502、预览/替换/撤销、用户所选档案、LLMClient 默认策略与智能体/工作流调用、h3_rewrite 通路。 ## 测试与构建 - `pytest tests/test_prompt_tools.py` → 64 passed(含 4 新增)。 - 相关套件 68 passed;全量 918 passed / 5 failed / 6 skipped,5 个失败在未改动基线上同样失败(stash 验证,存量问题:comfy_mcp/continuity/h3_profile/scene_settings/script_scene_count)。 - `ruff check`(0.16.8)本卡两文件通过;其余文件 393 条存量 lint 未触碰。 - uv/hatchling 构建通过;前端无 diff,未跑全站图阵。
leefer added 1 commit 2026-10-25 20:47:36 +08:00
LM Studio's OpenAI-compat endpoint silently ignores chat_template_kwargs
(probed live); reasoning_effort "none" verifiably removes reasoning tokens
on both streaming and blocking paths. Pass it through the existing
LLMClient extra_body channel for translate/polish first and correction
requests only; all other callers keep their default policy.

Co-authored-by: multica-agent <github@multica.ai>
leefer merged commit 344fede198 into leefer/hel-731-studio-project 2026-10-25 22:04:29 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: leefer/aigc-home#19