From 792ccf98792a33416d1ccf3351578e103f771faa Mon Sep 17 00:00:00 2001 From: peoray Date: Wed, 3 Dec 2025 01:03:03 +0100 Subject: [PATCH 1/3] feat: introduce ChatGPT, Claude, and Grok demo examples and update introduction docs page --- apps/www/components/ElementsDemo.vue | 60 ++ apps/www/content/1.overview/1.Introduction.md | 65 +- .../3.components/1.chatbot/prompt-input.md | 58 +- apps/www/plugins/ai-elements.ts | 2 + .../src/prompt-input/PromptInputSubmit.vue | 3 + packages/examples/package.json | 3 +- packages/examples/src/demo-chatgpt.vue | 660 +++++++++++++++ packages/examples/src/demo-claude.vue | 682 ++++++++++++++++ packages/examples/src/demo-grok.vue | 751 ++++++++++++++++++ packages/examples/src/index.ts | 3 + pnpm-lock.yaml | 86 +- 11 files changed, 2224 insertions(+), 149 deletions(-) create mode 100644 apps/www/components/ElementsDemo.vue create mode 100644 packages/examples/src/demo-chatgpt.vue create mode 100644 packages/examples/src/demo-claude.vue create mode 100644 packages/examples/src/demo-grok.vue diff --git a/apps/www/components/ElementsDemo.vue b/apps/www/components/ElementsDemo.vue new file mode 100644 index 0000000..789cba8 --- /dev/null +++ b/apps/www/components/ElementsDemo.vue @@ -0,0 +1,60 @@ + + + diff --git a/apps/www/content/1.overview/1.Introduction.md b/apps/www/content/1.overview/1.Introduction.md index 1a313ac..f8c53ae 100644 --- a/apps/www/content/1.overview/1.Introduction.md +++ b/apps/www/content/1.overview/1.Introduction.md @@ -1,60 +1,47 @@ --- title: Introduction -description: +description: What is AI Elements and why you should use it. icon: lucide:info --- [AI Elements Vue](https://github.com/vuepont/ai-elements-vue) is the Vue port of [AI-Elements](https://github.com/vercel/ai-elements), a component library and custom registry built on top of [shadcn-vue](https://shadcn-vue.com/) to help you build AI-native applications faster. It provides pre-built components like conversations, messages and more. -You can install it with: +Installing AI Elements Vue is straightforward and can be done in a couple of ways. You can use the dedicated CLI command for the fastest setup, or integrate via the standard shadcn-vue CLI if you’ve already adopted shadcn’s workflow. -:pm-x{command="ai-elements-vue@latest"} +:::tabs{variant="card"} + ::div{label="AI Elements Vue"} + ```sh + npx ai-elements-vue@latest + ``` + :: + ::div{label="shadcn-vue CLI"} -## Components - -:::ComponentLoader{label="Message" componentName="Message"} + ```sh + npx shadcn-vue@latest add https://registry.ai-elements-vue.com/all.json + ``` + :: ::: -:::ComponentLoader{label="Conversation" componentName="Conversation"} -::: +## Quick Start -:::ComponentLoader{label="PromptInput" componentName="PromptInput"} -::: - -:::ComponentLoader{label="Image" componentName="Image"} -::: +Here are some basic examples of what you can achieve using components from AI Elements. -:::ComponentLoader{label="Loader" componentName="Loader"} +:::ElementsDemo ::: -:::ComponentLoader{label="Suggestion" componentName="Suggestion"} -::: +## Prerequisites -:::ComponentLoader{label="Shimmer" componentName="Shimmer"} -::: +Before installing AI Elements, make sure your environment meets the following requirements: -:::ComponentLoader{label="OpenInChat" componentName="OpenInChat"} -::: +- [Node.js](https://nodejs.org/en/download/), version 18 or later +- A [Vue.js](https://vuejs.org/) or [Nuxt.js](https://nuxt.com/) project with the [AI SDK](https://ai-sdk.dev/) installed. +- [shadcn-vue](https://shadcn-vue.com/) installed in your project. If you don't have it installed, running any install command will automatically install it for you. +- We also highly recommend using the [AI Gateway](https://vercel.com/docs/ai-gateway) and adding `AI_GATEWAY_API_KEY` to your `env.local` so you don't have to use an API key from every provider. AI Gateway also gives $5 in usage per month so you can experiment with models. You can obtain an API key [here](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Get%20your%20AI%20Gateway%20key). -:::ComponentLoader{label="Task" componentName="Task"} -::: +## Installing Components -:::ComponentLoader{label="Sources" componentName="Sources"} -::: +You can install AI Elements Vue components using either the AI Elements Vue CLI or the shadcn-vue CLI. Both achieve the same result: adding the selected component’s code and any needed dependencies to your project. -:::ComponentLoader{label="Plan" componentName="Plan"} -::: - -:::ComponentLoader{label="Queue" componentName="Queue"} -::: - -:::ComponentLoader{label="ChainOfThought" componentName="ChainOfThought"} -::: - -:::ComponentLoader{label="InlineCitation" componentName="InlineCitation"} -::: - -:::ComponentLoader{label="CodeBlock" componentName="CodeBlock"} -::: +The CLI will download the component’s code and integrate it into your project’s directory (usually under your components folder). By default, AI Elements components are added to the `@/components/ai-elements/` directory (or whatever folder you’ve configured in your shadcn-vue components settings). -View the [source code](https://github.com/vuepont/ai-elements-vue) for all components on GitHub. +After running the command, you should see a confirmation in your terminal that the files were added. You can then proceed to use the component in your code. diff --git a/apps/www/content/3.components/1.chatbot/prompt-input.md b/apps/www/content/3.components/1.chatbot/prompt-input.md index 7d450f7..26aaa66 100644 --- a/apps/www/content/3.components/1.chatbot/prompt-input.md +++ b/apps/www/content/3.components/1.chatbot/prompt-input.md @@ -272,57 +272,63 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>() ```vue [PromptInputButton.vue] height=300 collapse ``` diff --git a/apps/www/plugins/ai-elements.ts b/apps/www/plugins/ai-elements.ts index c2e6eff..51f024e 100644 --- a/apps/www/plugins/ai-elements.ts +++ b/apps/www/plugins/ai-elements.ts @@ -2,12 +2,14 @@ import type { NuxtApp } from 'nuxt/app' import * as Components from '@repo/examples' import ComponentLoader from '@/components/ComponentLoader.vue' import ComponentViewer from '@/components/ComponentViewer.vue' +import ElementsDemo from '@/components/ElementsDemo.vue' export default defineNuxtPlugin((nuxtApp: NuxtApp) => { const { vueApp } = nuxtApp vueApp.component('ComponentLoader', ComponentLoader) vueApp.component('ComponentViewer', ComponentViewer) + vueApp.component('ElementsDemo', ElementsDemo) Object.entries(Components).forEach(([name, component]) => { vueApp.component(name, component) diff --git a/packages/elements/src/prompt-input/PromptInputSubmit.vue b/packages/elements/src/prompt-input/PromptInputSubmit.vue index 274009c..2f67071 100644 --- a/packages/elements/src/prompt-input/PromptInputSubmit.vue +++ b/packages/elements/src/prompt-input/PromptInputSubmit.vue @@ -1,4 +1,5 @@ + + diff --git a/packages/examples/src/demo-claude.vue b/packages/examples/src/demo-claude.vue new file mode 100644 index 0000000..413530c --- /dev/null +++ b/packages/examples/src/demo-claude.vue @@ -0,0 +1,682 @@ + + + diff --git a/packages/examples/src/demo-grok.vue b/packages/examples/src/demo-grok.vue new file mode 100644 index 0000000..e38eacb --- /dev/null +++ b/packages/examples/src/demo-grok.vue @@ -0,0 +1,751 @@ + + + diff --git a/packages/examples/src/index.ts b/packages/examples/src/index.ts index 4d1e205..a0caa75 100644 --- a/packages/examples/src/index.ts +++ b/packages/examples/src/index.ts @@ -9,6 +9,9 @@ export { default as ConfirmationRequest } from './confirmation-request.vue' export { default as Confirmation } from './confirmation.vue' export { default as Context } from './context.vue' export { default as Conversation } from './conversation.vue' +export { default as ChatGPTExample } from './demo-chatgpt.vue' +export { default as ClaudeExample } from './demo-claude.vue' +export { default as GrokExample } from './demo-grok.vue' export { default as Image } from './image.vue' export { default as InlineCitation } from './inline-citation.vue' export { default as LoaderCustomStyling } from './loader-custom-styling.vue' diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec2245a..4c4ce50 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -199,6 +199,9 @@ importers: vue: specifier: ^3.5.22 version: 3.5.22(typescript@5.9.3) + vue-sonner: + specifier: ^2.0.9 + version: 2.0.9(@nuxt/kit@4.2.1(magicast@0.3.5))(@nuxt/schema@4.1.2)(nuxt@4.1.2(@parcel/watcher@2.5.1)(@types/node@24.6.2)(@vue/compiler-sfc@3.5.22)(db0@0.3.4)(eslint@9.37.0(jiti@2.6.1))(ioredis@5.8.0)(lightningcss@1.30.1)(magicast@0.3.5)(optionator@0.9.4)(rollup@4.52.4)(stylus@0.57.0)(terser@5.44.0)(typescript@5.9.3)(vite@7.1.9(@types/node@24.6.2)(jiti@2.6.1)(lightningcss@1.30.1)(stylus@0.57.0)(terser@5.44.0)(yaml@2.8.1))(vue-tsc@3.1.0(typescript@5.9.3))(yaml@2.8.1)) devDependencies: typescript: specifier: ^5.9.3 @@ -1343,84 +1346,72 @@ packages: engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-arm64-gnu@0.87.0': resolution: {integrity: sha512-tf2Shom09AaSmu7U1hYYcEFF/cd+20HtmQ8eyGsRkqD5bqUj6lDu8TNSU9FWZ9tcZ83NzyFMwXZWHyeeIIbpxw==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-arm64-musl@0.78.0': resolution: {integrity: sha512-q4x8hLW9JyHVS+AtKSt6Z4W+S+fXSCARBnizzW9mtND47atRiJzChOInlZUBgQhyDy3KQFt51aKIEDJpwysoEw==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-minify/binding-linux-arm64-musl@0.87.0': resolution: {integrity: sha512-pgWeYfSprtpnJVea9Q5eI6Eo80lDGlMw2JdcSMXmShtBjEhBl6bvDNHlV+6kNfh7iT65y/uC6FR8utFrRghu8A==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-minify/binding-linux-riscv64-gnu@0.78.0': resolution: {integrity: sha512-ajBxhoqW04KUI/fWewBf71WB2xdjce9VgF9rbLfQOBgCeCcyHMh+VKYjxBuWQamWrcABqt8Z5OIiRth9qt6CIg==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-riscv64-gnu@0.87.0': resolution: {integrity: sha512-O1QPczlT+lqNZVeKOdFxxL+s1RIlnixaJYFLrcqDcRyn82MGKLz7sAenBTFRQoIfLnSxtMGL6dqHOefYkQx7Cg==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-s390x-gnu@0.78.0': resolution: {integrity: sha512-H6B+h4Q3w/AtAr7EWScvDevxPKQPlhijMmSiMYRMkbTYwJPlUsBXyVj39Atdd1BIjCx8rYGvGxl/PhxPkdCjXQ==} engines: {node: '>=14.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-s390x-gnu@0.87.0': resolution: {integrity: sha512-tcwt3ZUWOKfNLXN2edxFVHMlIuPvbuyMaKmRopgljSCfFcNHWhfTNlxlvmECRNhuQ91EcGwte6F1dwoeMCNd7A==} engines: {node: '>=14.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-x64-gnu@0.78.0': resolution: {integrity: sha512-5vSPG67PVTwrzSPbXLofJtdSlb/lWyn36WElonLwecAtZX7v7KDhX0aUHqKSBsQ0qnJaYnhv5o0uUHudNZwq8g==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-x64-gnu@0.87.0': resolution: {integrity: sha512-Xf4AXF14KXUzSnfgTcFLFSM0TykJhFw14+xwNvlAb6WdqXAKlMrz9joIAezc8dkW1NNscCVTsqBUPJ4RhvCM1Q==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-minify/binding-linux-x64-musl@0.78.0': resolution: {integrity: sha512-Iq7eeZkGFUbyo7zRrAIP6rNAH+lIft9VJQUbDhhnTIMJWLUZx9JkSmM+0NBRfxPeurxbzO3EToDZ2cCYtVEU0Q==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-minify/binding-linux-x64-musl@0.87.0': resolution: {integrity: sha512-LIqvpx9UihEW4n9QbEljDnfUdAWqhr6dRqmzSFwVAeLZRUECluLCDdsdwemrC/aZkvnisA4w0LFcFr3HmeTLJg==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-minify/binding-wasm32-wasi@0.78.0': resolution: {integrity: sha512-Bj2l/A6e32mZ2aPRDmlkDClMkbPe+dCWl4enPY+PCZNkhLLfLfcMFemCCWO44rdWCOCehWiP8Tr3QEe3yTR7kA==} @@ -1605,168 +1596,144 @@ packages: engines: {node: '>=20.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-arm64-gnu@0.87.0': resolution: {integrity: sha512-fcnnsfcyLamJOMVKq+BQ8dasb8gRnZtNpCUfZhaEFAdXQ7J2RmZreFzlygcn80iti0V7c5LejcjHbF4IdK3GAw==} engines: {node: '>=20.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-arm64-gnu@0.93.0': resolution: {integrity: sha512-NoB7BJmwVGrcS/J5XXn362lBsIyeTqZF70rCFij3/XwQ2kcELfGMALY9AUulFYauLTY2AG4vcmctJQxn9Lj85g==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-arm64-gnu@0.95.0': resolution: {integrity: sha512-0LzebARTU0ROfD6pDK4h1pFn+09meErCZ0MA2TaW08G72+GNneEsksPufOuI+9AxVSRa+jKE3fu0wavvhZgSkg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-arm64-musl@0.78.0': resolution: {integrity: sha512-VBdPB2N37A+M49zPV8ziiFywlgE3VX3AnR+zT1cIdQyKDoFM3uGPtjmtRe1qw6KhFF5YtxInzb0v3E3VkSdhuQ==} engines: {node: '>=20.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-arm64-musl@0.87.0': resolution: {integrity: sha512-tBPkSPgRSSbmrje8CUovISi/Hj/tWjZJ3n/qnrjx2B+u86hWtwLsngtPDQa5d4seSyDaHSx6tNEUcH7+g5Ee0Q==} engines: {node: '>=20.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-arm64-musl@0.93.0': resolution: {integrity: sha512-s+nraJJR9SuHsgsr42nbOBpAsaSAE6MhK7HGbz01svLJzDsk3Ylh9cbVUPLaS3gOlTq5WC6VjPBkQuInLo0hvQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-arm64-musl@0.95.0': resolution: {integrity: sha512-Pvi1lGe/G+mJZ3hUojMP/aAHAzHA25AEtVr8/iuz7UV72t/15NOgJYr9kELMUMNjPqpr3vKUgXTFmTtAxp11Qw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-riscv64-gnu@0.78.0': resolution: {integrity: sha512-743OajvLP/fJm2d2da4/vqLMfki6XxfXizbUfPzEAXJMH0vEjf63s4gf55SBuy6hpmXOdCW5k4L6AoS+E89qtw==} engines: {node: '>=20.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-riscv64-gnu@0.87.0': resolution: {integrity: sha512-z4UKGM4wv2wEAQAlx2pBq6+pDJw5J/5oDEXqW6yBSLbWLjLDo4oagmRSE3+giOWteUa+0FVJ+ypq4iYxBkYSWg==} engines: {node: '>=20.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-riscv64-gnu@0.93.0': resolution: {integrity: sha512-oNIQb/7HGxVNeVgtkoqNcDS1hjfxArLDuMI72V+Slp67yfBdxgvfmM2JSWE7kGR5gyiZQeTjRbG89VrRwPDtww==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-riscv64-gnu@0.95.0': resolution: {integrity: sha512-pUEVHIOVNDfhk4sTlLhn6mrNENhE4/dAwemxIfqpcSyBlYG0xYZND1F3jjR2yWY6DakXZ6VSuDbtiv1LPNlOLw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-s390x-gnu@0.78.0': resolution: {integrity: sha512-z3HVOr6F1PpKAxzwwG9NKfFmCCMMI8MbmxZ3l+UKKViFD9NlJYKx+Afye3SgHHTkYKEm3POgmmR4Aq3kKMP7sQ==} engines: {node: '>=20.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-s390x-gnu@0.87.0': resolution: {integrity: sha512-6W1ENe/nZtr2TBnrEzmdGEraEAdZOiH3YoUNNeQWuqwLkmpoHTJJdclieToPe/l2IKJ4WL3FsSLSGHE8yt/OEg==} engines: {node: '>=20.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-s390x-gnu@0.93.0': resolution: {integrity: sha512-YyzhzAoq5WpRtAGOngpJUu+4jKagSbknORejmpeW48vu8/+XjrVZFc/1Qe4i72EsPzLorDwCxWVkU8VftpM4iA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-s390x-gnu@0.95.0': resolution: {integrity: sha512-5+olaepHTE3J/+w7g0tr3nocvv5BKilAJnzj4L8tWBCLEZbL6olJcGVoldUO+3cgg1SO1xJywP5BuLhT0mDUDw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-x64-gnu@0.78.0': resolution: {integrity: sha512-qJULpZeRsN0mfxasPh8EzzE7lsEEMEEtcprgw8QetB5l1Urz4gzKyeKdqs1vuxBl9o0s+WHSiowH2YqFMALs/g==} engines: {node: '>=20.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-x64-gnu@0.87.0': resolution: {integrity: sha512-s3kB/Ii3X3IOZ27Iu7wx2zYkIcDO22Emu32SNC6kkUSy09dPBc1yaW14TnAkPMe/rvtuzR512JPWj3iGpl+Dng==} engines: {node: '>=20.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-x64-gnu@0.93.0': resolution: {integrity: sha512-UMXsE6c0MIlvtqDe5t5K8qwC6HqNb3wmy8zKxONo42dIx0WAhVV9ydG2Xlznt1/RhD6nLLtHVaq4yWJXRjUxcg==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-x64-gnu@0.95.0': resolution: {integrity: sha512-8huzHlK/N98wrnYKxIcYsK8ZGBWomQchu/Mzi6m+CtbhjWOv9DmK0jQ2fUWImtluQVpTwS0uZT06d3g7XIkJrA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-parser/binding-linux-x64-musl@0.78.0': resolution: {integrity: sha512-ctEL662Oe9Gaqf/48lsVZzAMcAcXIWsddZy59kGH7592rJBaXxmQhkOnnVEeJF25k4JMbCCdYwGsgI7WtC+Fdg==} engines: {node: '>=20.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-x64-musl@0.87.0': resolution: {integrity: sha512-3+M9hfrZSDi4+Uy4Ll3rtOuVG3IHDQlj027jgtmAAHJK1eqp4CQfC7rrwE+LFUqUwX+KD2GwlxR+eHyyEf5Gbg==} engines: {node: '>=20.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-x64-musl@0.93.0': resolution: {integrity: sha512-0Vd0yFUq129VW+Cpcj/gJOqub4EMN5hUWnVk8UfAvUZ+lxZBFeXbYNI5483SLwzvw5umzlMmkKpYWw5OTwYFaA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [musl] '@oxc-parser/binding-linux-x64-musl@0.95.0': resolution: {integrity: sha512-bWnrLfGDcx/fab0+UQnFbVFbiykof/btImbYf+cI2pU/1Egb2x+OKSmM5Qt0nEUiIpM5fgJmYXxTopybSZOKYA==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [musl] '@oxc-parser/binding-wasm32-wasi@0.78.0': resolution: {integrity: sha512-Pq0uT2CuN3J7Tv3KLuO7Sh4C7zTuqdJl0IDg3zB5keKx0BSbaEWewJL2CUNYUlG8txf+sMpUV+bkAIS5MEcKAw==} @@ -1961,126 +1928,108 @@ packages: engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-arm64-gnu@0.87.0': resolution: {integrity: sha512-BxFkIcso2V1+FCDoU+KctxvJzSQVSnEZ5EEQ8O3Up9EoFVQRnZ8ktXvqYj2Oqvc4IYPskLPsKUgc9gdK8wGhUg==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-arm64-gnu@0.95.0': resolution: {integrity: sha512-NLdrFuEHlmbiC1M1WESFV4luUcB/84GXi+cbnRXhgMjIW/CThRVJ989eTJy59QivkVlLcJSKTiKiKCt0O6TTlQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-arm64-musl@0.78.0': resolution: {integrity: sha512-dr9J1uRo6ssDtuqx7s9GeePEDXlQOf4jk8/Tke9x5PCSJim5goMebEoAikuPf0jMhMNc05Kow0eOPLX1EmwsFQ==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-transform/binding-linux-arm64-musl@0.87.0': resolution: {integrity: sha512-MZ1/TNaebhXK73j1UDfwyBFnAy0tT3n6otOkhlt1vlJwqboUS/D7E/XrCZmAuHIfVPxAXRPovkl7kfxLB43SKw==} engines: {node: '>=14.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-transform/binding-linux-arm64-musl@0.95.0': resolution: {integrity: sha512-GL0ffCPW8JlFI0/jeSgCY665yDdojHxA0pbYG+k8oEHOWCYZUZK9AXL+r0oerNEWYJ8CRB+L5Yq87ZtU/YUitw==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [arm64] os: [linux] - libc: [musl] '@oxc-transform/binding-linux-riscv64-gnu@0.78.0': resolution: {integrity: sha512-ALNvBi1l+17moTS2BtVZRxR0D1BGyR7iddNUJkHxEegvNzHyGJTZ60b0IXdvpCTH+CKUNsM40KxCVdzHca6VJQ==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-riscv64-gnu@0.87.0': resolution: {integrity: sha512-JCWE6n4Hicu0FVbvmLdH/dS8V6JykOUsbrbDYm6JwFlHr4eFTTlS2B+mh5KPOxcdeOlv/D/XRnvMJ6WGYs25EA==} engines: {node: '>=14.0.0'} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-riscv64-gnu@0.95.0': resolution: {integrity: sha512-tbH7LaClSmN3YFVo1UjMSe7D6gkb5f+CMIbj9i873UUZomVRmAjC4ygioObfzM+sj/tX0WoTXx5L1YOfQkHL6Q==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [riscv64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-s390x-gnu@0.78.0': resolution: {integrity: sha512-s0r4cz6zZqr7SqfoUinn27B/mp1aiFVUsbsI4vomc7DtZkLpBSnSOAomZBlb0OSLbR9n2YPXm1033XR5W+ezWg==} engines: {node: '>=14.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-s390x-gnu@0.87.0': resolution: {integrity: sha512-n2NTgM+3PqFagJV9UXRDNOmYesF+TO9SF9FeHqwVmW893ayef9KK+vfWAAhvOYHXYaKWT5XoHd87ODD7nruyhw==} engines: {node: '>=14.0.0'} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-s390x-gnu@0.95.0': resolution: {integrity: sha512-8jMqiURWa0iTiPMg7BWaln89VdhhWzNlPyKM90NaFVVhBIKCr2UEhrQWdpBw/E9C8uWf/4VabBEhfPMK+0yS4w==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [s390x] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-x64-gnu@0.78.0': resolution: {integrity: sha512-nH9y61/1oyCQfUjtKHEnnMPBJZOhH+G2QqSAD7sCH35Iz78UA+bKVjHnlfnhBedy1xWCNwlboNclaBTHYAgNeA==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-x64-gnu@0.87.0': resolution: {integrity: sha512-ZOKW3wx0bW2O7jGdOzr8DyLZqX2C36sXvJdsHj3IueZZ//d/NjLZqEiUKz+q0JlERHtCVKShQ5PLaCx7NpuqNg==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-x64-gnu@0.95.0': resolution: {integrity: sha512-D5ULJ2uWipsTgfvHIvqmnGkCtB3Fyt2ZN7APRjVO+wLr+HtmnaWddKsLdrRWX/m/6nQ2xQdoQekdJrokYK9LtQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [glibc] '@oxc-transform/binding-linux-x64-musl@0.78.0': resolution: {integrity: sha512-Yo+pmsW49QNo4F4RoqOhfRxN9851Td/nc93ESQbzav9vhriipPRvZRVusG5t126inAgjlprFbOet5TXSWKd92A==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-transform/binding-linux-x64-musl@0.87.0': resolution: {integrity: sha512-eIspx/JqkVMPK1CAYEOo2J8o49s4ZTf+32MSMUknIN2ZS1fvRmWS0D/xFFaLP/9UGhdrXRIPbn/iSYEA8JnV/g==} engines: {node: '>=14.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@oxc-transform/binding-linux-x64-musl@0.95.0': resolution: {integrity: sha512-DmCGU+FzRezES5wVAGVimZGzYIjMOapXbWpxuz8M8p3nMrfdBEQ5/tpwBp2vRlIohhABy4vhHJByl4c64ENCGQ==} engines: {node: ^20.19.0 || >=22.12.0} cpu: [x64] os: [linux] - libc: [musl] '@oxc-transform/binding-wasm32-wasi@0.78.0': resolution: {integrity: sha512-djA47tsuUwNPHqcxre+EMD/wBBaP+TP6kQt2ioC6XElRldHCEGBUsVidrS5rgN4O7SyKx/DuJ528locJKTDSPw==} @@ -2162,42 +2111,36 @@ packages: engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm-musl@2.5.1': resolution: {integrity: sha512-6E+m/Mm1t1yhB8X412stiKFG3XykmgdIOqhjWj+VL8oHkKABfu/gjFj8DvLrYVHSBNC+/u5PeNrujiSQ1zwd1Q==} engines: {node: '>= 10.0.0'} cpu: [arm] os: [linux] - libc: [musl] '@parcel/watcher-linux-arm64-glibc@2.5.1': resolution: {integrity: sha512-LrGp+f02yU3BN9A+DGuY3v3bmnFUggAITBGriZHUREfNEzZh/GO06FF5u2kx8x+GBEUYfyTGamol4j3m9ANe8w==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-arm64-musl@2.5.1': resolution: {integrity: sha512-cFOjABi92pMYRXS7AcQv9/M1YuKRw8SZniCDw0ssQb/noPkRzA+HBDkwmyOJYp5wXcsTrhxO0zq1U11cK9jsFg==} engines: {node: '>= 10.0.0'} cpu: [arm64] os: [linux] - libc: [musl] '@parcel/watcher-linux-x64-glibc@2.5.1': resolution: {integrity: sha512-GcESn8NZySmfwlTsIur+49yDqSny2IhPeZfXunQi48DMugKeZ7uy1FX83pO0X22sHntJ4Ub+9k34XQCX+oHt2A==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [glibc] '@parcel/watcher-linux-x64-musl@2.5.1': resolution: {integrity: sha512-n0E2EQbatQ3bXhcH2D1XIAANAcTZkQICBPVaxMeaCVBtOpBZpWJuf7LwyWPSBDITb7In8mqQgJ7gH8CILCURXg==} engines: {node: '>= 10.0.0'} cpu: [x64] os: [linux] - libc: [musl] '@parcel/watcher-wasm@2.5.1': resolution: {integrity: sha512-RJxlQQLkaMMIuWRozy+z2vEqbaQlCuaCgVZIUCzQLYggY22LZbP5Y1+ia+FD724Ids9e+XIyOLXLrLgQSHIthw==} @@ -2282,28 +2225,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@resvg/resvg-js-linux-arm64-musl@2.6.2': resolution: {integrity: sha512-3h3dLPWNgSsD4lQBJPb4f+kvdOSJHa5PjTYVsWHxLUzH4IFTJUAnmuWpw4KqyQ3NA5QCyhw4TWgxk3jRkQxEKg==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@resvg/resvg-js-linux-x64-gnu@2.6.2': resolution: {integrity: sha512-IVUe+ckIerA7xMZ50duAZzwf1U7khQe2E0QpUxu5MBJNao5RqC0zwV/Zm965vw6D3gGFUl7j4m+oJjubBVoftw==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@resvg/resvg-js-linux-x64-musl@2.6.2': resolution: {integrity: sha512-UOf83vqTzoYQO9SZ0fPl2ZIFtNIz/Rr/y+7X8XRX1ZnBYsQ/tTb+cj9TE+KHOdmlTFBxhYzVkP2lRByCzqi4jQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@resvg/resvg-js-win32-arm64-msvc@2.6.2': resolution: {integrity: sha512-7C/RSgCa+7vqZ7qAbItfiaAWhyRSoD4l4BQAbVDqRRsRgY+S+hgS3in0Rxr7IorKUpGE69X48q6/nOAuTJQxeQ==} @@ -2452,67 +2391,56 @@ packages: resolution: {integrity: sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ==} cpu: [arm] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.52.4': resolution: {integrity: sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q==} cpu: [arm] os: [linux] - libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.52.4': resolution: {integrity: sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg==} cpu: [arm64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.52.4': resolution: {integrity: sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g==} cpu: [arm64] os: [linux] - libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.52.4': resolution: {integrity: sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ==} cpu: [loong64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-ppc64-gnu@4.52.4': resolution: {integrity: sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g==} cpu: [ppc64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-gnu@4.52.4': resolution: {integrity: sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg==} cpu: [riscv64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.52.4': resolution: {integrity: sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA==} cpu: [riscv64] os: [linux] - libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.52.4': resolution: {integrity: sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA==} cpu: [s390x] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.52.4': resolution: {integrity: sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg==} cpu: [x64] os: [linux] - libc: [glibc] '@rollup/rollup-linux-x64-musl@4.52.4': resolution: {integrity: sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw==} cpu: [x64] os: [linux] - libc: [musl] '@rollup/rollup-openharmony-arm64@4.52.4': resolution: {integrity: sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA==} @@ -2658,28 +2586,24 @@ packages: engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-arm64-musl@4.1.14': resolution: {integrity: sha512-ISZjT44s59O8xKsPEIesiIydMG/sCXoMBCqsphDm/WcbnuWLxxb+GcvSIIA5NjUw6F8Tex7s5/LM2yDy8RqYBQ==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - libc: [musl] '@tailwindcss/oxide-linux-x64-gnu@4.1.14': resolution: {integrity: sha512-02c6JhLPJj10L2caH4U0zF8Hji4dOeahmuMl23stk0MU1wfd1OraE7rOloidSF8W5JTHkFdVo/O7uRUJJnUAJg==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [glibc] '@tailwindcss/oxide-linux-x64-musl@4.1.14': resolution: {integrity: sha512-TNGeLiN1XS66kQhxHG/7wMeQDOoL0S33x9BgmydbrWAb9Qw0KYdd8o1ifx4HOGDWhVmJ+Ul+JQ7lyknQFilO3Q==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - libc: [musl] '@tailwindcss/oxide-wasm32-wasi@4.1.14': resolution: {integrity: sha512-uZYAsaW/jS/IYkd6EWPJKW/NlPNSkWkBlaeVBi/WsFQNP05/bzkebUL8FH1pdsqx4f2fH/bWFcUABOM9nfiJkQ==} @@ -5724,28 +5648,24 @@ packages: engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.30.1: resolution: {integrity: sha512-jmUQVx4331m6LIX+0wUhBbmMX7TCfjF5FoOH6SD1CttzuYlGNVpA7QnrmLxrsub43ClTINfGSYyHe2HWeLl5CQ==} engines: {node: '>= 12.0.0'} cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.30.1: resolution: {integrity: sha512-piWx3z4wN8J8z3+O5kO74+yr6ze/dKmPnI7vLqfSqI8bccaTGY5xiSGVIJBDd5K5BHlvVLpUB3S2YCfelyJ1bw==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.30.1: resolution: {integrity: sha512-rRomAK7eIkL+tHY0YPxbc5Dra2gXlI63HL+v1Pdi1a3sC+tJTcFrHX+E86sulgAXeI7rSzDYhPSeHHjqFhqfeQ==} engines: {node: '>= 12.0.0'} cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.30.1: resolution: {integrity: sha512-mSL4rqPi4iXq5YVqzSsJgMVFENoa4nGTT/GjO2c0Yl9OuQfPsIfncvLrEW6RbbB24WtZ3xP/2CCmI3tNkNV4oA==} From 9fa0c026830c35c5f9b9e16f13c4dc530c70e615 Mon Sep 17 00:00:00 2001 From: peoray Date: Wed, 3 Dec 2025 01:32:11 +0100 Subject: [PATCH 2/3] chore(docs): add new usage and troubleshooting guides while removing the setup guide --- apps/www/content/1.overview/1.Introduction.md | 8 ++- apps/www/content/1.overview/2.setup.md | 26 --------- .../1.overview/{3.usage.md => 2.usage.md} | 28 ++++++---- .../content/1.overview/3.troubleshooting.md | 53 +++++++++++++++++++ 4 files changed, 78 insertions(+), 37 deletions(-) delete mode 100644 apps/www/content/1.overview/2.setup.md rename apps/www/content/1.overview/{3.usage.md => 2.usage.md} (64%) create mode 100644 apps/www/content/1.overview/3.troubleshooting.md diff --git a/apps/www/content/1.overview/1.Introduction.md b/apps/www/content/1.overview/1.Introduction.md index f8c53ae..a506075 100644 --- a/apps/www/content/1.overview/1.Introduction.md +++ b/apps/www/content/1.overview/1.Introduction.md @@ -1,6 +1,6 @@ --- title: Introduction -description: What is AI Elements and why you should use it. +description: What is AI Elements Vue and why you should use it. icon: lucide:info --- @@ -24,7 +24,7 @@ Installing AI Elements Vue is straightforward and can be done in a couple of way ## Quick Start -Here are some basic examples of what you can achieve using components from AI Elements. +Here are some basic examples of what you can achieve using components from AI Elements Vue. :::ElementsDemo ::: @@ -38,6 +38,10 @@ Before installing AI Elements, make sure your environment meets the following re - [shadcn-vue](https://shadcn-vue.com/) installed in your project. If you don't have it installed, running any install command will automatically install it for you. - We also highly recommend using the [AI Gateway](https://vercel.com/docs/ai-gateway) and adding `AI_GATEWAY_API_KEY` to your `env.local` so you don't have to use an API key from every provider. AI Gateway also gives $5 in usage per month so you can experiment with models. You can obtain an API key [here](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Get%20your%20AI%20Gateway%20key). + ::alert{type="info" icon="lucide:info"} + AI Elements is built targeting Vue 3 and Tailwind CSS 4. + :: + ## Installing Components You can install AI Elements Vue components using either the AI Elements Vue CLI or the shadcn-vue CLI. Both achieve the same result: adding the selected component’s code and any needed dependencies to your project. diff --git a/apps/www/content/1.overview/2.setup.md b/apps/www/content/1.overview/2.setup.md deleted file mode 100644 index 82ea0c0..0000000 --- a/apps/www/content/1.overview/2.setup.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Setup -description: -icon: lucide:play ---- - -Installing AI Elements is straightforward and can be done in a couple of ways. You can use the dedicated CLI command for the fastest setup, or integrate via the standard shadcn-vue CLI if you’ve already adopted shadcn’s workflow. - -:pm-x{command="ai-elements-vue@latest"} - -## Prerequisites - -Before installing AI Elements, make sure your environment meets the following requirements: - -- [Node.js](https://nodejs.org/en/download/), version 18 or later -- A [Vue.js](https://vuejs.org/) or [Nuxt.js](https://nuxt.com/) project with the [AI SDK](https://ai-sdk.dev/) installed. -- [shadcn-vue](https://shadcn-vue.com/) installed in your project. In practice, this means you have already initialized shadcn-vue in your project (for example by running `npx shadcn-vue@latest init` and configuring Tailwind CSS). AI Elements currently supports only the CSS Variables mode of shadcn-vue for theming. -- We also highly recommend using the [AI Gateway](https://vercel.com/docs/ai-gateway) and adding `AI_GATEWAY_API_KEY` to your `env.local` so you don't have to use an API key from every provider. AI Gateway also gives $5 in usage per month so you can experiment with models. You can obtain an API key [here](https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%2Fapi-keys&title=Get%20your%20AI%20Gateway%20key). - -## Installing Components - -You can install AI Elements Vue components using either the AI Elements Vue CLI or the shadcn-vue CLI. Both achieve the same result: adding the selected component’s code and any needed dependencies to your project. - -The CLI will download the component’s code and integrate it into your project’s directory (usually under your components folder). By default, AI Elements components are added to the `@/components/ai-elements/` directory (or whatever folder you’ve configured in your shadcn-vue components settings). - -After running the command, you should see a confirmation in your terminal that the files were added. You can then proceed to use the component in your code. diff --git a/apps/www/content/1.overview/3.usage.md b/apps/www/content/1.overview/2.usage.md similarity index 64% rename from apps/www/content/1.overview/3.usage.md rename to apps/www/content/1.overview/2.usage.md index 197cae6..19d0089 100644 --- a/apps/www/content/1.overview/3.usage.md +++ b/apps/www/content/1.overview/2.usage.md @@ -1,6 +1,6 @@ --- title: Usage -description: +description: Learn how to use AI Elements Vue components in your application. icon: lucide:book --- @@ -13,8 +13,7 @@ After installing AI Elements Vue components, you can use them in your applicatio ```vue [ConversationExample.vue] @@ -22,21 +21,32 @@ const { messages } = useChat() ``` -In the example above, we import the `Message` component from our AI Elements Vue directory and include it in a Vue SFC template. Then we compose it with `MessageContent` and `Response`. Since the code lives in your project, you can open and customize the component files directly. +In the example above, we import the `Message` component from our AI Elements Vue directory and include it in a Vue SFC template. Then we compose it with `MessageContent` and `MessageResponse` subcomponents. You can style or configure the component just as you would if you wrote it yourself – since the code lives in your project, you can even open the component file to see how it works or make custom modifications. + +## Extensibility + +All AI Elements Vue components take as many primitive attributes as possible. For example, the `Message` component extends `HTMLAttributes`, so you can pass any props that a `div` supports. This makes it easy to extend the component with your own styles or functionality. ## Customization diff --git a/apps/www/content/1.overview/3.troubleshooting.md b/apps/www/content/1.overview/3.troubleshooting.md new file mode 100644 index 0000000..20e61ae --- /dev/null +++ b/apps/www/content/1.overview/3.troubleshooting.md @@ -0,0 +1,53 @@ +--- +title: Troubleshooting +description: What to do if you run into issues with AI Elements Vue. +icon: lucide:wrench +--- + +## Why are my components not styled? + +Make sure your project is configured correctly for shadcn-vue in Tailwind 4 - this means having a `globals.css file that imports Tailwind and includes the shadcn-vue base styles. + +## I ran the AI Elements Vue CLI but nothing was added to my project + +Double-check that: + +- Your current working directory is the root of your project (where `package.json` lives). +- Your `components.json` file (if using shadcn-vue style config) is set up correctly. +- You’re using the latest version of the AI Elements Vue CLI: + +```sh [Terminal] +npx ai-elements-vue@latest +``` + +If all else fails, feel free to open an [issue on GitHub](https://github.com/vuepont/ai-elements-vue/issues). + +## Theme switching doesn’t work — my app stays in light mode + +Ensure your app is using the same data-theme system that shadcn-vue and AI Elements Vue expect. The default implementation toggles a data-theme attribute on the `` element. Make sure your tailwind.config.js is using class or data- selectors accordingly: + +## The component imports fail with “module not found” + +Check the file exists. If it does, make sure your `tsconfig.json` has a proper paths alias for @/ i.e. + +```json [tsconfig.json] +{ + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@/*": ["./*"] + } + } +} +``` + +## My AI coding assistant can't access AI Elements components + +1. Verify your config file syntax is valid JSON. +2. Check that the file path is correct for your AI tool. +3. Restart your coding assistant after making changes. +4. Ensure you have a stable internet connection. + +## Still stuck? + +If none of these answers help, open an [issue on GitHub](https://github.com/vuepont/ai-elements-vue/issues) and someone will be happy to assist. From 1fdf9fb1ebea7f48ba233188ab8cac10f18d1dda Mon Sep 17 00:00:00 2001 From: peoray Date: Wed, 3 Dec 2025 04:17:26 +0100 Subject: [PATCH 3/3] chore(docs): update components documentation pages --- apps/www/components/layout/PrevNextButton.vue | 33 +++ .../1.chatbot/chain-of-thought.md | 56 +--- .../3.components/1.chatbot/checkpoint.md | 8 +- .../3.components/1.chatbot/confirmation.md | 26 +- .../content/3.components/1.chatbot/context.md | 32 +-- .../3.components/1.chatbot/conversation.md | 18 +- .../3.components/1.chatbot/inline-citation.md | 243 ++++++++++++++---- .../content/3.components/1.chatbot/message.md | 139 ++++++++-- .../3.components/1.chatbot/model-selector.md | 34 +-- .../content/3.components/1.chatbot/plan.md | 48 +--- .../3.components/1.chatbot/prompt-input.md | 88 +++---- .../content/3.components/1.chatbot/queue.md | 40 +-- .../3.components/1.chatbot/reasoning.md | 22 +- .../content/3.components/1.chatbot/shimmer.md | 24 +- .../content/3.components/1.chatbot/sources.md | 28 +- .../3.components/1.chatbot/suggestion.md | 22 +- .../content/3.components/1.chatbot/task.md | 39 +-- .../content/3.components/1.chatbot/tool.md | 20 +- .../content/3.components/2.workflow/canvas.md | 6 +- .../3.components/2.workflow/connection.md | 6 +- .../3.components/2.workflow/controls.md | 6 +- .../content/3.components/2.workflow/edge.md | 6 +- .../content/3.components/2.workflow/node.md | 6 +- .../content/3.components/2.workflow/panel.md | 6 +- .../3.components/2.workflow/toolbar.md | 6 +- .../3.components/3.vibe-coding/artifact.md | 8 +- .../3.components/3.vibe-coding/web-preview.md | 26 +- .../4.documentation/open-in-chat.md | 30 +-- .../3.components/5.utilities/code-block.md | 29 +-- .../content/3.components/5.utilities/image.md | 119 ++++++++- .../3.components/5.utilities/loader.md | 24 +- packages/examples/src/chain-of-thought.vue | 2 +- 32 files changed, 674 insertions(+), 526 deletions(-) create mode 100644 apps/www/components/layout/PrevNextButton.vue diff --git a/apps/www/components/layout/PrevNextButton.vue b/apps/www/components/layout/PrevNextButton.vue new file mode 100644 index 0000000..a7f0a0f --- /dev/null +++ b/apps/www/components/layout/PrevNextButton.vue @@ -0,0 +1,33 @@ + + + diff --git a/apps/www/content/3.components/1.chatbot/chain-of-thought.md b/apps/www/content/3.components/1.chatbot/chain-of-thought.md index 0a3b676..618633c 100644 --- a/apps/www/content/3.components/1.chatbot/chain-of-thought.md +++ b/apps/www/content/3.components/1.chatbot/chain-of-thought.md @@ -1,6 +1,6 @@ --- title: Chain of Thought -description: +description: A collapsible component that visualizes AI reasoning steps with support for search results, images, and step-by-step progress indicators. icon: lucide:brain --- @@ -12,12 +12,12 @@ The `ChainOfThought` component provides a visual representation of an AI's reaso ## Install using CLI :::tabs{variant="card"} - ::div{label="ai-elements-vue"} + ::div{label="AI Elements Vue"} ```sh npx ai-elements-vue@latest add chain-of-thought ``` :: - ::div{label="shadcn-vue"} + ::div{label="shadcn-vue CLI"} ```sh npx shadcn-vue@latest add https://registry.ai-elements-vue.com/chain-of-thought.json @@ -30,7 +30,7 @@ The `ChainOfThought` component provides a visual representation of an AI's reaso Copy and paste the following files into the same folder. :::code-group -```vue [ChainOfThought.vue] +```vue [ChainOfThought.vue] height=500 collapse @@ -178,7 +178,7 @@ import { Button } from '@repo/shadcn-vue/components/ui/button' ``` -```ts [context.ts] height=260 collapse +```ts [context.ts] height=500 collapse import type { ToolUIPart } from 'ai' import type { InjectionKey, Ref } from 'vue' import { inject } from 'vue' @@ -244,7 +244,7 @@ Build a chat UI with tool approval workflow where dangerous tools require user c Add the following component to your frontend: -```vue [pages/index.vue] height=260 collapse +```vue [pages/index.vue] height=500 collapse ``` -## Features +Add the following route to your backend: + +```ts [server/api/citation.ts] +import { streamObject } from 'ai' +import { z } from 'zod' + +export const citationSchema = z.object({ + content: z.string(), + citations: z.array( + z.object({ + number: z.string(), + title: z.string(), + url: z.string(), + description: z.string().optional(), + quote: z.string().optional(), + }) + ), +}) -- Hover interaction to reveal detailed citation information -- **Carousel navigation** for multiple citations with prev/next controls -- **Live index tracking** showing current slide position (e.g., "1/5") -- Support for source titles, URLs, and descriptions -- Optional quote blocks for relevant excerpts -- Composable architecture for flexible citation formats -- Accessible design with proper keyboard navigation -- Seamless integration with AI-generated content -- Clean visual design that doesn't disrupt reading flow -- Smart badge display showing source hostname and count +// Allow streaming responses up to 30 seconds +export const maxDuration = 30 + +export default defineEventHandler(async (event) => { + const body = await readBody<{ prompt: string }>(event) + + const result = streamObject({ + model: 'openai/gpt-4o', + schema: citationSchema, + prompt: `Generate a well-researched paragraph about ${body.prompt} with proper citations. + + Include: + - A comprehensive paragraph with inline citations marked as [1], [2], etc. + - 2-3 citations with realistic source information + - Each citation should have a title, URL, and optional description/quote + - Make the content informative and the sources credible + + Format citations as numbered references within the text.`, + }) + + return result.toTextStreamResponse() +}) +``` + +Currently, there is no official support for inline citations with Streamdown or the Response component. This is because: + +- There isn't any good markdown syntax for inline citations +- Language models don't naturally respond with inline citation syntax +- The AI SDK doesn't have built-in support for inline citations + +### Potential Approaches + +While these methods are hypothetical and not officially supported, there are two conceptual ways inline citations could work with Streamdown: + +1. **Footnote conversion**: GitHub Flavored Markdown (GFM) handles footnotes using `[^1]` syntax. You could hypothetically remove the default footnote rendering and convert footnotes to inline citations instead. + +2. **Custom HTML syntax**: You could add a system prompt instructing the model to use a special HTML syntax like `` and pass that as a custom component to Streamdown. + +These approaches require custom implementation and are not currently supported out of the box. We will investigate official support for this use case in the future. + +For now, the recommended approach is to use `experimental_useObject` (as shown in the usage example above) to generate structured citation data, then manually parse and render inline citations. ## Props diff --git a/apps/www/content/3.components/1.chatbot/message.md b/apps/www/content/3.components/1.chatbot/message.md index 9606bcc..d20bde8 100644 --- a/apps/www/content/3.components/1.chatbot/message.md +++ b/apps/www/content/3.components/1.chatbot/message.md @@ -6,18 +6,18 @@ icon: lucide:message-circle The `Message` component suite provides a complete set of tools for building chat interfaces. It includes components for displaying messages from users and AI assistants, managing multiple response branches, adding action buttons, and rendering markdown content. -:::ComponentLoader{label="Message" componentName="Message"} +:::ComponentLoader{label="Preview" componentName="Message"} ::: ## Install using CLI ::tabs{variant="card"} - ::div{label="ai-elements-vue"} + ::div{label="AI Elements Vue"} ```sh npx ai-elements-vue@latest add message ``` :: - ::div{label="shadcn-vue"} + ::div{label="shadcn-vue CLI"} ```sh npx shadcn-vue@latest add https://registry.ai-elements-vue.com/message.json @@ -628,18 +628,6 @@ export { default as MessageToolbar } from './MessageToolbar.vue' ``` :: -## Usage - -```ts -import { Message, MessageContent } from '@/components/ai-elements/message' -``` - -```vue - - Hi there! - -``` - ## Usage with AI SDK Build a simple chat UI where the user can copy or regenerate the most recent message. @@ -747,19 +735,130 @@ function handleSubmit() { - Displays messages from both user and AI assistant with distinct styling and automatic alignment - Minimalist flat design with user messages in secondary background and assistant messages full-width -- Response branching with navigation controls to switch between multiple AI response versions -- Markdown rendering with GFM support (tables, task lists, strikethrough), math equations, and smart streaming -- Action buttons for common operations (retry, like, dislike, copy, share) with tooltips and state management -- File attachments display with support for images and generic files with preview and remove functionality +- **Response branching** with navigation controls to switch between multiple AI response versions +- **Markdown rendering** with GFM support (tables, task lists, strikethrough), math equations, and smart streaming +- **Action buttons** for common operations (retry, like, dislike, copy, share) with tooltips and state management +- **File attachments** display with support for images and generic files with preview and remove functionality - Code blocks with syntax highlighting and copy-to-clipboard functionality - Keyboard accessible with proper ARIA labels - Responsive design that adapts to different screen sizes - Seamless light/dark theme integration -::alert{icon="lucide:info"} +::alert{type="info" icon="lucide:info"} Branching is an advanced use case you can implement to suit your needs. While the AI SDK does not provide built-in branching support, you have full flexibility to design and manage multiple response paths. :: +## Usage with AI SDK + +Build a simple chat UI where the user can copy or regenerate the most recent message. + +Add the following component to your frontend: + +```vue [pages/index.vue] height=500 collapse + + + +``` + ## Props ### `` diff --git a/apps/www/content/3.components/1.chatbot/model-selector.md b/apps/www/content/3.components/1.chatbot/model-selector.md index d96e20f..94355ce 100644 --- a/apps/www/content/3.components/1.chatbot/model-selector.md +++ b/apps/www/content/3.components/1.chatbot/model-selector.md @@ -12,12 +12,12 @@ The `Model Selector` component provides a searchable command palette interface f ## Install using CLI ::tabs{variant="card"} - ::div{label="ai-elements-vue"} + ::div{label="AI Elements Vue"} ```sh npx ai-elements-vue@latest add model-selector ``` :: - ::div{label="shadcn-vue"} + ::div{label="shadcn-vue CLI"} ```sh npx shadcn-vue@latest add https://registry.ai-elements-vue.com/model-selector.json @@ -30,7 +30,7 @@ The `Model Selector` component provides a searchable command palette interface f Copy and paste the following code in the same folder. :::code-group -```vue [ModelSelector.vue] height=260 collapse +```vue [ModelSelector.vue] @@ -42,7 +42,7 @@ import { Dialog } from '@repo/shadcn-vue/components/ui/dialog' ``` -```vue [ModelSelectorTrigger.vue] height=260 collapse +```vue [ModelSelectorTrigger.vue] @@ -54,7 +54,7 @@ import { DialogTrigger } from '@repo/shadcn-vue/components/ui/dialog' ``` -```vue [ModelSelectorContent.vue] height=260 collapse +```vue [ModelSelectorContent.vue] height=500 collapse @@ -98,7 +98,7 @@ import { CommandDialog } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorInput.vue] height=260 collapse +```vue [ModelSelectorInput.vue] @@ -131,7 +131,7 @@ import { CommandList } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorEmpty.vue] height=260 collapse +```vue [ModelSelectorEmpty.vue] @@ -143,7 +143,7 @@ import { CommandEmpty } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorGroup.vue] height=260 collapse +```vue [ModelSelectorGroup.vue] @@ -155,7 +155,7 @@ import { CommandGroup } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorItem.vue] height=260 collapse +```vue [ModelSelectorItem.vue] @@ -167,7 +167,7 @@ import { CommandItem } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorShortcut.vue] height=260 collapse +```vue [ModelSelectorShortcut.vue] @@ -179,7 +179,7 @@ import { CommandShortcut } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorSeparator.vue] height=260 collapse +```vue [ModelSelectorSeparator.vue] @@ -189,7 +189,7 @@ import { CommandSeparator } from '@repo/shadcn-vue/components/ui/command' ``` -```vue [ModelSelectorLogo.vue] height=260 collapse +```vue [ModelSelectorLogo.vue] ``` +:::: + +Add the following route to your backend: + +::::code-group +```ts [server/api/image.ts] +import { openai } from '@ai-sdk/openai' +import { experimental_generateImage } from 'ai' + +export default defineEventHandler(async (event) => { + const { prompt } = await readBody<{ prompt: string }>(event) + + const { image } = await experimental_generateImage({ + model: openai.image('dall-e-3'), + prompt, + size: '1024x1024', + }) + + return { + base64: image.base64, + uint8Array: image.uint8Array, + mediaType: image.mediaType, + } +}) +``` +:::: ## Features diff --git a/apps/www/content/3.components/5.utilities/loader.md b/apps/www/content/3.components/5.utilities/loader.md index dac5280..33c9998 100644 --- a/apps/www/content/3.components/5.utilities/loader.md +++ b/apps/www/content/3.components/5.utilities/loader.md @@ -1,10 +1,10 @@ --- title: Loader -description: +description: A spinning loader component for indicating loading states in AI applications. icon: lucide:loader --- -The `Loader` component provides a spinning animation to indicate loading states in your AI applications. It includes both a customizable wrapper component and the underlying icon for flexible usage. +The `Loader` component provides a spinning animation to indicate loading states in your AI applications. It includes both a customizable wrapper component and the underlying icon for flexible usage. :::ComponentLoader{label="Preview" componentName="Loader"} ::: @@ -12,12 +12,12 @@ The `Loader` component provides a spinning animation to indicate loading states ## Install using CLI :::tabs{variant="card"} - ::div{label="ai-elements-vue"} + ::div{label="AI Elements Vue"} ```sh npx ai-elements-vue@latest add loader ``` :: - ::div{label="shadcn-vue"} + ::div{label="shadcn-vue CLI"} ```sh npx shadcn-vue@latest add https://registry.ai-elements-vue.com/loader.json @@ -55,7 +55,7 @@ const props = withDefaults(defineProps(), { ``` -```vue [LoaderIcon.vue] +```vue [LoaderIcon.vue] height=500 collapse - - -``` - ## Usage with AI SDK Build a simple chat app that displays a loader before it the response streans by using `status === "submitted"`. Add the following component to your frontend: -```vue [pages/index.vue] +```vue [pages/index.vue] height=500 collapse