Skip to content

feat(reasoning): default expand thinking bubble and update docs#311

Open
gene9831 wants to merge 6 commits intoopentiny:developfrom
gene9831:feat/reasoning-bubble-expand-by-default
Open

feat(reasoning): default expand thinking bubble and update docs#311
gene9831 wants to merge 6 commits intoopentiny:developfrom
gene9831:feat/reasoning-bubble-expand-by-default

Conversation

@gene9831
Copy link
Collaborator

@gene9831 gene9831 commented Mar 5, 2026

Summary by CodeRabbit

  • New Features

    • Reasoning bubble now expands by default; thinking state auto-expands during generation and collapses on completion.
  • Documentation

    • Added advisory: BubbleList requires wrapping with the Bubble provider.
    • Updated BubbleList docs and props table for clearer prop/renderer behavior and ordering.
    • Added CSS variables for reasoning-bubble side border width and color.
    • Expanded plugin docs with new fallback/length options, richer callback context, MCP integration examples, and simplified tool usage.
    • Renamed TrBubbleItem to TrBubble across docs.
  • Public API

    • Tool configuration types relaxed and extended (some fields now optional; input schema support added).

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Docs updated for BubbleList rendering, prop vs provider renderer behavior, new CSS variables for reasoning bubble side border; Reasoning renderer now defaults to open; thinkingPlugin syncs state.thinking and state.open; toolPlugin docs revised (public options/signatures simplified, richer callback context, MCP examples); TrBubbleItem renamed to TrBubble; Tool typing relaxed.

Changes

Cohort / File(s) Summary
Documentation — bubble & quick-start
docs/src/components/bubble.md, docs/src/guide/quick-start.md
Added advisory that BubbleList uses a custom renderer and must be wrapped with BubbleProvider; clarified prop-level vs provider-level renderer matching; added CSS variables --tr-bubble-reasoning-side-border-width and --tr-bubble-reasoning-side-border-color; replaced TrBubbleItem references with TrBubble; reorganized BubbleList props table and defaults.
Documentation — tools & message plugins
docs/src/tools/message.md
Major restructure: documented new fallbackRole and continueContent options; thinkingPlugin behavior clarified (auto expand/collapse); toolPlugin public API/docs simplified (many prior callback options removed from public signature), expanded callback context (primaryMessage, toolMessage, status, error), simplified callTool usage, added MCP integration examples and basic usage samples.
Bubble Renderer
packages/components/src/bubble/renderers/Reasoning.vue
Default open now true (init and prop fallback); side border width/color switched to CSS variable fallbacks (--tr-bubble-reasoning-side-border-width, --tr-bubble-reasoning-side-border-color) replacing hardcoded values.
Thinking Plugin
packages/kit/src/vue/message/plugins/thinkingPlugin.ts
When streaming completion updates, set both state.thinking and state.open to thinking; initialize message state with both flags; clear both on turn end when applicable.
Types
packages/kit/src/vue/message/types.ts
Relaxed Tool.function typing: description?: string, parameters?: any; added optional inputSchema?: any.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇
I nudged the reasoning bubble wide and bright,
Borders softened, thinking blooms take flight,
Docs reshuffled, tools call with simpler tune,
TrBubbles hop beneath the moon,
A curious rabbit applauds the light.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: defaulting thinking bubble expansion and updating documentation, which aligns with the primary code modifications in Reasoning.vue and extensive doc updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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 and usage tips.

Tip

You can get early access to new features in CodeRabbit.

Enable the early_access setting to enable early access features such as new models, tools, and more.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

✅ Preview build completed successfully!

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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@packages/kit/src/vue/message/plugins/thinkingPlugin.ts`:
- Around line 23-25: The code clears flags by setting lastMessage.state.thinking
and lastMessage.state.open to undefined, which triggers Reasoning.vue's
open-by-default fallback; change those assignments in thinkingPlugin (the block
that checks lastMessage?.state?.thinking) to explicitly set
lastMessage.state.thinking = false and lastMessage.state.open = false so the
panel stays closed at turn end instead of re-opening.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 396b5e6a-22da-4e1c-bf9c-609bff8a64a2

📥 Commits

Reviewing files that changed from the base of the PR and between e7d8310 and 31eec74.

📒 Files selected for processing (4)
  • docs/src/components/bubble.md
  • docs/src/tools/message.md
  • packages/components/src/bubble/renderers/Reasoning.vue
  • packages/kit/src/vue/message/plugins/thinkingPlugin.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
docs/src/tools/message.md (1)

406-408: Add defensive handling for arguments parsing to match the basic example.

The basic example (line 322) uses toolCall.function?.arguments || '{}' with optional chaining and a fallback, but this MCP example directly accesses toolCall.function.arguments without guards. If arguments is undefined or malformed, JSON.parse() will throw.

🔧 Suggested fix for consistency
       callTool: async (toolCall) => {
-        return await callTool(toolCall.function.name, JSON.parse(toolCall.function.arguments))
+        return await callTool(toolCall.function.name, JSON.parse(toolCall.function?.arguments || '{}'))
       },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/src/tools/message.md` around lines 406 - 408, The callTool handler
currently calls callTool(toolCall.function.name,
JSON.parse(toolCall.function.arguments)) with no guards; update the callSite in
the callTool async function to safely access toolCall.function?.arguments with a
fallback (e.g. '{}' or '') and wrap JSON.parse in a try/catch (or use a
safe-parse helper) so malformed or missing arguments don't throw; ensure you
still pass the parsed object to callTool and log or handle parse errors
appropriately.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@docs/src/tools/message.md`:
- Around line 406-408: The callTool handler currently calls
callTool(toolCall.function.name, JSON.parse(toolCall.function.arguments)) with
no guards; update the callSite in the callTool async function to safely access
toolCall.function?.arguments with a fallback (e.g. '{}' or '') and wrap
JSON.parse in a try/catch (or use a safe-parse helper) so malformed or missing
arguments don't throw; ensure you still pass the parsed object to callTool and
log or handle parse errors appropriately.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b88e8425-a2c4-49fe-b357-a6831b6a6daf

📥 Commits

Reviewing files that changed from the base of the PR and between e211613 and 16bba0d.

📒 Files selected for processing (2)
  • docs/src/tools/message.md
  • packages/kit/src/vue/message/types.ts

…rer usage and clarify fallback renderer configuration
@gene9831 gene9831 changed the title feat(reasoning): default expand thinking bubble and add more css variables feat(reasoning): default expand thinking bubble and update docs Mar 13, 2026
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/src/tools/message.md (1)

321-324: Consider showing context in callTool example for consistency.

The API table documents callTool(toolCall, context), but the example only shows one parameter. Even if unused, including _context would reduce confusion.

✏️ Suggested doc tweak
-      callTool: async (toolCall) => {
+      callTool: async (toolCall, _context) => {
         const args = JSON.parse(toolCall.function?.arguments || '{}')
         return `Weather of ${args.city}: Sunny.`
       },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/src/tools/message.md` around lines 321 - 324, The example for callTool
should include the second parameter to match the API: update the async function
signature from callTool: async (toolCall) => { ... } to include the context
param (use a named unused param like _context) so it reads callTool: async
(toolCall, _context) => { ... }; keep the body unchanged but accept the _context
parameter to remove confusion and align with the documented callTool(toolCall,
context) API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/src/tools/message.md`:
- Around line 349-352: The docs example is exposing a client-side secret via
import.meta.env.VITE_MCP_API_KEY in the headers object; replace this with a
server-side pattern: remove direct use of import.meta.env.VITE_MCP_API_KEY and
instead show calling a server proxy endpoint (e.g., POST /api/proxy-mcp that
injects the Bearer token) or a short-lived token flow (e.g., fetch a one-time
token from /api/token then set Authorization: `Bearer <token>`), and update the
example to use a placeholder like Authorization: 'Bearer
<SERVER_PROVIDED_TOKEN>' and a brief note recommending server-side storage of
the key.

---

Nitpick comments:
In `@docs/src/tools/message.md`:
- Around line 321-324: The example for callTool should include the second
parameter to match the API: update the async function signature from callTool:
async (toolCall) => { ... } to include the context param (use a named unused
param like _context) so it reads callTool: async (toolCall, _context) => { ...
}; keep the body unchanged but accept the _context parameter to remove confusion
and align with the documented callTool(toolCall, context) API.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3001f005-5313-4164-a7cf-1e2c8f3861cb

📥 Commits

Reviewing files that changed from the base of the PR and between 16bba0d and 719dd5a.

📒 Files selected for processing (2)
  • docs/src/components/bubble.md
  • docs/src/tools/message.md

Comment on lines +349 to +352
url: 'https://dashscope.aliyuncs.com/api/v1/mcps/amap-maps/sse',
headers: {
Authorization: `Bearer ${import.meta.env.VITE_MCP_API_KEY}`,
},
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Avoid documenting browser-side Bearer API keys directly.

This example places a credential in client-side headers (import.meta.env.VITE_MCP_API_KEY), which is exposed to end users and risks key leakage. Recommend documenting a server-side proxy or short-lived token flow instead.

🔐 Safer documentation direction
-  headers: {
-    Authorization: `Bearer ${import.meta.env.VITE_MCP_API_KEY}`,
-  },
+  // 建议:不要在前端直接放置长期 API Key。
+  // 通过后端代理注入 Authorization,或使用短时令牌方案。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/src/tools/message.md` around lines 349 - 352, The docs example is
exposing a client-side secret via import.meta.env.VITE_MCP_API_KEY in the
headers object; replace this with a server-side pattern: remove direct use of
import.meta.env.VITE_MCP_API_KEY and instead show calling a server proxy
endpoint (e.g., POST /api/proxy-mcp that injects the Bearer token) or a
short-lived token flow (e.g., fetch a one-time token from /api/token then set
Authorization: `Bearer <token>`), and update the example to use a placeholder
like Authorization: 'Bearer <SERVER_PROVIDED_TOKEN>' and a brief note
recommending server-side storage of the key.

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.

1 participant