8000 feat(chat): chat on any page, with the page and highlighted text as context by adeelahmad · Pull Request #61 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(chat): chat on any page, with the page and highlighted text as context - #61

Merged
adeelahmad merged 2 commits into
mainfrom
claude/project-thread-cqy9zg
Oct 3, 2026
Merged

adeelahmad merged 2 commits into
mainfrom
claude/project-thread-cqy9zg

Conversation

@adeelahmad
@adeelahmad adeelahmad commented Oct 3, 2026 •
Copy link
Copy Markdown
Owner

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}/messages takes an optional context (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 stores context (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 with make 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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (pre-commit passes: ruff, mypy, eslint, prettier, tsc, OpenAPI regeneration).
  • I added or updated tests (backend test_asking_from_a_page, test_page_context_reaches_the_tools_too; frontend page-chat.test.tsx).
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/assistant.md).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.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

…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
@adeelahmad adeelahmad self-assigned this Oct 3, 2026
…-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
@adeelahmad
adeelahmad merged commit d7c7512 into main Oct 3, 2026
1 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0