fix(stage-web): incorrect type for ChatHistoryItem
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChatHistoryMessage } from '@proj-airi/stage-ui/components'
|
||||
import type { ChatHistoryItem } from '@proj-airi/stage-ui/types/chat'
|
||||
import type { ChatProvider } from '@xsai-ext/shared-providers'
|
||||
|
||||
import { ChatHistory } from '@proj-airi/stage-ui/components'
|
||||
@@ -155,7 +155,7 @@ onAfterMessageComposed(async () => {
|
||||
attachments.value = []
|
||||
})
|
||||
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryMessage[])
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryItem[])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChatHistoryMessage } from '@proj-airi/stage-ui/components'
|
||||
import type { ChatHistoryItem } from '@proj-airi/stage-ui/types/chat'
|
||||
|
||||
import { ChatHistory } from '@proj-airi/stage-ui/components'
|
||||
import { useChatStore } from '@proj-airi/stage-ui/stores/chat'
|
||||
@@ -15,7 +15,7 @@ const { isReady } = useDeferredMount()
|
||||
const { messages, sending, streamingMessage } = storeToRefs(useChatStore())
|
||||
|
||||
const isLoading = ref(true)
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryMessage[])
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryItem[])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChatHistoryMessage } from '@proj-airi/stage-ui/components'
|
||||
import type { ChatHistoryItem } from '@proj-airi/stage-ui/types/chat'
|
||||
import type { ChatProvider } from '@xsai-ext/shared-providers'
|
||||
|
||||
import { ChatHistory, HearingConfigDialog } from '@proj-airi/stage-ui/components'
|
||||
@@ -27,7 +27,7 @@ const { isDark, toggleDark } = useTheme()
|
||||
const hearingDialogOpen = ref(false)
|
||||
const chatStore = useChatStore()
|
||||
const { messages, sending, streamingMessage } = storeToRefs(chatStore)
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryMessage[])
|
||||
const historyMessages = computed(() => messages.value as unknown as ChatHistoryItem[])
|
||||
|
||||
const viewControlsActiveMode = ref<'x' | 'y' | 'z' | 'scale'>('scale')
|
||||
const viewControlsInputsRef = useTemplateRef<InstanceType<typeof ViewControlInputs>>('viewControlsInputs')
|
||||
|
||||
@@ -33,7 +33,9 @@
|
||||
"./workers/*": "./src/workers/*.ts",
|
||||
"./workers": "./src/workers/index.ts",
|
||||
"./utils": "./src/utils/index.ts",
|
||||
"./utils/tts": "./src/utils/tts.ts"
|
||||
"./utils/tts": "./src/utils/tts.ts",
|
||||
"./types/*": "./src/types/*.ts",
|
||||
"./types": "./src/types/index.ts"
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "vue-tsc --noEmit",
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { ChatAssistantMessage } from '../../../types/chat'
|
||||
import type { ChatHistoryMessage } from './types'
|
||||
import type { ChatAssistantMessage, ChatHistoryItem } from '../../../types/chat'
|
||||
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import ChatHistory from './ChatHistory.vue'
|
||||
|
||||
const markdownMessages = ref<ChatHistoryMessage[]>([
|
||||
const markdownMessages = ref<ChatHistoryItem[]>([
|
||||
{
|
||||
role: 'user',
|
||||
content: 'Hey AIRI, can you summarize today\'s tasks?',
|
||||
@@ -30,7 +29,7 @@ const markdownMessages = ref<ChatHistoryMessage[]>([
|
||||
},
|
||||
])
|
||||
|
||||
const toolHeavyMessages = computed<ChatHistoryMessage[]>(() => [
|
||||
const toolHeavyMessages = computed<ChatHistoryItem[]>(() => [
|
||||
{
|
||||
role: 'user',
|
||||
content: 'Grab the weather for Tokyo and Osaka.',
|
||||
@@ -47,7 +46,7 @@ const toolHeavyMessages = computed<ChatHistoryMessage[]>(() => [
|
||||
},
|
||||
])
|
||||
|
||||
const errorMessages = ref<ChatHistoryMessage[]>([
|
||||
const errorMessages = ref<ChatHistoryItem[]>([
|
||||
{
|
||||
role: 'user',
|
||||
content: 'Push the deployment now.',
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ChatEntry } from '../stores/chat'
|
||||
import type { ChatHistoryItem } from '../types/chat'
|
||||
|
||||
import { isStageTamagotchi } from '@proj-airi/stage-shared'
|
||||
|
||||
@@ -67,11 +67,11 @@ export function useDataMaintenance() {
|
||||
|
||||
function importChatSessions(payload: Record<string, unknown>) {
|
||||
const normalizedPayload = payload as Record<string, unknown>
|
||||
const sessions: Record<string, ChatEntry[]> = {}
|
||||
const sessions: Record<string, ChatHistoryItem[]> = {}
|
||||
|
||||
for (const [sessionId, messages] of Object.entries(normalizedPayload)) {
|
||||
if (Array.isArray(messages))
|
||||
sessions[sessionId] = messages as ChatEntry[]
|
||||
sessions[sessionId] = messages as ChatHistoryItem[]
|
||||
}
|
||||
|
||||
chatStore.replaceSessions(sessions)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
export * from './chat'
|
||||
Reference in New Issue
Block a user