fix(chat):建立连接前进行 token 有效性验证
This commit is contained in:
@@ -683,6 +683,10 @@ export const useAgentChatSession = ({
|
||||
async (targetSessionId: string) => {
|
||||
if (isHydrating || isStreaming) return;
|
||||
|
||||
setChatSessions((prev) =>
|
||||
prev.filter((session) => session.id !== targetSessionId),
|
||||
);
|
||||
|
||||
try {
|
||||
const nextActiveSessionId = await deleteChatSession(
|
||||
targetSessionId,
|
||||
@@ -732,6 +736,11 @@ export const useAgentChatSession = ({
|
||||
setChatSessions(sessionsAfterDelete);
|
||||
} catch (error) {
|
||||
console.error("[GlobalChatbox] Failed to delete chat session:", error);
|
||||
try {
|
||||
setChatSessions(await listChatSessions());
|
||||
} catch (refreshError) {
|
||||
console.error("[GlobalChatbox] Failed to refresh chat sessions:", refreshError);
|
||||
}
|
||||
} finally {
|
||||
setIsHydrating(false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user