Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ AI Elements Vue includes the following components:
| `response` | ✅ 已完成 | Formatted AI response display |
| `prompt-input` | ✅ 已完成 | Advanced input component with model selection |
| `actions` | ✅ 已完成 | Interactive action buttons for AI responses |
| `branch` | ❌ 未完成 | Branch visualization for conversation flows |
| `branch` | ✅ 已完成 | Branch visualization for conversation flows |
| `code-block` | ❌ 未完成 | Syntax-highlighted code display with copy functionality |
| `image` | ❌ 未完成 | AI-generated image display component |
| `inline-citation` | ❌ 未完成 | Inline source citations |
Expand Down
2 changes: 1 addition & 1 deletion apps/registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"devDependencies": {
"@vue/compiler-sfc": "^3.5.21",
"h3": "^1.15.4",
"nitropack": "^2.12.4",
"nitropack": "^2.12.6",
"ts-morph": "^27.0.0"
}
}
59 changes: 59 additions & 0 deletions apps/test/app/examples/branch.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<script setup lang="ts">
import { Branch, BranchMessages, BranchNext, BranchPage, BranchPrevious, BranchSelector } from '@repo/elements/branch'
import { Message, MessageAvatar, MessageContent } from '@repo/elements/message'
import { nanoid } from 'nanoid'

interface SimpleMessage {
id: string
content: string
}

const userMessages: SimpleMessage[] = [
{ id: nanoid(), content: 'What are the key strategies for optimizing Vue performance?' },
{ id: nanoid(), content: 'How can I improve the performance of my Vue application?' },
{ id: nanoid(), content: 'What performance optimization techniques should I use in Vue?' },
]

const assistantMessages: SimpleMessage[] = [
{ id: nanoid(), content: 'Here\'s the first response to your question. This approach focuses on performance optimization.' },
{ id: nanoid(), content: 'Here\'s an alternative response. This approach emphasizes code readability and maintainability over pure performance.' },
{ id: nanoid(), content: 'And here\'s a third option. This balanced approach considers both performance and maintainability, making it suitable for most use cases.' },
]

function handleBranchChange(branchIndex: number) {
// eslint-disable-next-line no-console
console.log('Branch changed to:', branchIndex)
}
</script>

<template>
<div class="space-y-8">
<Branch :default-branch="0" :on-branch-change="handleBranchChange">
<BranchMessages>
<Message v-for="message in userMessages" :key="message.id" from="user">
<MessageContent>{{ message.content }}</MessageContent>
<MessageAvatar name="Hayden Bleasel" src="https://github.com/haydenbleasel.png" />
</Message>
</BranchMessages>
<BranchSelector from="user">
<BranchPrevious />
<BranchPage />
<BranchNext />
</BranchSelector>
</Branch>

<Branch :default-branch="0" :on-branch-change="handleBranchChange">
<BranchMessages>
<Message v-for="message in assistantMessages" :key="message.id" from="assistant">
<MessageContent>{{ message.content }}</MessageContent>
<MessageAvatar name="AI" src="https://github.com/openai.png" />
</Message>
</BranchMessages>
<BranchSelector from="assistant">
<BranchPrevious />
<BranchPage />
<BranchNext />
</BranchSelector>
</Branch>
</div>
</template>
2 changes: 2 additions & 0 deletions apps/test/app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Card, CardContent, CardHeader, CardTitle } from '@repo/shadcn-vue/components/ui/card'
import ActionsHover from '~/examples/actions-hover.vue'
import Actions from '~/examples/actions.vue'
import Branch from '~/examples/branch.vue'
import Conversation from '~/examples/conversation.vue'
import MessageMarkdown from '~/examples/message-markdown.vue'
import Message from '~/examples/message.vue'
Expand All @@ -11,6 +12,7 @@ import Response from '~/examples/response.vue'
const components = [
{ name: 'Message', Component: Message },
{ name: 'Actions', Component: Actions },
{ name: 'Branch', Component: Branch },
{ name: 'ActionsHover', Component: ActionsHover },
{ name: 'PromptInput', Component: PromptInput },
{ name: 'Conversation', Component: Conversation },
Expand Down
18 changes: 9 additions & 9 deletions apps/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
"dependencies": {
"@repo/elements": "workspace:*",
"@repo/shadcn-vue": "workspace:*",
"@tailwindcss/vite": "^4.1.12",
"@vueuse/core": "^13.8.0",
"ai": "^5.0.28",
"@tailwindcss/vite": "^4.1.13",
"@vueuse/core": "^13.9.0",
"ai": "^5.0.51",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-vue-next": "^0.542.0",
"nanoid": "^5.1.5",
"nuxt": "^4.0.3",
"lucide-vue-next": "^0.544.0",
"nanoid": "^5.1.6",
"nuxt": "^4.1.2",
"shadcn-nuxt": "2.2.0",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.12",
"tw-animate-css": "^1.3.7",
"vue": "^3.5.20",
"tailwindcss": "^4.1.13",
"tw-animate-css": "^1.4.0",
"vue": "^3.5.21",
"vue-router": "^4.5.1"
},
"devDependencies": {
Expand Down
3 changes: 3 additions & 0 deletions apps/www/content/1.overview/1.Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,7 @@ You can install it with:
:::ComponentLoader{label="Actions" componentName="Actions"}
:::

:::ComponentLoader{label="Branch" componentName="Branch"}
:::

View the [source code](https://github.com/cwandev/ai-elements-vue) for all components on GitHub.
Loading