fix: 修复 kimi-for-coding 开启思考模式无法回复的问题#7658
Closed
Blueteemo wants to merge 5 commits intoAstrBotDevs:masterfrom
Closed
fix: 修复 kimi-for-coding 开启思考模式无法回复的问题#7658Blueteemo wants to merge 5 commits intoAstrBotDevs:masterfrom
Blueteemo wants to merge 5 commits intoAstrBotDevs:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider extracting the shared
llm_resultyielding logic forcompletion_text/reasoning_contentinto a small helper to avoid duplicating the sameAgentResponseconstruction in multiple branches. - Double-check that exposing
reasoning_contentdirectly to end users is acceptable for all calling contexts, as it may contain internal chain-of-thought or debugging details that were previously intentionally not surfaced.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider extracting the shared `llm_result` yielding logic for `completion_text` / `reasoning_content` into a small helper to avoid duplicating the same `AgentResponse` construction in multiple branches.
- Double-check that exposing `reasoning_content` directly to end users is acceptable for all calling contexts, as it may contain internal chain-of-thought or debugging details that were previously intentionally not surfaced.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds support for handling reasoning content in the tool loop agent runner by yielding an AgentResponse when reasoning_content is present. The reviewer suggests explicitly setting the MessageChain type to "reasoning" in both new logic paths to maintain consistency with streaming output and facilitate better UI representation of the thinking process.
a0d72eb to
3c02c8b
Compare
faf411f to
0068960
Compare
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.
问题描述
当使用 kimi-for-coding 模型开启思考模式(adaptive/思考预算0/思考深度Low)时,用户无法收到回复,控制台显示有思考内容但无报错。
根因分析
在
tool_loop_agent_runner.py中,最终结果的 yield 逻辑只检查了result_chain和completion_text,没有处理仅有reasoning_content的情况。当模型仅返回思考内容而completion_text为空时,最终响应不会发送给用户。修复方案
在以下两处添加对
reasoning_content的分支处理:skills_likefallback (754-767行)当
completion_text为空但reasoning_content有值时,将reasoning_content作为 fallback 返回给用户。Related Issue
Fixes #7656
Summary by Sourcery
Bug Fixes: