refine active session live state

This commit is contained in:
mysoul12138
2026-04-19 21:51:25 +08:00
parent 2ea20fc128
commit 7c4b025e6a
3 changed files with 39 additions and 12 deletions
@@ -249,6 +249,10 @@ export const useChatStore = defineStore('chat', () => {
const activeSession = ref<Session | null>(null)
const messages = computed<Message[]>(() => activeSession.value?.messages || [])
function isSessionLive(sessionId: string): boolean {
return streamStates.value.has(sessionId) || resumingRuns.value.has(sessionId)
}
function persistSessionsList() {
// Cache lightweight summaries only (messages are cached per-session).
saveJson(
@@ -912,6 +916,7 @@ export const useChatStore = defineStore('chat', () => {
messages,
isStreaming,
isRunActive,
isSessionLive,
isLoadingSessions,
isLoadingMessages,
newChat,