@ai-gui/vue
@ai-gui/vue
Vue adapter for AIGUI — renders a streaming LLM response into Vue, with app-defined cards and plugins.
Install
pnpm add @ai-gui/core @ai-gui/vue
Usage
<script setup lang="ts">
import { ref } from "vue"
import { ActionRegistry, CardRegistry, CardStore, createActionRuntime } from "@ai-gui/core"
import { AIRenderer, useActionState } from "@ai-gui/vue"
const registry = new CardRegistry()
// A card render component receives props `data` and emits `action`.
registry.register({ type: "weather", description: "Weather summary", render: WeatherCard })
const actions = new ActionRegistry()
actions.register({ type: "refresh", run: async (params, { signal }) => fetch("/api/weather", { signal }) })
const cardStore = new CardStore({ registry })
const actionRuntime = createActionRuntime({ registry: actions, cardStore })
const r = ref<InstanceType<typeof AIRenderer>>()
async function ask() {
const res = await fetch("/api/chat")
r.value?.reset()
await r.value?.feed(res.body!) // also: r.value?.push(chunk)
}
</script>
<template>
<AIRenderer ref="r" :registry="registry" :card-store="cardStore" :action-runtime="actionRuntime" @card-action="(a) => console.log(a)" />
</template>
Exports
<AIRenderer :registry :card-store :plugins :sanitize :raw-html :action-runtime @card-action @node-click />— a render-function component; imperativepush/feed/reset/exportImagesvia a template ref (exposed).:pluginsalso takes a loader —:plugins="() => import('@ai-gui/plugin-mermaid').then(m => [m.mermaid()])"— and the renderer reparses what it buffered when the chunk lands.@node-click="(node, event) => …"reports which parsed block a click landed in;event.targetis the exact element clicked inside it.
useAIRenderer()— composable returning{ nodes, push, feed, reset }.useActionState(runtime, key)— reactive action lifecycle state.
Cards with a top-level id subscribe to the supplied CardStore. Their Vue component receives data and state props and emits action; store updates preserve the component instance and local refs.
Card component contract: props data, emits: ['action']. See the root README for cards, plugins, and buildSystemPrompt.
Related Packages
@comark/vue
Vue 3 renderer for Comark. Render Markdown with components at runtime, with stre...
1,255,538
1,080
Version History
| Version | Released | License |
|---|---|---|
| 0.49.0 | MIT | |
| 0.48.0 | MIT | |
| 0.47.0 | MIT | |
| 0.46.0 | MIT | |
| 0.45.0 | MIT | |
| 0.44.0 | MIT | |
| 0.43.0 | MIT | |
| 0.42.0 | MIT | |
| 0.41.2 | MIT | |
| 0.41.1 | MIT | |
| 0.41.0 | MIT | |
| 0.40.0 | MIT | |
| 0.39.1 | MIT | |
| 0.39.0 | MIT | |
| 0.38.0 | MIT | |
| 0.37.1 | MIT | |
| 0.37.0 | MIT | |
| 0.36.3 | MIT | |
| 0.36.2 | MIT | |
| 0.36.1 | MIT | |
| 0.36.0 | MIT | |
| 0.35.2 | MIT | |
| 0.35.1 | MIT | |
| 0.35.0 | MIT | |
| 0.34.0 | MIT | |
| 0.33.0 | MIT | |
| 0.32.0 | MIT | |
| 0.31.0 | MIT | |
| 0.30.0 | MIT | |
| 0.29.2 | MIT |
Showing the latest 30 of 72. See every release on npm