mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-04 08:38:34 +00:00
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';
|
||||
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();
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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();
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user