From 47a4555078104fc676af3019e173833ecc661b07 Mon Sep 17 00:00:00 2001 From: shenjunjian Date: Tue, 3 Jun 2025 15:08:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(robot):=20=E5=A2=9E=E5=8A=A0=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=B6=88=E6=81=AF=E4=B8=BAmarkdown,=20=E5=8D=87?= =?UTF-8?q?=E7=BA=A7robot=20=E7=9A=84=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/sites/package.json | 6 +++--- .../sites/src/views/components-doc/common.vue | 2 +- .../composition/useTinyRobot.ts | 1 + .../views/components-doc/composition/utils.ts | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/examples/sites/package.json b/examples/sites/package.json index 5c3d81f7c0..2509df82f8 100644 --- a/examples/sites/package.json +++ b/examples/sites/package.json @@ -29,9 +29,9 @@ "@docsearch/react": "npm:@docsearch/css", "@modelcontextprotocol/sdk": "1.12.1", "@opentiny/next": "0.1.2", - "@opentiny/tiny-robot": "0.2.0-alpha.7", - "@opentiny/tiny-robot-kit": "0.2.0-alpha.7", - "@opentiny/tiny-robot-svgs": "0.2.0-alpha.7", + "@opentiny/tiny-robot": "0.2.0-alpha.8", + "@opentiny/tiny-robot-kit": "0.2.0-alpha.8", + "@opentiny/tiny-robot-svgs": "0.2.0-alpha.8", "@opentiny/tiny-schema-renderer": "1.0.0-beta.5", "@opentiny/tiny-vue-mcp": "0.0.1-beta.1", "@opentiny/utils": "workspace:~", diff --git a/examples/sites/src/views/components-doc/common.vue b/examples/sites/src/views/components-doc/common.vue index 8abe5e43ef..207f41d9d1 100644 --- a/examples/sites/src/views/components-doc/common.vue +++ b/examples/sites/src/views/components-doc/common.vue @@ -448,7 +448,7 @@ defineExpose({ loadPage }) const show = ref(false) onMounted(() => { // tiny-robot 通过路由参数存在 mcp-robot, 则弹出对话容器 - const hasRobot = router.currentRoute.value.hash === '#grid-ai-agent' + const hasRobot = router.currentRoute.value.fullPath.includes('grid-ai-agent') show.value = !!hasRobot document.body.classList.toggle('docs-on-robot-show', show.value) diff --git a/examples/sites/src/views/components-doc/composition/useTinyRobot.ts b/examples/sites/src/views/components-doc/composition/useTinyRobot.ts index a7fc07368a..9cc83126d2 100644 --- a/examples/sites/src/views/components-doc/composition/useTinyRobot.ts +++ b/examples/sites/src/views/components-doc/composition/useTinyRobot.ts @@ -152,6 +152,7 @@ export function useTinyRobot() { const roles = { assistant: { + type: 'markdown', placement: 'start', avatar: aiAvatar, maxWidth: '80%' diff --git a/examples/sites/src/views/components-doc/composition/utils.ts b/examples/sites/src/views/components-doc/composition/utils.ts index 41d25669b0..879f1ad9bf 100644 --- a/examples/sites/src/views/components-doc/composition/utils.ts +++ b/examples/sites/src/views/components-doc/composition/utils.ts @@ -64,6 +64,25 @@ export async function handleSSEStream(response: Response, handler: StreamHandler if (!dataMatch) continue const data = JSON.parse(dataMatch[1]) + if (data?.event === 'workflow_started') { + handler.onData({ + id: data.workflow_run_id, + created: data.created_at, + choices: [ + { + index: messageIndex++, + delta: { + role: 'assistant', + content: '**Workflow started** \r\n' + }, + finish_reason: null + } + ], + object: '', + model: '' + }) + } + if (data?.event === 'message' && data?.answer) { handler.onData({ id: data.id,