From 64e3de9ada7c572ebd15606a941b5d1d17ec75ef Mon Sep 17 00:00:00 2001 From: icarus Date: Fri, 19 Sep 2025 16:27:50 +0800 Subject: [PATCH] feat(chat): add activeTopicOrSession state to track current view Add new state field and action to track whether the user is viewing topics or sessions in the chat interface. This enables proper UI state management when switching between views. --- src/renderer/src/store/runtime.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/renderer/src/store/runtime.ts b/src/renderer/src/store/runtime.ts index 253361cf9b..41e9a71b90 100644 --- a/src/renderer/src/store/runtime.ts +++ b/src/renderer/src/store/runtime.ts @@ -13,6 +13,7 @@ export interface ChatState { /** UI state. Map agent id to active session id. * null represents no active session */ activeSessionId: Record + activeTopicOrSession: 'topic' | 'session' activeTabId: Tab /** topic ids that are currently being renamed */ renamingTopics: string[] @@ -87,6 +88,7 @@ const initialState: RuntimeState = { activeTabId: 'assistants', activeTopic: null, activeAgentId: null, + activeTopicOrSession: 'topic', activeSessionId: {}, renamingTopics: [], newlyRenamedTopics: [] @@ -162,6 +164,9 @@ const runtimeSlice = createSlice({ setActiveTabIdAction: (state, action: PayloadAction) => { state.chat.activeTabId = action.payload }, + setActiveTopicOrSessionAction: (state, action: PayloadAction<'topic' | 'session'>) => { + state.chat.activeTopicOrSession = action.payload + }, setRenamingTopics: (state, action: PayloadAction) => { state.chat.renamingTopics = action.payload }, @@ -203,6 +208,7 @@ export const { setActiveAgentId, setActiveSessionIdAction, setActiveTabIdAction, + setActiveTopicOrSessionAction, setRenamingTopics, setNewlyRenamedTopics, // WebSearch related actions