Skip to content

Commit fc01c7c

Browse files
committed
feat: add inline-citation component
1 parent 64eefdd commit fc01c7c

35 files changed

+1465
-5
lines changed

apps/test/app/examples/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export { default as ChainOfThought } from './chain-of-thought.vue'
55
export { default as CodeBlock } from './code-block.vue'
66
export { default as Conversation } from './conversation.vue'
77
export { default as Image } from './image.vue'
8+
export { default as InlineCitation } from './inline-citation.vue'
89
export { default as Loader } from './loader.vue'
910
export { default as MessageMarkdown } from './message-markdown.vue'
1011
export { default as Message } from './message.vue'
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<script setup lang="ts">
2+
import {
3+
InlineCitation,
4+
InlineCitationCard,
5+
InlineCitationCardBody,
6+
InlineCitationCardTrigger,
7+
InlineCitationCarousel,
8+
InlineCitationCarouselContent,
9+
InlineCitationCarouselHeader,
10+
InlineCitationCarouselIndex,
11+
InlineCitationCarouselItem,
12+
InlineCitationCarouselNext,
13+
InlineCitationCarouselPrev,
14+
InlineCitationSource,
15+
InlineCitationText,
16+
} from '@repo/elements/inline-citation'
17+
18+
const citation = {
19+
text: 'The technology continues to evolve rapidly, with new breakthroughs being announced regularly',
20+
sources: [
21+
{
22+
title: 'Advances in Natural Language Processing',
23+
url: 'https://example.com/nlp-advances',
24+
description:
25+
'A comprehensive study on the recent developments in natural language processing technologies and their applications.',
26+
},
27+
{
28+
title: 'Breakthroughs in Machine Learning',
29+
url: 'https://mlnews.org/breakthroughs',
30+
description:
31+
'An overview of the most significant machine learning breakthroughs in the past year.',
32+
},
33+
{
34+
title: 'AI in Healthcare: Current Trends',
35+
url: 'https://healthai.com/trends',
36+
description:
37+
'A report on how artificial intelligence is transforming healthcare and diagnostics.',
38+
},
39+
{
40+
title: 'Ethics of Artificial Intelligence',
41+
url: 'https://aiethics.org/overview',
42+
description:
43+
'A discussion on the ethical considerations and challenges in the development of AI.',
44+
},
45+
{
46+
title: 'Scaling Deep Learning Models',
47+
url: 'https://deeplearninghub.com/scaling-models',
48+
description:
49+
'Insights into the technical challenges and solutions for scaling deep learning architectures.',
50+
},
51+
{
52+
title: 'Natural Language Understanding Benchmarks',
53+
url: 'https://nlubenchmarks.com/latest',
54+
description:
55+
'A summary of the latest benchmarks and evaluation metrics for natural language understanding systems.',
56+
},
57+
],
58+
}
59+
</script>
60+
61+
<template>
62+
<p class="text-sm leading-relaxed">
63+
According to recent studies, artificial intelligence has shown remarkable
64+
progress in natural language processing.
65+
<InlineCitation>
66+
<InlineCitationText>{{ citation.text }}</InlineCitationText>
67+
<InlineCitationCard>
68+
<InlineCitationCardTrigger
69+
:sources="citation.sources.map((source) => source.url)"
70+
/>
71+
<InlineCitationCardBody>
72+
<InlineCitationCarousel>
73+
<InlineCitationCarouselHeader>
74+
<InlineCitationCarouselPrev />
75+
<InlineCitationCarouselNext />
76+
<InlineCitationCarouselIndex />
77+
</InlineCitationCarouselHeader>
78+
<InlineCitationCarouselContent>
79+
<InlineCitationCarouselItem
80+
v-for="source in citation.sources"
81+
:key="source.url"
82+
>
83+
<InlineCitationSource
84+
:description="source.description"
85+
:title="source.title"
86+
:url="source.url"
87+
/>
88+
</InlineCitationCarouselItem>
89+
</InlineCitationCarouselContent>
90+
</InlineCitationCarousel>
91+
</InlineCitationCardBody>
92+
</InlineCitationCard>
93+
</InlineCitation>.
94+
</p>
95+
</template>

apps/test/app/pages/index.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import ChainOfThought from '~/examples/chain-of-thought.vue'
77
import CodeBlock from '~/examples/code-block.vue'
88
import Conversation from '~/examples/conversation.vue'
99
import Image from '~/examples/image.vue'
10+
import InlineCitation from '~/examples/inline-citation.vue'
1011
import Loader from '~/examples/loader.vue'
1112
import MessageMarkdown from '~/examples/message-markdown.vue'
1213
import Message from '~/examples/message.vue'
@@ -40,6 +41,7 @@ const components = [
4041
{ name: 'ChainOfThought', Component: ChainOfThought },
4142
{ name: 'Queue', Component: Queue },
4243
{ name: 'Plan', Component: Plan },
44+
{ name: 'InlineCitation', Component: InlineCitation },
4345
]
4446
</script>
4547

apps/www/content/1.overview/1.Introduction.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,22 @@ You can install it with:
4545
:::ComponentLoader{label="OpenInChat" componentName="OpenInChat"}
4646
:::
4747

48+
:::ComponentLoader{label="Task" componentName="Task"}
49+
:::
50+
51+
:::ComponentLoader{label="Sources" componentName="Sources"}
52+
:::
53+
54+
:::ComponentLoader{label="Plan" componentName="Plan"}
55+
:::
56+
57+
:::ComponentLoader{label="Queue" componentName="Queue"}
58+
:::
59+
60+
:::ComponentLoader{label="ChainOfThought" componentName="ChainOfThought"}
61+
:::
62+
63+
:::ComponentLoader{label="InlineCitation" componentName="InlineCitation"}
64+
:::
65+
4866
View the [source code](https://github.com/cwandev/ai-elements-vue) for all components on GitHub.

apps/www/content/2.components/chain-of-thought.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Chain of Thought
33
description:
4-
icon: lucide:code
4+
icon: lucide:brain
55
---
66

77
The `ChainOfThought` component provides a visual representation of an AI's reasoning process, showing step-by-step thinking with support for search results, images, and progress indicators. It helps users understand how AI arrives at conclusions.

0 commit comments

Comments
 (0)