Skip to content

docs(demos): add AssistantPageExample demo#318

Merged
hexqi merged 1 commit intoopentiny:developfrom
gene9831:docs/assistant-container-page-examples
Mar 30, 2026
Merged

docs(demos): add AssistantPageExample demo#318
hexqi merged 1 commit intoopentiny:developfrom
gene9831:docs/assistant-container-page-examples

Conversation

@gene9831
Copy link
Copy Markdown
Collaborator

@gene9831 gene9831 commented Mar 30, 2026

Summary by CodeRabbit

Documentation

  • Added a comprehensive chat assistant example demonstrating a full-page layout with conversation history, message bubbles, and interactive suggestions
  • Updated documentation with examples for two integration approaches: embedded page and floating container patterns

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Walkthrough

The PR introduces a new chat assistant demo page component with conversation management, message handling, file drag-and-drop support, and MCP tool integration. An existing container demo's default visibility state is toggled, and documentation is updated to separately reference the two example implementations.

Changes

Cohort / File(s) Summary
Vue Demo Components
docs/demos/examples/AssistantContainerExample.vue, docs/demos/examples/AssistantPageExample.vue
Added new full-featured chat assistant demo page with responsive layout, conversation history, message bubbles, message sender with suggestions, file drag-and-drop, and MCP tool execution integration. Modified sibling container example to initialize show state as false instead of true.
Documentation
docs/src/examples/assistant.md
Replaced single demo invocation with two new subsections: "直接嵌入页面" (embedded example) and "使用悬浮容器" (floating container example), each referencing corresponding Vue example components and shared utilities.

Sequence Diagram

sequenceDiagram
    actor User
    participant Page as AssistantPage
    participant Conv as useConversation
    participant Engine as Conversation<br/>Engine
    participant Tool as toolPlugin<br/>(MCP)
    participant UI as Bubble List<br/>UI

    User->>Page: Send message
    activate Page
    Page->>Conv: sendMessage()
    activate Conv
    Conv->>Engine: Process message
    activate Engine
    Engine->>Tool: Execute tool call
    activate Tool
    Tool-->>Engine: Tool result
    deactivate Tool
    Engine-->>Conv: Response ready
    deactivate Engine
    Conv-->>Page: Update state
    deactivate Conv
    Page->>UI: Render response bubble
    deactivate Page
    UI-->>User: Display result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A new assistant hops into view,
With bubbles, history, and conversations too!
Drag-and-drop files with graceful flair,
MCP tools at work in the digital air! 🎭✨

🚥 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 addition of the AssistantPageExample demo component, which is the primary change reflected in the file additions and documentation 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

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.

Copy link
Copy Markdown

@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/demos/examples/AssistantPageExample.vue (1)

348-348: Unused suggestionOpen ref.

The suggestionOpen ref is declared and written to in the watcher, but it's never read to control any UI element. Consider removing it if not needed.

🧹 Proposed cleanup
 const senderRef = ref<InstanceType<typeof TrSender> | null>(null)
 const inputMessage = ref('')
 const currentTemplate = ref<UserItem[]>([])
-const suggestionOpen = ref(false)

And remove the watcher at lines 406-413:

-watch(
-  () => inputMessage.value,
-  (value) => {
-    if (suggestionOpen.value && value === '') {
-      suggestionOpen.value = false
-    }
-  },
-)

Also applies to: 406-413

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/demos/examples/AssistantPageExample.vue` at line 348, Remove the unused
suggestionOpen ref and its associated watcher: delete the const suggestionOpen =
ref(false) declaration and remove the watcher that only writes to suggestionOpen
(the watcher callback that toggles suggestionOpen based on
suggestions/commands). If the UI should respond instead, replace the watcher
logic to update the actual reactive/UI state used elsewhere (e.g., a visible
prop or computed) otherwise simply delete both the declaration and the watcher
to clean up dead code.
🤖 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/demos/examples/AssistantPageExample.vue`:
- Line 348: Remove the unused suggestionOpen ref and its associated watcher:
delete the const suggestionOpen = ref(false) declaration and remove the watcher
that only writes to suggestionOpen (the watcher callback that toggles
suggestionOpen based on suggestions/commands). If the UI should respond instead,
replace the watcher logic to update the actual reactive/UI state used elsewhere
(e.g., a visible prop or computed) otherwise simply delete both the declaration
and the watcher to clean up dead code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2b642066-bbeb-4071-8250-9e6eb9023123

📥 Commits

Reviewing files that changed from the base of the PR and between b826e97 and de82d20.

📒 Files selected for processing (3)
  • docs/demos/examples/AssistantContainerExample.vue
  • docs/demos/examples/AssistantPageExample.vue
  • docs/src/examples/assistant.md

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 30, 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
Copy Markdown
Contributor

@hexqi hexqi merged commit 0b6ba74 into opentiny:develop Mar 30, 2026
6 of 7 checks passed
@github-actions
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