Skip to content
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
efbe938
feat(bubble): introduce BubbleItem and BubbleRenderer components for …
gene9831 Nov 19, 2025
ac5f29c
feat(bubble): refactor Bubble components to support split polymorphic…
gene9831 Nov 20, 2025
217dc20
feat(bubble): replace BubbleRenderer with BubbleContent for improved …
gene9831 Nov 27, 2025
0fde5eb
feat(bubble): add Tool and Tools components for enhanced tool call re…
gene9831 Nov 28, 2025
a0d860e
feat(bubble): refactor bubble components to utilize new composables f…
gene9831 Dec 1, 2025
71a0af7
feat(bubble): refactor bubble components to streamline rendering with…
gene9831 Dec 1, 2025
58f993d
Merge branch 'develop' of github.com:opentiny/tiny-robot into v0.4.0-…
gene9831 Dec 1, 2025
93f90cf
chore: ignore packages/test2
gene9831 Dec 1, 2025
43038de
feat(bubble): enhance bubble components with new store management and…
gene9831 Dec 8, 2025
16492e7
feat(bubble): enhance Bubble component structure with new slot suppor…
gene9831 Dec 8, 2025
3be63a3
feat(bubble): update BubbleList to include messageIndexes for improve…
gene9831 Dec 9, 2025
73fdb76
chore(bubble): remove outdated DESIGN.md file to streamline documenta…
gene9831 Dec 9, 2025
d7ea959
feat(bubble): integrate markdown rendering support with DOMPurify for…
gene9831 Dec 9, 2025
2590f0e
chore: initialize test2 package with Vue 3, TypeScript, and Vite setu…
gene9831 Dec 9, 2025
b71a494
feat(bubble): introduce fallback renderers and enhance renderer match…
gene9831 Dec 10, 2025
ce2638c
feat(bubble): update Avatar styling, add Markdown component, and refi…
gene9831 Dec 10, 2025
2d21c50
feat(bubble): refactor message group handling with new composables an…
gene9831 Dec 10, 2025
fd633e0
feat(bubble): improve CollapsibleContent and refactor props handling …
gene9831 Dec 10, 2025
b2c68b9
v0.4.0-alpha.1
gene9831 Dec 10, 2025
a786f89
refactor: refactor message handling in useConversation and useMessage…
gene9831 Dec 11, 2025
675cfdc
feat: add createSSEStreamGenerator utility and update message options…
gene9831 Dec 12, 2025
55e9a58
fix(types): update index types to use 'any' for dynamic properties in…
gene9831 Dec 12, 2025
5033095
feat(bubble): enhance message rendering with new content handling and…
gene9831 Dec 17, 2025
3fa65c0
feat(bubble): implement state management for bubble components with n…
gene9831 Dec 17, 2025
1cd00c9
refactor(bubble): replace BubbleContent type with BubbleMessage acros…
gene9831 Dec 18, 2025
3c81213
refactor(bubble): streamline message handling by introducing useOmitM…
gene9831 Dec 18, 2025
eade199
refactor(bubble): enhance bubble component functionality by adding ne…
gene9831 Dec 24, 2025
06367ff
feat(bubble): add auto-scroll functionality to BubbleList component a…
gene9831 Dec 26, 2025
6121c8b
refactor(bubble): update event emission from 'update:state' to 'state…
gene9831 Dec 29, 2025
bbcbbbf
refactor(bubble): improve content access in renderers by replacing in…
gene9831 Dec 29, 2025
876f3d7
refactor(bubble): introduce resolveMessageContent utility for improve…
gene9831 Dec 30, 2025
fb1eef0
chore(test2): remove test2 package files and configuration, cleaning …
gene9831 Dec 30, 2025
5ade00d
chore: update package versions to 0.3.0 and refactor bubble component…
gene9831 Dec 30, 2025
25d799c
feat(bubble): add new reasoning and tools components, enhance markdow…
gene9831 Dec 30, 2025
6d81971
chore: remove TODO.md file to clean up project documentation
gene9831 Dec 30, 2025
48004b4
revert bubble demos
gene9831 Dec 30, 2025
343f303
refactor(bubble): remove unused renderer components and clean up rend…
gene9831 Dec 30, 2025
e774263
refactor(bubble): update prop names in tr-bubble-list components for …
gene9831 Dec 30, 2025
436719b
Merge branch 'develop' of github.com:opentiny/tiny-robot into v0.4.0-…
gene9831 Dec 30, 2025
bc3666c
refactor(bubble): change prop names in tr-bubble-list components from…
gene9831 Dec 30, 2025
7f62227
Revert "refactor(bubble): remove unused renderer components and clean…
gene9831 Dec 30, 2025
5b061b5
Revert "revert bubble demos"
gene9831 Dec 30, 2025
7ccf0c2
Merge branch 'develop' of github.com:opentiny/tiny-robot into v0.4.0-…
gene9831 Jan 4, 2026
fb86eab
Merge branch 'v0.4.0/kits' of github.com:gene9831/tiny-robot into v0.…
gene9831 Jan 4, 2026
0f32100
feat(bubble): add copy cleanup functionality and context for Bubble c…
gene9831 Jan 4, 2026
211ad03
feat(bubble): implement content resolver for flexible message rendering
gene9831 Jan 6, 2026
fc5ec8c
feat(bubble): enhance Bubble component styles and message handling
gene9831 Jan 8, 2026
306a325
feat(message): enhance message handling with field inclusion/exclusion
gene9831 Jan 9, 2026
cdce75e
feat(bubble): add useToolCall composable for enhanced tool call manag…
gene9831 Jan 14, 2026
96ba1ea
feat(bubble): enhance reasoning content display and scrolling behavior
gene9831 Jan 14, 2026
14de782
feat(bubble): improve reasoning display with enhanced styling and ani…
gene9831 Jan 14, 2026
d2f0efd
feat(utils): rename and document SSE stream generator function
gene9831 Jan 15, 2026
f933b88
feat(bubble): enhance demo examples and content rendering capabilities
gene9831 Jan 16, 2026
b5dc893
feat(docs): update theme configuration and enhance demo examples
gene9831 Jan 16, 2026
9cdb943
feat(docs): add migration guides and enhance theme configuration
gene9831 Jan 20, 2026
801fd52
feat(bubble): refactor content rendering logic for improved flexibility
gene9831 Jan 23, 2026
d7130a1
fix(bubble): enforce required contentIndex in state-change events
gene9831 Jan 23, 2026
03dc194
refactor(bubble): simplify content extraction logic in useBubbleBoxRe…
gene9831 Jan 23, 2026
4fb32c3
fix(bubble): refine message grouping logic based on user role
gene9831 Jan 23, 2026
70d5e0c
feat(docs): update migration guides and theme configuration for useMe…
gene9831 Jan 26, 2026
08bce08
refactor(bubble): improve content handling and cleanup logic
gene9831 Jan 27, 2026
7406f4c
feat(conversation): enhance conversation loading logic and merging st…
gene9831 Jan 27, 2026
5a41d65
refactor(conversation): streamline conversation management and enhanc…
gene9831 Jan 30, 2026
fec7fa5
feat(demos): enhance API response handling in message demos
gene9831 Jan 30, 2026
a694c23
docs(message): enhance plugin system documentation for useMessage
gene9831 Jan 30, 2026
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
13 changes: 13 additions & 0 deletions docs/.vitepress/themeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ const sharedSidebarItems = [
{ text: 'AI模型交互工具类', link: 'ai-client' },
{ text: '消息数据管理', link: 'message' },
{ text: '会话数据管理', link: 'conversation' },
{ text: '工具函数', link: 'utils' },
],
},
]

const nav = [
{ text: '指南', link: '/guide/quick-start', activeMatch: '/guide/' },
{ text: '演示', link: '/examples/assistant', activeMatch: '/examples/' },
{ text: '迁移指南', link: '/migration/bubble-migration', activeMatch: '/migration/' },
]

const sidebar = {
Expand All @@ -56,6 +58,17 @@ const sidebar = {
items: [{ text: '综合示例', link: 'assistant' }],
},
],
'/migration/': [
{
text: '迁移指南',
base: '/migration/',
items: [
{ text: 'Bubble 气泡', link: 'bubble-migration' },
{ text: 'useMessage 迁移', link: 'use-message-migration' },
{ text: 'useConversation 迁移', link: 'use-conversation-migration' },
],
},
],
}

export const themeConfig = { nav, sidebar }
22 changes: 0 additions & 22 deletions docs/demos/bubble/aborted.vue

This file was deleted.

10 changes: 3 additions & 7 deletions docs/demos/bubble/avatar-and-placement.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<template>
<div style="display: flex; flex-direction: column; gap: 16px">
<tr-bubble
content="简单介绍 TinyVue"
content="用户消息"
:avatar="userAvatar"
placement="end"
style="--tr-bubble-content-bg: var(--tr-color-primary-light)"
></tr-bubble>
<tr-bubble
content="TinyVue 是一个轻量级、高性能的 Vue 3 组件库,专为企业级应用设计,由 OpenTiny 开源团队开发维护。"
:avatar="aiAvatar"
placement="start"
style="--tr-bubble-box-bg: var(--tr-color-primary-light)"
></tr-bubble>
<tr-bubble content="AI 回复消息" :avatar="aiAvatar" placement="start"></tr-bubble>
</div>
</template>

Expand Down
2 changes: 1 addition & 1 deletion docs/demos/bubble/basic.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<tr-bubble
content="TinyVue 是一个轻量级、高性能的 Vue 3 组件库,专为企业级应用设计,由 OpenTiny 开源团队开发维护。"
style="--tr-bubble-content-bg: var(--tr-color-primary-light)"
style="--tr-bubble-box-bg: var(--tr-color-primary-light); --tr-bubble-text-font-size: 16px"
></tr-bubble>
</template>

Expand Down
31 changes: 31 additions & 0 deletions docs/demos/bubble/content-render-mode.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<template>
<div style="display: flex; flex-direction: column; gap: 24px">
<div>
<p style="font-size: 12px; color: #666; margin-bottom: 8px">
<strong>single 模式(默认)</strong>:所有内容在一个 box 中渲染
</p>
<tr-bubble :content="arrayContent" :avatar="aiAvatar" content-render-mode="single"></tr-bubble>
</div>

<div>
<p style="font-size: 12px; color: #666; margin-bottom: 8px">
<strong>split 模式</strong>:每个内容项单独一个 box
</p>
<tr-bubble :content="arrayContent" :avatar="aiAvatar" content-render-mode="split"></tr-bubble>
</div>
</div>
</template>

<script setup lang="ts">
import { TrBubble } from '@opentiny/tiny-robot'
import { IconAi } from '@opentiny/tiny-robot-svgs'
import { h } from 'vue'

const aiAvatar = h(IconAi, { style: { fontSize: '32px' } })

const arrayContent = [
{ type: 'text', text: '第一条内容' },
{ type: 'text', text: '第二条内容' },
{ type: 'text', text: '第三条内容' },
]
</script>
50 changes: 50 additions & 0 deletions docs/demos/bubble/content-resolver.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<div style="display: flex; flex-direction: column; gap: 24px">
<div>
<p><strong>默认内容解析(使用 message.content)</strong></p>
<tr-bubble :content="message.content" :avatar="aiAvatar"></tr-bubble>
</div>

<div>
<p><strong>自定义内容解析(从 message.state 字段提取)</strong></p>
<tr-bubble v-bind="message" :avatar="aiAvatar" :content-resolver="customResolver"></tr-bubble>
</div>

<div>
<p><strong>自定义内容解析(组合多个字段)</strong></p>
<tr-bubble v-bind="message" :avatar="aiAvatar" :content-resolver="combinedResolver"></tr-bubble>
</div>
</div>
</template>

<script setup lang="ts">
import { TrBubble } from '@opentiny/tiny-robot'
import { IconAi } from '@opentiny/tiny-robot-svgs'
import type { BubbleMessage, ChatMessageContent } from '@opentiny/tiny-robot'
import { h } from 'vue'

const aiAvatar = h(IconAi, { style: { fontSize: '32px' } })

// 示例消息,将额外数据存储在 state 中
// state 用于存储 UI 相关的数据,不会影响消息内容
const message: BubbleMessage<ChatMessageContent, { text?: string; extra?: string }> = {
role: 'ai',
content: '这是默认的 content 字段',
state: {
text: '这是从 state.text 字段提取的内容',
extra: '这是存储在 state.extra 中的自定义数据',
},
}

// 自定义解析器:从 state.text 字段提取内容
const customResolver = (msg: BubbleMessage): ChatMessageContent | undefined => {
return msg.state?.text as string | undefined
}

// 组合解析器:组合 content 和 state.extra
const combinedResolver = (msg: BubbleMessage): ChatMessageContent | undefined => {
const content = (msg.content as string) || ''
const extra = (msg.state?.extra as string) || ''
return `${content}\n\n状态数据:${extra}`
}
</script>
48 changes: 0 additions & 48 deletions docs/demos/bubble/custom-content-field.vue

This file was deleted.

100 changes: 100 additions & 0 deletions docs/demos/bubble/custom-renderer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<template>
<div style="display: flex; flex-direction: column; gap: 16px">
<tr-bubble :content="codeMessage" :avatar="aiAvatar" :fallback-content-renderer="CodeBlockRenderer"></tr-bubble>
<tr-bubble :content="normalMessage" :avatar="aiAvatar"></tr-bubble>
</div>
</template>

<script setup lang="ts">
import { BubbleContentRendererProps, TrBubble } from '@opentiny/tiny-robot'
import { IconAi } from '@opentiny/tiny-robot-svgs'
import { defineComponent, h } from 'vue'
import { useMessageContent } from '@opentiny/tiny-robot'

const aiAvatar = h(IconAi, { style: { fontSize: '32px' } })

// 定义代码消息类型
interface CodeMessage {
type: 'code'
language: string
code: string
}

const codeMessage: CodeMessage[] = [
{
type: 'code',
language: 'javascript',
code: `function hello() {
console.log('Hello, World!')
}`,
},
]

const normalMessage = '这是一条普通消息'

// 自定义代码块渲染器
const CodeBlockRenderer = defineComponent({
props: {
message: {
type: Object,
required: true,
},
contentIndex: Number,
},
setup(props: BubbleContentRendererProps) {
// 使用 useMessageContent 来正确处理数组内容和 contentIndex
const { content: contentItem } = useMessageContent(props)

return () => {
const content = contentItem.value as unknown as CodeMessage

if (!content || content.type !== 'code') {
return h('div', '无效的代码内容')
}

return h('div', { class: 'code-block-wrapper' }, [
h(
'div',
{
class: 'code-block-header',
style: {
padding: '8px 12px',
background: '#2d2d2d',
color: '#fff',
fontSize: '12px',
borderTopLeftRadius: '6px',
borderTopRightRadius: '6px',
},
},
content.language || 'code',
),
h(
'pre',
{
class: 'code-block-content',
style: {
margin: 0,
padding: '12px',
background: '#1e1e1e',
color: '#d4d4d4',
fontSize: '14px',
fontFamily: 'monospace',
borderBottomLeftRadius: '6px',
borderBottomRightRadius: '6px',
overflow: 'auto',
},
},
h('code', {}, content.code),
),
])
}
},
})
</script>

<style scoped>
.code-block-wrapper {
width: 100%;
max-width: 100%;
}
</style>
53 changes: 53 additions & 0 deletions docs/demos/bubble/image.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<template>
<div style="display: flex; flex-direction: column; gap: 16px">
<div>
<p><strong>单张图片</strong></p>
<tr-bubble
:content="[{ type: 'image_url', image_url: { url: 'https://picsum.photos/400/300?random=1' } }]"
:avatar="aiAvatar"
></tr-bubble>
</div>

<div>
<p><strong>多张图片</strong></p>
<tr-bubble :content="multipleImages" :avatar="aiAvatar"></tr-bubble>
</div>

<div>
<div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px">
<p style="margin: 0"><strong>图片与文本混合</strong></p>
<label style="display: flex; align-items: center; gap: 4px; font-size: 12px; color: #666">
<input type="checkbox" v-model="useSplitMode" />
split 模式
</label>
</div>
<tr-bubble
:content="mixedContent"
:avatar="aiAvatar"
:content-render-mode="useSplitMode ? 'split' : 'single'"
></tr-bubble>
</div>
</div>
</template>

<script setup lang="ts">
import { TrBubble } from '@opentiny/tiny-robot'
import { IconAi } from '@opentiny/tiny-robot-svgs'
import { h, ref } from 'vue'

const aiAvatar = h(IconAi, { style: { fontSize: '32px' } })

const multipleImages = [
{ type: 'image_url', image_url: { url: 'https://picsum.photos/400/300?random=2' } },
{ type: 'image_url', image_url: { url: 'https://picsum.photos/400/300?random=3' } },
{ type: 'image_url', image_url: { url: 'https://picsum.photos/400/300?random=4' } },
]

const mixedContent = [
{ type: 'text', text: '这是一张示例图片:' },
{ type: 'image_url', image_url: { url: 'https://picsum.photos/400/300?random=5' } },
{ type: 'text', text: '图片下方可以继续显示文本内容。' },
]

const useSplitMode = ref(false)
</script>
Loading
Loading