* 每次 ChatExplorer 挂载时调用。 * 如果存在有效的记忆助手则直接进入对应助手,否则回到助手选择页。 * 从浮动任务条返回(pendingFocusReturn)时跳过重置以保留对话状态。
(chatKey: string)
| 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) |
nothing calls this directly
no test coverage detected