Repository navigation
feat(chat): chat on any page, with the page and highlighted text as context - #61
Merged
Merged
Conversation
…ontext A panel beside every page (full screen on phones) whose conversation follows you between pages until New chat. Each question can share the page's text and text highlighted on it (Ask about this, above any selection); the model reads them with the question, and the question keeps the page and the highlight. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GJVyr2QAsSs5Ek3HgtgaT8
…-cqy9zg # Conflicts: # fastapi_backend/app/api/v1/routes/chats.py # fastapi_backend/app/domain/chat.py # fastapi_backend/app/schemas/chats.py # fastapi_backend/tests/api/test_chats.py # nextjs-frontend/app/openapi-client/types.gen.ts # nextjs-frontend/components/chat/chat-app.tsx # nextjs-frontend/openapi.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: chat lived only on the Chat page (and a recording's own chat tab). Asking about what you were looking at meant leaving the page and describing it.
After: every page except Chat has an Ask button that opens a chat panel beside the page (full screen on phones). The conversation follows you between pages, and across visits in the same browser, until New chat. Each question can share the page's text (a page chip, on by default, click to turn off) and text highlighted on the page: selecting text anywhere shows Ask about this, which attaches the quote. Questions show where they were asked from (a link back to the page) and the quote, here and in Chat. The panel conversation is an ordinary conversation, so Open in Chat shows it in full.
How:
POST /chats/{cid}/messagestakes an optionalcontext(url,title,text,selection). The model reads it with the question (up to 12,000 characters of page text and 4,000 of the highlight), marked as what the person is looking at rather than citable excerpts, on both the tool and plain paths. When the page's text was shared, a model's direct answer (no tool calls) stands instead of falling back to an archive search, since it answered from the page. The question message storescontext(address, title, highlight, and whether the page was shared; not the page text), and follow-ups keep the start of an earlier highlight. A recording's transcript and document keep their own selection toolbar (data-own-selection), whose Ask in chat still goes to the recording's chat. OpenAPI and client regenerated withmake openapi.Motivation and Context
Adeel asked for chat on any page, sharing the page or a highlighted part, persisting across pages until New chat.
Screenshots (if appropriate):
Checked in a browser (Playwright) on desktop and at phone width: launcher, Ask about this over a selection, the answer with the shared page and quote above the question, and the same conversation on the Library page afterwards.
Types of changes
!in the title)Checklist:
test_asking_from_a_page,test_page_context_reaches_the_tools_too; frontendpage-chat.test.tsx).docs/accordingly (docs/assistant.md).## UnreleasedinCHANGELOG.md.Local suites after merging main (aa7e785): frontend 578/578 pass. Backend 392 pass, 1 fails (
test_office_and_text_files_become_documents: LibreOffice can't load the file in this environment; it fails the same way on main). Merged on local checks with Adeel's approval while the CI runners are down.🤖 Generated with Claude Code
https://claude.ai/code/session_01GJVyr2QAsSs5Ek3HgtgaT8