MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / resetToSelectorOnEnter

Function resetToSelectorOnEnter

src/stores/aiChat.ts:584–601  ·  view source on GitHub ↗

* 每次 ChatExplorer 挂载时调用。 * 如果存在有效的记忆助手则直接进入对应助手,否则回到助手选择页。 * 从浮动任务条返回(pendingFocusReturn)时跳过重置以保留对话状态。

(chatKey: string)

Source from the content-addressed store, hash-verified

582 * 从浮动任务条返回(pendingFocusReturn)时跳过重置以保留对话状态。
583 */
584 async function resetToSelectorOnEnter(chatKey: string): Promise<void> {
585 if (pendingFocusReturn) {
586 pendingFocusReturn = false
587 return
588 }
589 const state = getSessionState(chatKey)
590 if (!state || state.isAIThinking) return
591
592 if (!assistantStore.isLoaded) {
593 await assistantStore.loadAssistants()
594 }
595
596 if (!state.selectedAssistantId) {
597 const defaultId = getDefaultGeneralAssistantId(state.locale)
598 selectAssistantForSession(chatKey, defaultId)
599 }
600 startNewAIChat(chatKey)
601 }
602
603 function startNewAIChat(chatKey: string, welcomeMessage?: string): boolean {
604 const state = getSessionState(chatKey)

Callers

nothing calls this directly

Calls 4

getSessionStateFunction · 0.85
startNewAIChatFunction · 0.85

Tested by

no test coverage detected