mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
feat(core): open doc in semantic and keyword result (#13217)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added clickable document titles in AI chat search results, allowing users to open documents directly from chat interactions. * Enhanced interactivity in AI chat by making relevant search result titles visually indicate clickability (pointer cursor). * **Style** * Updated styles to visually highlight clickable search result titles in AI chat results. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -94,6 +94,7 @@ export const Component = () => {
|
||||
const chatToolContainerRef = useRef<HTMLDivElement>(null);
|
||||
const widthSignalRef = useRef<Signal<number>>(signal(0));
|
||||
const client = useCopilotClient();
|
||||
const workbench = useService(WorkbenchService).workbench;
|
||||
|
||||
const workspaceId = useService(WorkspaceService).workspace.id;
|
||||
|
||||
@@ -173,6 +174,13 @@ export const Component = () => {
|
||||
setStatus(context.status ?? 'idle');
|
||||
}, []);
|
||||
|
||||
const onOpenDoc = useCallback(
|
||||
(docId: string) => {
|
||||
workbench.openDoc(docId, { at: 'active' });
|
||||
},
|
||||
[workbench]
|
||||
);
|
||||
|
||||
const confirmModal = useConfirmModal();
|
||||
const specs = useAISpecs();
|
||||
const mockStd = useMockStd();
|
||||
@@ -208,6 +216,7 @@ export const Component = () => {
|
||||
confirmModal.openConfirmModal
|
||||
);
|
||||
content.createSession = createSession;
|
||||
content.onOpenDoc = onOpenDoc;
|
||||
|
||||
if (!chatContent) {
|
||||
// initial values that won't change
|
||||
@@ -232,6 +241,7 @@ export const Component = () => {
|
||||
confirmModal,
|
||||
onContextChange,
|
||||
specs,
|
||||
onOpenDoc,
|
||||
]);
|
||||
|
||||
// init or update header ai-chat-toolbar
|
||||
|
||||
Reference in New Issue
Block a user