mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 05:25:53 +08:00
refactor(core): workbench (#7355)
Merge the right sidebar logic into the workbench. this can simplify our logic. Previously we had 3 modules * workbench * right-sidebar (Control sidebar open&close) * multi-tab-sidebar (Control tabs) Now everything is managed in Workbench. # Behavioral changes The sidebar button is always visible and can be opened at any time. If there is no content to display, will be `No Selection`  Elements in the sidebar can now be defined as`unmountOnInactive=false`. Inactive sidebars are marked with `display: none` but not unmount, so the `ChatPanel` can always remain in the DOM and user input will be retained even if the sidebar is closed.
This commit is contained in:
@@ -2,8 +2,6 @@ import type { EditorHost } from '@blocksuite/block-std';
|
||||
import { PaymentRequiredError, UnauthorizedError } from '@blocksuite/blocks';
|
||||
import { Slot } from '@blocksuite/store';
|
||||
|
||||
import type { ChatCards } from './chat-panel/chat-cards';
|
||||
|
||||
export interface AIUserInfo {
|
||||
id: string;
|
||||
email: string;
|
||||
@@ -72,19 +70,6 @@ export class AIProvider {
|
||||
return AIProvider.instance.toggleGeneralAIOnboarding;
|
||||
}
|
||||
|
||||
static genRequestChatCardsFn(params: AIChatParams) {
|
||||
return async (chatPanel: HTMLElement) => {
|
||||
const chatCards: ChatCards | null = await new Promise(resolve =>
|
||||
requestAnimationFrame(() =>
|
||||
resolve(chatPanel.querySelector('chat-cards'))
|
||||
)
|
||||
);
|
||||
if (!chatCards) return;
|
||||
if (chatCards.temporaryParams) return;
|
||||
chatCards.temporaryParams = params;
|
||||
};
|
||||
}
|
||||
|
||||
private static readonly instance = new AIProvider();
|
||||
|
||||
static LAST_ACTION_SESSIONID = '';
|
||||
|
||||
Reference in New Issue
Block a user