fix: 不再把 reasoning_content 拼接到模型输出前面 - #64
Open
li-xiu-qi wants to merge 1 commit into
Open
Conversation
When using cloud reasoning models (e.g. step-3.7-flash) via Chat Completions
API, ask_llm_v2.py was wrapping reasoning_content as a <think> block and
prepending it to the model's content output. But the model's content already
contains <THINK> tags (required by the parser prompt), so this created two
layers of THINK tags:
<think>reasoning_content from API field</think>
<THINK>model's own THINK from prompt</THINK>
explain:... action:CLICK point:500,300 summary:...
The parser's str2action() uses split('</THINK>')[1] to extract key-value
pairs, which grabbed the second THINK block text instead of the actual
action parameters, causing:
ValueError: ui_action must contain 'action' or 'action_type'
Fix: log reasoning_content for debugging but return model's content as-is.
The content already follows the expected format:
<THINK>...</THINK>\texplain:...\taction:...\tsummary:...
Verified with step-3.7-flash controlling Android device:
- Task: open WeChat and find specific group chat
- Result: 5 steps, completed successfully (was failing at step 1 before fix)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Fixes #62
用 Chat Completions 接口跑云端推理模型(比如
step-3.7-flash)时,parser 在第一步就挂了:根因
ask_llm_v2.py检测到 API 响应里的reasoning_content,就把它包成一个<think>块拼到模型content前面:但模型的
content本身已经带了<THINK>标签(parser 提示词要求的),这样就叠成了两层:parser 的
str2action()用split("</THINK>")[1]取键值段,取到的是第一个</THINK>之后的内容,也就是第二层 THINK 的正文,而不是动作参数。三接口对比
reasoning_content字段,被ask_llm_v2.py拼接thinking类型块reasoning类型 output item模型的
content永远只有一层<THINK>。问题完全出在ask_llm_v2.py的处理上。修复
不再把
reasoning_content拼到结果前面。保留它做调试日志,直接返回content本身。content已经符合<THINK>...</THINK>\texplain:...\taction:...\tsummary:...的格式。只改了
tools/ask_llm_v2.py一个文件(19 增 26 删)。验证
用
step-3.7-flash控制真机(iQOO Z9 Turbo+)测过:两个任务在修复前都会在第一步 parser 报错,修复后都跑通了。