mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
feat(core): support network search in chat block center peek (#10186)
[BS-2582](https://linear.app/affine-design/issue/BS-2582/chat-block-center-peek-支持-network-search)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { toReactNode } from '@affine/component';
|
||||
import { AIChatBlockPeekViewTemplate } from '@affine/core/blocksuite/presets/ai';
|
||||
import { AINetworkSearchService } from '@affine/core/modules/ai-button/services/network-search';
|
||||
import type { EditorHost } from '@blocksuite/affine/block-std';
|
||||
import { useFramework } from '@toeverything/infra';
|
||||
import { useMemo } from 'react';
|
||||
@@ -17,13 +18,20 @@ export const AIChatBlockPeekView = ({
|
||||
host,
|
||||
}: AIChatBlockPeekViewProps) => {
|
||||
const framework = useFramework();
|
||||
const searchService = framework.get(AINetworkSearchService);
|
||||
return useMemo(() => {
|
||||
const previewSpecBuilder = createPageModePreviewSpecs(framework);
|
||||
const networkSearchConfig = {
|
||||
visible: searchService.visible,
|
||||
enabled: searchService.enabled,
|
||||
setEnabled: searchService.setEnabled,
|
||||
};
|
||||
const template = AIChatBlockPeekViewTemplate(
|
||||
model,
|
||||
host,
|
||||
previewSpecBuilder
|
||||
previewSpecBuilder,
|
||||
networkSearchConfig
|
||||
);
|
||||
return toReactNode(template);
|
||||
}, [framework, model, host]);
|
||||
}, [framework, model, host, searchService]);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user