mirror of
https://github.com/volcengine/OpenViking.git
synced 2026-09-29 04:02:57 +08:00
* feat(docs): load VikingBot from the shared embed widget
The docs assistant was a copy of the playground chat panel: its own
transport, markdown renderer and ~700 lines of panel CSS, all talking to
a hardcoded gateway. Replace it with a thin loader so the shared embed
widget owns the conversation UI.
- VikingBotAssistant.vue keeps only the navbar trigger; the first click
lazy-loads the widget script and mounts it with the docs locale, later
clicks toggle the panel.
- Widget URL defaults to the stable alias and can be overridden with
VITE_VIKINGBOT_WIDGET_URL for local development.
- A failed script load surfaces a small hint next to the button and
leaves the docs untouched; the next click retries.
- Drop vikingbot-api.ts, vikingbot-markdown.ts and their tests, the
panel styles, and the markdown-it/xss dependencies they needed.
* fix(docs): let the trigger button own the widget click
mount({trigger: el}) makes the widget bind its own click->toggle on that
element. Passing the navbar button while this component also toggles on
@click meant every click after the first toggled twice: the panel stayed
put while aria-expanded flipped, so the button announced the wrong state.
Mount with trigger: 'none' instead — the widget then neither renders its
floating launcher nor binds a listener, leaving this component the single
owner of the click while open/close events keep aria-expanded honest.
* fix(docs): stop double-writing the trigger's expanded state
toggle() emits open/close synchronously, so onWidgetEvent has already
updated isOpen by the time the click handler returns. The extra manual
flip inverted it: after the second click the panel was closed while the
button still reported aria-expanded=true. The post-mount assignment was
redundant for the same reason (mount({open:true}) emits 'open').
Widget events are now the single writer of isOpen.
18 lines
562 B
JSON
18 lines
562 B
JSON
{
|
|
"name": "openviking-docs",
|
|
"version": "0.0.0",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"docs:dev": "vitepress dev . --host 0.0.0.0",
|
|
"docs:build": "vitepress build .",
|
|
"docs:preview": "vitepress preview . --host 0.0.0.0",
|
|
"check:api": "node scripts/check-api-reference.mjs",
|
|
"test:theme": "node --experimental-strip-types --test .vitepress/theme/*.test.ts",
|
|
"test:search": "node --experimental-strip-types --test .vitepress/theme/openviking-search-*.test.ts"
|
|
},
|
|
"devDependencies": {
|
|
"vitepress": "1.6.4"
|
|
}
|
|
}
|