mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 18:46:19 +08:00
fix(core): doc reference error in ai answer (#13141)
Close [AI-303](https://linear.app/affine-design/issue/AI-303) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a new AI configuration hook to streamline AI-related features and integrations. * Integrated enhanced AI specifications into chat components for improved AI chat experiences. * **Refactor** * Updated chat panels to use the new AI configuration hook, simplifying extension management and improving maintainability. * **Chores** * Improved options handling in the editor view extension for more flexible configuration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import { useConfirmModal, useLitPortalFactory } from '@affine/component';
|
||||
import { getViewManager } from '@affine/core/blocksuite/manager/view';
|
||||
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { useFramework, useLiveData, useServices } from '@toeverything/infra';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
import { useEnableAI } from './use-enable-ai';
|
||||
|
||||
export const useAISpecs = () => {
|
||||
const framework = useFramework();
|
||||
const enableAI = useEnableAI();
|
||||
const confirmModal = useConfirmModal();
|
||||
const [reactToLit, _portals] = useLitPortalFactory();
|
||||
|
||||
const { workspaceService, featureFlagService } = useServices({
|
||||
WorkspaceService,
|
||||
FeatureFlagService,
|
||||
});
|
||||
|
||||
const enablePDFEmbedPreview = useLiveData(
|
||||
featureFlagService.flags.enable_pdf_embed_preview.$
|
||||
);
|
||||
|
||||
const isCloud = workspaceService.workspace.flavour !== 'local';
|
||||
|
||||
const specs = useMemo(() => {
|
||||
const manager = getViewManager()
|
||||
.config.init()
|
||||
.foundation(framework)
|
||||
.ai(enableAI, framework)
|
||||
.editorConfig(framework)
|
||||
.editorView({
|
||||
framework,
|
||||
reactToLit,
|
||||
confirmModal,
|
||||
scope: 'workspace',
|
||||
})
|
||||
.cloud(framework, isCloud)
|
||||
.pdf(enablePDFEmbedPreview, reactToLit)
|
||||
.database(framework)
|
||||
.linkedDoc(framework)
|
||||
.paragraph(enableAI)
|
||||
.mobile(framework)
|
||||
.electron(framework)
|
||||
.linkPreview(framework)
|
||||
.codeBlockHtmlPreview(framework).value;
|
||||
|
||||
return manager.get('page');
|
||||
}, [
|
||||
framework,
|
||||
reactToLit,
|
||||
enableAI,
|
||||
enablePDFEmbedPreview,
|
||||
isCloud,
|
||||
confirmModal,
|
||||
]);
|
||||
|
||||
return specs;
|
||||
};
|
||||
Reference in New Issue
Block a user