mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 17:19:56 +08:00
fix: chat session cannot delete (#14312)
fix #14309 #### PR Dependency Tree * **PR #14312** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added AI chat session deletion with confirmation dialogs and success/failure notifications. * Localized AI chat panel labels, loading messages, and session management text across multiple languages. * **Documentation** * Added internationalization support for chat panel titles, history loading states, and deletion confirmations. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
import type { CopilotChatHistoryFragment } from '@affine/graphql';
|
||||
import type { NotificationService } from '@blocksuite/affine/shared/services';
|
||||
|
||||
import type { DocDisplayConfig } from '../ai-chat-chips';
|
||||
import type { ChatStatus } from '../ai-chat-messages';
|
||||
import { AIChatToolbar } from './ai-chat-toolbar';
|
||||
|
||||
export type ConfigureAIChatToolbarOptions = {
|
||||
session: CopilotChatHistoryFragment | null | undefined;
|
||||
workspaceId: string;
|
||||
docId?: string;
|
||||
status: ChatStatus;
|
||||
docDisplayConfig: DocDisplayConfig;
|
||||
notificationService: NotificationService;
|
||||
onNewSession: () => void;
|
||||
onTogglePin: () => Promise<void>;
|
||||
onOpenSession: (sessionId: string) => void;
|
||||
onOpenDoc: (docId: string, sessionId: string) => void;
|
||||
onSessionDelete: (session: BlockSuitePresets.AIRecentSession) => void;
|
||||
};
|
||||
|
||||
export function getOrCreateAIChatToolbar(
|
||||
current: AIChatToolbar | null | undefined
|
||||
): AIChatToolbar {
|
||||
return current ?? new AIChatToolbar();
|
||||
}
|
||||
|
||||
export function configureAIChatToolbar(
|
||||
tool: AIChatToolbar,
|
||||
options: ConfigureAIChatToolbarOptions
|
||||
): AIChatToolbar {
|
||||
tool.session = options.session;
|
||||
tool.workspaceId = options.workspaceId;
|
||||
tool.docId = options.docId;
|
||||
tool.status = options.status;
|
||||
tool.docDisplayConfig = options.docDisplayConfig;
|
||||
tool.notificationService = options.notificationService;
|
||||
tool.onNewSession = options.onNewSession;
|
||||
tool.onTogglePin = options.onTogglePin;
|
||||
tool.onOpenSession = options.onOpenSession;
|
||||
tool.onOpenDoc = options.onOpenDoc;
|
||||
tool.onSessionDelete = options.onSessionDelete;
|
||||
return tool;
|
||||
}
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './ai-chat-toolbar';
|
||||
export * from './ai-session-history';
|
||||
export * from './configure-ai-chat-toolbar';
|
||||
|
||||
Reference in New Issue
Block a user