mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
优化新建会话不执行,关闭后删除untitled session
优化新建会话不执行,关闭后删除untitled session,避免出现很多无效会话
This commit is contained in:
parent
eddaec547e
commit
ca94ed9640
@ -12,6 +12,7 @@ import {
|
||||
} from '../../stores/tabStore'
|
||||
import { useChatStore } from '../../stores/chatStore'
|
||||
import { useSessionStore } from '../../stores/sessionStore'
|
||||
import { isPlaceholderSessionTitle } from '../../lib/sessionTitle'
|
||||
import { useWorkspacePanelStore } from '../../stores/workspacePanelStore'
|
||||
import { useTerminalPanelStore } from '../../stores/terminalPanelStore'
|
||||
import { useTranslation } from '../../i18n'
|
||||
@ -186,6 +187,12 @@ export function TabBar() {
|
||||
useChatStore.getState().stopGeneration(tab.sessionId)
|
||||
}
|
||||
if (!isRunning || stopRunning) {
|
||||
// Auto-delete empty sessions (placeholder title, no messages sent)
|
||||
const sessionEntry = useSessionStore.getState().sessions.find((s) => s.id === tab.sessionId)
|
||||
const chatEntry = useChatStore.getState().sessions[tab.sessionId]
|
||||
if (isPlaceholderSessionTitle(sessionEntry?.title) && (!chatEntry || chatEntry.messages.length === 0)) {
|
||||
void useSessionStore.getState().deleteSession(tab.sessionId)
|
||||
}
|
||||
disconnectSession(tab.sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user