fix(core): missing hide edgeless copilot panel logic (#13445)

Close [AI-409](https://linear.app/affine-design/issue/AI-409)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* Improved the behavior when continuing in AI Chat by ensuring the
copilot panel is properly hidden before switching panels for a smoother
user experience.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Wu Yue
2025-08-08 16:37:49 +08:00
committed by GitHub
parent 5fd7dfc8aa
commit 4005f40b16
2 changed files with 9 additions and 1 deletions

View File

@@ -38,6 +38,7 @@ import type {
} from '../components/ai-item/types';
import { AIProvider } from '../provider';
import { getAIPanelWidget } from '../utils/ai-widgets';
import { getEdgelessCopilotWidget } from '../utils/get-edgeless-copilot-widget';
import {
AIImageIconWithAnimation,
AIPenIconWithAnimation,
@@ -384,10 +385,12 @@ const OthersAIGroup: AIItemGroupConfig = {
icon: CommentIcon(),
handler: host => {
const panel = getAIPanelWidget(host);
const edgelessCopilot = getEdgelessCopilotWidget(host);
AIProvider.slots.requestOpenWithChat.next({
host,
autoSelect: true,
});
edgelessCopilot.hideCopilotPanel();
panel.hide();
},
},

View File

@@ -51,7 +51,10 @@ import {
import type { AIItemGroupConfig } from '../../components/ai-item/types';
import { AIProvider } from '../../provider';
import { getAIPanelWidget } from '../../utils/ai-widgets';
import { mindMapToMarkdown } from '../../utils/edgeless';
import {
getEdgelessCopilotWidget,
mindMapToMarkdown,
} from '../../utils/edgeless';
import { extractSelectedContent } from '../../utils/extract';
import { canvasToBlob, randomSeed } from '../../utils/image';
import {
@@ -115,6 +118,7 @@ const othersGroup: AIItemGroupConfig = {
showWhen: () => true,
handler: host => {
const panel = getAIPanelWidget(host);
const edgelessCopilot = getEdgelessCopilotWidget(host);
extractSelectedContent(host)
.then(context => {
AIProvider.slots.requestOpenWithChat.next({
@@ -125,6 +129,7 @@ const othersGroup: AIItemGroupConfig = {
});
})
.catch(console.error);
edgelessCopilot.hideCopilotPanel();
panel.hide();
},
},