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:
Cats Juice
2025-07-15 16:06:17 +08:00
committed by GitHub
parent 613597e642
commit cd91bea5c1
9 changed files with 61 additions and 5 deletions
@@ -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