fix(stage-ui): shallow copy on chat (#926)

This commit is contained in:
이윤진(Lee Yunjin)
2026-01-09 21:39:03 +08:00
committed by GitHub
parent 20c167d790
commit c4915ec15d
2 changed files with 5 additions and 4 deletions
+2 -1
View File
@@ -286,6 +286,7 @@ export const useChatStore = defineStore('chat', () => {
function cleanupMessages(sessionId = activeSessionId.value) {
bumpSessionGeneration(sessionId)
sessionMessages.value[sessionId] = [generateInitialMessage()]
activeContexts.value = {}
// Reject pending sends for this session so callers don't hang after cleanup
for (const queued of pendingQueuedSends.value) {
@@ -358,7 +359,7 @@ export const useChatStore = defineStore('chat', () => {
const sendingCreatedAt = Date.now()
const streamingMessageContext: ChatStreamEventContext = {
input: { role: 'user', content: sendingMessage, createdAt: sendingCreatedAt },
contexts: { ...activeContexts.value },
contexts: toRaw(activeContexts.value),
composedMessage: [],
}
@@ -6,7 +6,7 @@ import { isStageTamagotchi, isStageWeb } from '@proj-airi/stage-shared'
import { useBroadcastChannel } from '@vueuse/core'
import { Mutex } from 'es-toolkit'
import { defineStore } from 'pinia'
import { ref, watch } from 'vue'
import { ref, watch, toRaw } from 'vue'
import { CHAT_STREAM_CHANNEL_NAME, CONTEXT_CHANNEL_NAME, useChatStore } from '../../chat'
import { useModsServerChannelStore } from './channel-server'
@@ -37,7 +37,7 @@ export const useContextBridgeStore = defineStore('mods:api:context-bridge', () =
disposeHookFns.value.push(serverChannelStore.onContextUpdate((event) => {
chatStore.ingestContextMessage({ source: event.source, createdAt: Date.now(), ...event.data })
broadcastContext(event.data as ContextMessage)
broadcastContext(toRaw(event.data) as ContextMessage)
}))
disposeHookFns.value.push(
@@ -45,7 +45,7 @@ export const useContextBridgeStore = defineStore('mods:api:context-bridge', () =
if (isProcessingRemoteStream)
return
broadcastStreamEvent({ type: 'before-compose', message, sessionId: chatStore.activeSessionId, context })
broadcastStreamEvent({ type: 'before-compose', message, sessionId: chatStore.activeSessionId, context: toRaw(context) })
}),
chatStore.onAfterMessageComposed(async (message, context) => {
if (isProcessingRemoteStream)