Skip to content

Commit c7bf369

Browse files
authored
chore(deps): bump xsai to v0.4.0-beta.2 (#473)
* chore(deps): bump xsai to v0.4.0-beta.2 * fix: use new types
1 parent 36d74ca commit c7bf369

File tree

6 files changed

+319
-152
lines changed

6 files changed

+319
-152
lines changed

apps/stage-tamagotchi/src/components/ChatHistory.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup lang="ts">
2-
import type { UserMessagePart } from '@xsai/shared-chat'
2+
import type { CommonContentPart } from '@xsai/shared-chat'
33
44
import { MarkdownRenderer } from '@proj-airi/stage-ui/components'
55
import { useChatStore } from '@proj-airi/stage-ui/stores/chat'
@@ -93,7 +93,7 @@ onTokenLiteral(async () => {
9393
<span text-xs text="cyan-400/90 dark:cyan-600/90" font-normal class="inline <sm:hidden">{{ t('stage.chat.message.character-name.you') }}</span>
9494
</div>
9595
<div v-if="Array.isArray(message.content)" class="flex flex-col gap-2">
96-
<template v-for="(part, partIndex) in (message.content as UserMessagePart[])" :key="partIndex">
96+
<template v-for="(part, partIndex) in (message.content as CommonContentPart[])" :key="partIndex">
9797
<MarkdownRenderer
9898
v-if="part.type === 'text' && part.text"
9999
:content="part.text"

packages/stage-ui/src/stores/chat.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ChatProvider } from '@xsai-ext/shared-providers'
2-
import type { Message, SystemMessage, UserMessagePart } from '@xsai/shared-chat'
2+
import type { CommonContentPart, Message, SystemMessage } from '@xsai/shared-chat'
33

44
import type { StreamEvent } from '../stores/llm'
55
import type { ChatAssistantMessage, ChatMessage, ChatSlices } from '../types/chat'
@@ -97,7 +97,7 @@ export const useChatStore = defineStore('chat', () => {
9797
await hook(sendingMessage)
9898
}
9999

100-
const contentParts: UserMessagePart[] = [{ type: 'text', text: sendingMessage }]
100+
const contentParts: CommonContentPart[] = [{ type: 'text', text: sendingMessage }]
101101

102102
if (options.attachments) {
103103
for (const attachment of options.attachments) {

packages/stage-ui/src/stores/llm.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { ChatProvider } from '@xsai-ext/shared-providers'
2-
import type { CompletionToolCall, Message, ToolMessagePart } from '@xsai/shared-chat'
2+
import type { CommonContentPart, CompletionToolCall, Message } from '@xsai/shared-chat'
33

44
import { readableStreamToAsyncIterator } from '@moeru/std'
55
import { listModels } from '@xsai/model'
@@ -14,7 +14,7 @@ export type StreamEvent
1414
= | { type: 'text-delta', text: string }
1515
| ({ type: 'finish' } & any)
1616
| ({ type: 'tool-call' } & CompletionToolCall)
17-
| { type: 'tool-result', toolCallId: string, result?: string | ToolMessagePart[] }
17+
| { type: 'tool-result', toolCallId: string, result?: string | CommonContentPart[] }
1818
| { type: 'error', error: any }
1919

2020
export interface StreamOptions {

packages/stage-ui/src/types/chat.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AssistantMessage, CompletionToolCall, SystemMessage, ToolMessage, ToolMessagePart, UserMessage } from '@xsai/shared-chat'
1+
import type { AssistantMessage, CommonContentPart, CompletionToolCall, SystemMessage, ToolMessage, UserMessage } from '@xsai/shared-chat'
22

33
export interface ChatSlicesText {
44
type: 'text'
@@ -13,7 +13,7 @@ export interface ChatSlicesToolCall {
1313
export interface ChatSlicesToolCallResult {
1414
type: 'tool-call-result'
1515
id: string
16-
result?: string | ToolMessagePart[]
16+
result?: string | CommonContentPart[]
1717
}
1818

1919
export type ChatSlices = ChatSlicesText | ChatSlicesToolCall | ChatSlicesToolCallResult
@@ -22,7 +22,7 @@ export interface ChatAssistantMessage extends AssistantMessage {
2222
slices: ChatSlices[]
2323
tool_results: {
2424
id: string
25-
result?: string | ToolMessagePart[]
25+
result?: string | CommonContentPart[]
2626
}[]
2727
}
2828

0 commit comments

Comments
 (0)