-
Notifications
You must be signed in to change notification settings - Fork 309
fix(robot): add the role message markdown and upgrade the tiny-robot version #3471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis update modifies dependency versions in the package configuration, adjusts route matching logic for displaying a chat container, adds a content type property for the assistant role, and enhances SSE stream handling to support a new "workflow_started" event with a corresponding message. Changes
Sequence Diagram(s)sequenceDiagram
participant SSE Server
participant handleSSEStream
participant Handler (onData)
SSE Server->>handleSSEStream: Send SSE event ("workflow_started")
handleSSEStream->>Handler (onData): Call with message {role: assistant, content: "**Workflow started** \r\n", ...}
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
examples/sites/src/views/components-doc/composition/utils.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/src/views/components-doc/composition/useTinyRobot.tsOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. examples/sites/src/views/components-doc/common.vueOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the plugin "eslint-plugin-vue". (The package "eslint-plugin-vue" was not found when loaded as a Node module from the directory "".) It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
The plugin "eslint-plugin-vue" was referenced from the config file in ".eslintrc.js » @antfu/eslint-config » @antfu/eslint-config-vue". If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
examples/sites/src/views/components-doc/composition/utils.ts (1)
67-84
: Good implementation! Consider standardizing line endings.The implementation of
workflow_started
event handling follows the established pattern well and correctly integrates with the existing message flow.Consider using consistent line endings:
- content: '**Workflow started** \r\n' + content: '**Workflow started**\n'The
\r\n
(CRLF) line ending might be inconsistent with other parts of the codebase that likely use\n
(LF). This ensures consistent line ending handling across different platforms.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
examples/sites/package.json
(1 hunks)examples/sites/src/views/components-doc/common.vue
(1 hunks)examples/sites/src/views/components-doc/composition/useTinyRobot.ts
(1 hunks)examples/sites/src/views/components-doc/composition/utils.ts
(1 hunks)
🔇 Additional comments (3)
examples/sites/package.json (1)
32-34
:✅ Verification successful
Verify the updated package versions are valid and secure.
The three robot-related packages have been consistently updated to version
0.2.0-alpha.8
. Since these are alpha versions, please ensure these versions exist on the registry and are free from known vulnerabilities.
🏁 Script executed:
#!/bin/bash # Description: Verify the updated package versions exist and check for security advisories echo "Checking package versions on npm registry..." # Check if the versions exist for package in "@opentiny/tiny-robot" "@opentiny/tiny-robot-kit" "@opentiny/tiny-robot-svgs"; do echo "Checking $package@0.2.0-alpha.8..." npm view "$package@0.2.0-alpha.8" version 2>/dev/null || echo "Version 0.2.0-alpha.8 not found for $package" done # Check for security advisories using GitHub CLI echo "Checking for security advisories..." for package in "tiny-robot" "tiny-robot-kit" "tiny-robot-svgs"; do gh api graphql -f query=" { securityVulnerabilities(first: 5, ecosystem: NPM, package: \"@opentiny/$package\") { nodes { advisory { summary severity publishedAt } vulnerableVersionRange firstPatchedVersion { identifier } } } }" 2>/dev/null || echo "Could not check advisories for @opentiny/$package" doneLength of output: 2358
Package versions validated and secure
- The updates in examples/sites/package.json (lines 32–34) to
@opentiny/tiny-robot
,@opentiny/tiny-robot-kit
, and@opentiny/tiny-robot-svgs
@ 0.2.0-alpha.8 are confirmed to exist on npm.- No known security advisories were found for these packages in the GitHub Advisory Database.
examples/sites/src/views/components-doc/composition/useTinyRobot.ts (1)
155-155
: LGTM! Content type specification enhances message rendering.Adding the
type: 'markdown'
property to the assistant role configuration is a good practice that explicitly defines how assistant messages should be rendered, enabling proper markdown formatting support.examples/sites/src/views/components-doc/common.vue (1)
451-451
:✅ Verification successful
Consider more precise route matching to avoid unintended behavior.
The change from exact hash matching (
=== '#grid-ai-agent'
) to substring matching (includes('grid-ai-agent')
) on the full path makes the robot chat more flexible but could potentially cause it to appear on unintended routes.Consider using a more precise matching approach:
- const hasRobot = router.currentRoute.value.fullPath.includes('grid-ai-agent') + const hasRobot = router.currentRoute.value.fullPath.includes('grid-ai-agent') || + router.currentRoute.value.hash === '#grid-ai-agent'Or if you specifically want path-based matching, consider using a regex for more control:
- const hasRobot = router.currentRoute.value.fullPath.includes('grid-ai-agent') + const hasRobot = /\/grid-ai-agent(?:\/|$|\?)/.test(router.currentRoute.value.fullPath)
🏁 Script executed:
#!/bin/bash # Description: Check for existing routes that might match the new pattern echo "Searching for route definitions that might contain 'grid-ai-agent'..." rg -A 3 -B 3 "grid-ai-agent" --type js --type ts --type vueLength of output: 242
🏁 Script executed:
#!/bin/bash echo "Searching for references to 'grid-ai-agent' in .js, .ts, and .vue files..." rg -A3 -B3 "grid-ai-agent" -g "*.{js,ts,vue}"Length of output: 2514
Route matching validation: no unintended “grid-ai-agent” occurrences found
We searched across all
.js
,.ts
, and.vue
files for the substringgrid-ai-agent
and found references only in the intended demo context:
examples/sites/src/views/components-doc/common.vue
(thehasRobot
check)examples/sites/demos/pc/menus.js
(menu key for the AI agent demo)examples/sites/demos/pc/app/grid/webdoc/grid-ai-agent.js
(demo definition)No other route paths, query parameters, or hash fragments include this segment. Substring matching on
fullPath
will therefore only trigger in the intended demo page.If you anticipate future dynamic routes or query parameters that might inadvertently include
grid-ai-agent
, you can refine the check (for example, using a regex or combining it with a hash check). Otherwise, this change is safe as-is.
PR
fix(robot): 增加角色消息为markdown, 升级tiny-robot 的版本
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information
Summary by CodeRabbit
New Features
Chores