feat(pipeline): add keep-first-think-only toggle for multi-round CoT#2331
Open
MIKAZE3 wants to merge 3 commits into
Open
feat(pipeline): add keep-first-think-only toggle for multi-round CoT#2331MIKAZE3 wants to merge 3 commits into
MIKAZE3 wants to merge 3 commits into
Conversation
…tible models MiniMax-M3 (and other OpenAI-compatible providers) emit chain-of-thought reasoning directly in the content field wrapped in tags, instead of using a separate reasoning_content field or the legacy CRETIRE_REASONING markers. The existing remove_think logic only handled CRETIRE_* tags, so think blocks leaked into user-visible output even when remove_think was enabled. - Add _ThinkStripState: a stateful filter that correctly handles tags split across streaming chunk boundaries. - Add _strip_think classmethod with regex patterns for both and CRETIRE_* tags. - Wire think_state into invoke_llm_stream so deltas are filtered before reaching the accumulator. - Add remove_think safety net in _StreamAccumulator so the final message from tool-call rounds also gets stripped. - Fix remove_think resolution to use defensive nested .get() so pipelines missing output.misc don't raise AttributeError.
New "仅保留第一条思维链" option under output.misc, effective only when remove-think is enabled. When on, the first LLM round keeps its chain-of-thought (visible to the user) while subsequent tool-call rounds strip CoT. - output.yaml: add keep-first-think-only boolean field - default-pipeline-config.json: add default false - localagent.py: pre-loop uses _strip_think_first_round (=False when keep-first), tool-loop uses raw remove_think (=True) - ws_client.py: fallback_after_round + round counter to keep stream_id alive across rounds so the next round reuses the same stream - respback.py: stash pipeline_config on message_event for adapter access - wecombot.py: read config and set fallback_after_round=1 when enabled
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.
概述 / Overview
更改前后对比截图 / Screenshots
检查清单 / Checklist
PR 作者完成 / For PR author
请在方括号间写
x以打勾 / Please tick the box withx项目维护者完成 / For project maintainer