From 66b45e7d27314571d2e3a74f96175f4728f89ae8 Mon Sep 17 00:00:00 2001 From: Lukas Parsons Date: Tue, 7 Jul 2026 14:00:30 -0400 Subject: [PATCH] fix: document Chat button now sends title+reference only (no content snippet) Removed the 120-char snippet preview from the _sendToChat() reference. The injected text is now clean: [Title](#document-). Also captured Deep Research 'Send to Chat' reference injection feature to task board. --- docs/improvement-tasks.md | 3 +++ static/js/document.js | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/improvement-tasks.md b/docs/improvement-tasks.md index 393edaa4..991e54c7 100644 --- a/docs/improvement-tasks.md +++ b/docs/improvement-tasks.md @@ -24,6 +24,9 @@ Last updated: 2026-07-07 - A `grep_documents` or `search_documents` tool for semantic/fulltext search - Auto-inject active document content into agent context when relevant +- [ ] **Deep Research: "Send to Chat" reference injection (not just new-chat Discuss)** + The only way to link research to chat is the "Discuss" button, which creates a brand-new session via `/api/research/spinoff`. Need a second button to inject a research reference (`[Title](#research-)`) into the currently active chat's message input, matching the document "Chat" button pattern. Applies to: research panel sidebar (panel.js:1012), research library cards (documentLibrary.js:2767), and the inline result message (chatRenderer.js:1070). + - [ ] **First-party document support in agent mode** Documents feel "disjointed from the agent." The agent creates documents fine but can't easily discover or reference existing ones contextually. Ideas: - "Agent workspace" awareness — automatically surface relevant documents based on chat context diff --git a/static/js/document.js b/static/js/document.js index 6d58ba7e..5bdc168e 100644 --- a/static/js/document.js +++ b/static/js/document.js @@ -671,9 +671,7 @@ import { bindMenuDismiss, dismissOrRemove } from './escMenuStack.js'; if (!activeDocId) return; const doc = docs.get(activeDocId); if (!doc) return; - const content = typeof doc.content === 'string' ? doc.content : ''; - const snippet = content.substring(0, 120).replace(/\n/g, ' '); - const ref = `[${doc.title || 'Untitled'}](#document-${activeDocId})${snippet ? ' — ' + snippet + (content.length > 120 ? '...' : '') : ''}`; + const ref = `[${doc.title || 'Untitled'}](#document-${activeDocId})`; const msgEl = document.getElementById('message'); if (!msgEl) return; const current = msgEl.value.trim();