JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(session): 修复恢复会话按钮不可用以及性能模式下发送消息卡住
openJiuwen-bot4f30c5a98ea9
diff --git a/jiuwenswarm/channels/web/frontend/src/App.tsx b/jiuwenswarm/channels/web/frontend/src/App.tsxindex 526cc9ed86..3d726697f3 100644--- a/jiuwenswarm/channels/web/frontend/src/App.tsx+++ b/jiuwenswarm/channels/web/frontend/src/App.tsx@@ -647,7 +647,16 @@ function AppContent() {// 仅处理以 sess_ 开头的会话 IDif (!sessionId.startsWith('sess_')) return;-++ // 新建会话时跳过历史加载+ const isNew = useChatStore.getState().isNewSession;+ if (isNew) {+ useChatStore.getState().setNewSession(false);+ setHistoryPagerMeta(null); // 新会话无历史,不显示分页栏+ setLoadingHistory(false);+ return;+ }+// 清理之前的历史加载句柄disposeInFlightHistoryHandles();setHistoryPagerMeta(null);@@ -829,6 +838,7 @@ function AppContent() {}// 切换模式/新建会话时直接设置状态,避免闪现useChatStore.getState().setSwitchingMode(true);+ useChatStore.getState().setNewSession(true); // 标记新建会话,跳过历史加载useChatStore.getState().setInterruptResult(null);useChatStore.getState().setProcessing(false);useChatStore.getState().setThinking(false);diff --git a/jiuwenswarm/channels/web/frontend/src/stores/chatStore.ts b/jiuwenswarm/channels/web/frontend/src/stores/chatStore.tsindex 6d39a7f336..0689e5cafb 100644--- a/jiuwenswarm/channels/web/frontend/src/stores/chatStore.ts+++ b/jiuwenswarm/channels/web/frontend/src/stores/chatStore.ts@@ -61,6 +61,7 @@ interface ChatState {pausedTask: string | null; // 暂停的任务描述interruptResult: InterruptResultPayload | null; // 最近的中断结果switchingMode: boolean; // 是否正在切换模式+ isNewSession: boolean; // 是否刚创建新会话(跳过历史加载)currentStreamContent: string;currentStreamId: string | null;streamBuffers: Map<string, string>;@@ -92,6 +93,7 @@ interface ChatState {setPaused: (paused: boolean, task?: string | null) => void;setInterruptResult: (result: InterruptResultPayload | null) => void;setSwitchingMode: (switching: boolean) => void;+ setNewSession: (isNew: boolean) => void;addToolCall: (toolCall: ToolCall, options?: { startedAt?: string }) => void;addToolResult: (toolResult: ToolResult, options?: { updatedAt?: string }) => void;markTimedOutExecutions: () => void;@@ -124,6 +126,7 @@ export const useChatStore = create<ChatState>((set, get) => ({pausedTask: null,interruptResult: null,switchingMode: false,+ isNewSession: false,currentStreamContent: '',currentStreamId: null,streamBuffers: new Map(),@@ -247,7 +250,7 @@ export const useChatStore = create<ChatState>((set, get) => ({setSwitchingMode: (switching) => {// 切换模式时,同时重置所有相关状态if (switching) {- set({+ set({switchingMode: true,isProcessing: false,isPaused: false,@@ -259,6 +262,10 @@ export const useChatStore = create<ChatState>((set, get) => ({}},+ setNewSession: (isNew) => {+ set({ isNewSession: isNew });+ },+addToolCall: (toolCall, options) => {set((state) => {if (!toolCall.id) {