mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
feat(core): remove chat-panel component's dependency on doc (#12975)
Close [AI-259](https://linear.app/affine-design/issue/AI-259) Close [AI-243](https://linear.app/affine-design/issue/AI-243) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a unified AI chat content component to manage and display chat interactions. * Added new chat block message components for improved chat message rendering. * **Refactor** * Simplified and unified session management across all AI chat components, now passing full session objects instead of session IDs. * Updated component and property names for clarity and consistency (e.g., chat message and block message components). * Consolidated chat history and actions retrieval for a more streamlined chat experience. * Removed redundant session ID getters and replaced them with direct session object usage. * Streamlined chat panel and composer components by removing internal message and context state management. * **Bug Fixes** * Improved handling of chat session state and loading, reducing redundant state properties. * Enhanced event handling to prevent errors when chat parameters are missing. * **Tests** * Removed outdated chat clearing test cases to align with new chat state management. * **Chores** * Updated import paths and reorganized module exports for better maintainability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Scrollable } from '@affine/component';
|
||||
import { PageDetailLoading } from '@affine/component/page-detail-skeleton';
|
||||
import type { ChatPanel } from '@affine/core/blocksuite/ai';
|
||||
import type { AIChatParams, ChatPanel } from '@affine/core/blocksuite/ai';
|
||||
import { AIProvider } from '@affine/core/blocksuite/ai';
|
||||
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
|
||||
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
|
||||
@@ -119,7 +119,10 @@ const DetailPageImpl = memo(function DetailPageImpl() {
|
||||
|
||||
useEffect(() => {
|
||||
const disposables: Subscription[] = [];
|
||||
const openHandler = () => {
|
||||
const openHandler = (params: AIChatParams | null) => {
|
||||
if (!params) {
|
||||
return;
|
||||
}
|
||||
workbench.openSidebar();
|
||||
view.activeSidebarTab('chat');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user