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:
@@ -38,6 +38,7 @@ import type {
|
|||||||
} from '../components/ai-item/types';
|
} from '../components/ai-item/types';
|
||||||
import { AIProvider } from '../provider';
|
import { AIProvider } from '../provider';
|
||||||
import { getAIPanelWidget } from '../utils/ai-widgets';
|
import { getAIPanelWidget } from '../utils/ai-widgets';
|
||||||
|
import { getEdgelessCopilotWidget } from '../utils/get-edgeless-copilot-widget';
|
||||||
import {
|
import {
|
||||||
AIImageIconWithAnimation,
|
AIImageIconWithAnimation,
|
||||||
AIPenIconWithAnimation,
|
AIPenIconWithAnimation,
|
||||||
@@ -384,10 +385,12 @@ const OthersAIGroup: AIItemGroupConfig = {
|
|||||||
icon: CommentIcon(),
|
icon: CommentIcon(),
|
||||||
handler: host => {
|
handler: host => {
|
||||||
const panel = getAIPanelWidget(host);
|
const panel = getAIPanelWidget(host);
|
||||||
|
const edgelessCopilot = getEdgelessCopilotWidget(host);
|
||||||
AIProvider.slots.requestOpenWithChat.next({
|
AIProvider.slots.requestOpenWithChat.next({
|
||||||
host,
|
host,
|
||||||
autoSelect: true,
|
autoSelect: true,
|
||||||
});
|
});
|
||||||
|
edgelessCopilot.hideCopilotPanel();
|
||||||
panel.hide();
|
panel.hide();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -51,7 +51,10 @@ import {
|
|||||||
import type { AIItemGroupConfig } from '../../components/ai-item/types';
|
import type { AIItemGroupConfig } from '../../components/ai-item/types';
|
||||||
import { AIProvider } from '../../provider';
|
import { AIProvider } from '../../provider';
|
||||||
import { getAIPanelWidget } from '../../utils/ai-widgets';
|
import { getAIPanelWidget } from '../../utils/ai-widgets';
|
||||||
import { mindMapToMarkdown } from '../../utils/edgeless';
|
import {
|
||||||
|
getEdgelessCopilotWidget,
|
||||||
|
mindMapToMarkdown,
|
||||||
|
} from '../../utils/edgeless';
|
||||||
import { extractSelectedContent } from '../../utils/extract';
|
import { extractSelectedContent } from '../../utils/extract';
|
||||||
import { canvasToBlob, randomSeed } from '../../utils/image';
|
import { canvasToBlob, randomSeed } from '../../utils/image';
|
||||||
import {
|
import {
|
||||||
@@ -115,6 +118,7 @@ const othersGroup: AIItemGroupConfig = {
|
|||||||
showWhen: () => true,
|
showWhen: () => true,
|
||||||
handler: host => {
|
handler: host => {
|
||||||
const panel = getAIPanelWidget(host);
|
const panel = getAIPanelWidget(host);
|
||||||
|
const edgelessCopilot = getEdgelessCopilotWidget(host);
|
||||||
extractSelectedContent(host)
|
extractSelectedContent(host)
|
||||||
.then(context => {
|
.then(context => {
|
||||||
AIProvider.slots.requestOpenWithChat.next({
|
AIProvider.slots.requestOpenWithChat.next({
|
||||||
@@ -125,6 +129,7 @@ const othersGroup: AIItemGroupConfig = {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
edgelessCopilot.hideCopilotPanel();
|
||||||
panel.hide();
|
panel.hide();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user