8000 feat(chat): thumbs up or down on answers by adeelahmad · Pull Request #702 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(chat): thumbs up or down on answers - #702

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-0q8r3r
Oct 20, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-0q8r3r

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: there was no way to say an answer was good or bad, so nothing recorded which answers worked.

After: a finished answer in chat has a thumbs up and a thumbs down. Pressing one saves it, pressing it again takes it back (no confirm). The rating is saved on the answer, shown when the conversation opens on any device, and carried in the conversation's JSON export (lens.rating). Agents rate the same way with PUT /api/v1/chats/{cid}/messages/{mid}/rating (up, down or null) or the new MCP tool rate_answer (up, down, clear), and read it back from GET /chats/{cid} and read_chat.

How: an optional rating (and rated_at) on the schemaless chat_message table, set by chat.rate(), which only accepts the owner's assistant messages. Answer shows the buttons with an optimistic update that rolls back on error.

Motivation and Context

Planned in the fine-tuning design (§3.2, "thumbs up/down on assistant answers"): it is the label the dataset builder's sft recipe keeps good answers by. Listed in whats-left section D.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project.
  • I added or updated tests (tests/api/test_chat_ratings.py, __tests__/chat-rating.test.tsx, MCP write-tool list).
  • Docs updated: docs/assistant.md#rating-answers, docs/api.md, docs/mcp.md, README built list, docs/requirements.md.
  • Changelog fragment changelog.d/rate-answers.md.

Done questions (AGENTS.md)

  • Goal: delivers what the user wanted, merged on green CI (merging on green).
  • Agents: REST PUT .../rating and MCP rate_answer; read_chat returns it.
  • Zero setup: nothing new to install or set.
  • Fewest clicks: one click to rate, the same click to take it back, no dialog.
  • Configurable: n/a, no new setting.
  • Light: n/a, one field on an existing table, no new component.
  • Private and secure: stored locally on the message; only the conversation's owner can rate (404 for others, write scope for tokens). No new outside surface, so no threat-model change.
  • Cost: no model call.
  • User decides: the rating changes nothing about the answer; existing defaults unchanged.
  • Upgrades: schemaless table and an optional field, older answers read as unrated; no upgrade step needed.
  • Honest: listed as built only with its checks.
  • Tests, docs and generated files updated (make openapi).
  • Open standards: n/a; no new dependencies.
  • Reported with evidence. Refine later: thumbs reactions from Matterbridge rooms and Telegram/Slack answers; the dataset builder reading ratings.
  • Reuse: follows the existing source-check endpoint, _own_chat, and IconButton's active state.

Generated by Claude Code

Saved on the answer, shown when the conversation opens, carried in its JSON
export, and given by agents with PUT .../messages/{mid}/rating or the MCP tool
rate_answer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YUXoQ6nuvTZdkDZn3xUoaj
@adeelahmad adeelahmad self-assigned this Oct 20, 2026
@adeelahmad
adeelahmad merged commit 405005e into main Oct 20, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-0q8r3r branch October 20, 2026 02:55
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