Skip to content

fix(thinkingPlugin): update thinking condition to use length check - #384

Merged
SonyLeo merged 1 commit into
opentiny:developfrom
gene9831:fix/thinkingPlugin-use-length-check
Aug 7, 2026
Merged

fix(thinkingPlugin): update thinking condition to use length check#384
SonyLeo merged 1 commit into
opentiny:developfrom
gene9831:fix/thinkingPlugin-use-length-check

Conversation

@gene9831

@gene9831 gene9831 commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

问题:在某些场景出现 "正在思考->已思考->正在思考" 状态频繁转换

reasoning_content 在传输过程中可能是长度大于0的空白字符串

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of thinking content so whitespace-only text is handled consistently.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The thinking plugin now marks any non-empty reasoning_content string as thinking content. Whitespace-only strings now qualify.

Changes

Thinking Content Detection

Layer / File(s) Summary
Reasoning content condition
packages/kit/src/message/plugins/thinkingPlugin.ts
The plugin no longer trims reasoning_content before checking whether the string is non-empty.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

A rabbit checks the thought-stream bright,
Even spaces count when strings have length in sight.
The plugin hops, the test is clear,
Whitespace reasoning now appears.
Tiny change, neatly done—
The thinking flag has won!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the change to use a length check for thinking content in thinkingPlugin.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/kit/src/message/plugins/thinkingPlugin.ts`:
- Line 16: Align the predicate used by thinkingPlugin and defaultRenderers so
whitespace-only reasoning_content is treated consistently. Update the thinking
state check around reasoning_content to use the same trimmed-content semantics
as the Reasoning.vue renderer, or reuse a shared predicate if one exists, while
preserving behavior for non-empty reasoning content.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c4609f7f-8de8-4ae8-b284-61683ba0ff5a

📥 Commits

Reviewing files that changed from the base of the PR and between ca51f9d and fb7dac8.

📒 Files selected for processing (1)
  • packages/kit/src/message/plugins/thinkingPlugin.ts

Comment thread packages/kit/src/message/plugins/thinkingPlugin.ts
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

✅ Preview build completed successfully!

Click the image above to preview.
Preview will be automatically removed when this PR is closed.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@SonyLeo
SonyLeo merged commit a68761e into opentiny:develop Aug 7, 2026
4 checks passed
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🧹 Preview Cleaned Up

The preview deployment has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants