feat(chat): add Re-run button to the vision text editor - #5968
Conversation
The vision-text endpoint already accepts force=1 to recompute an image description, but the editor only ever fetches the cached value — there is no way to regenerate a caption after switching Vision models. Adds a Re-run button beside Close that calls the existing endpoint with force=1 and loads the result into the textarea. Co-Authored-By: Claude <noreply@anthropic.com>
a7cc1e7 to
e3c72e9
Compare
RaresKeY
left a comment
There was a problem hiding this comment.
I checked the latest head and found one issue in the regenerate path.
Findings
issue (chat): Regenerate message now appends instead of replacing from the edited turn
-
Problem: This change removes
{ replaceFromHere: true }from the existing vision-editor regenerate call.resendUserMessagedefaults that option to false, so “Regenerate message” takes the ordinary non-destructive resend path. -
Impact: Saving edited vision text and regenerating keeps the later conversation and appends another response instead of regenerating from that turn. The current pytest run fails the existing caller-contract test for this behavior.
-
Ask: Restore
window.chatModule.resendUserMessage(userMsgEl, { replaceFromHere: true });; the new Re-run action does not require changing this call. -
Location:
static/js/chatRenderer.js:367
Validation
- Current CI reproduces this exactly:
test_only_regenerate_callers_opt_into_replace_from_herefails with1 failed, 4897 passed, 4 skipped; JavaScript syntax and the other current checks pass.
Re-run button change accidentally dropped { replaceFromHere: true }
from the existing regenerate-message resend call, so saving edited
vision text and regenerating appended instead of truncating from that
turn. Restores the flag; addresses RaresKeY's review on PR odysseus-dev#5968.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B7CCswF8829EVJuHWqjpC2
|
That was accidental scope creep from wiring up the new Re-run button, not intentional. Restored |
Summary
GET /api/upload/{file_id}/visionalready acceptsforce=1to bypass the cached description and re-run the vision model, but nothing in the UI ever passes it —_openVisionEditorfetches the endpoint without the parameter, so the editor can only ever show the cached text. There is currently no way to regenerate a description after switching the Vision model in Settings, or after a first run produced a poor result. Adds a Re-run button beside Close that calls the existing endpoint withforce=1and loads the result into the textarea. No new endpoint, no backend change.Note:
get_vision_textalready calls_sync_gallery_caption_for_uploadon both the cached and recomputed paths, so a re-run also refreshes the image's gallery caption. That is pre-existing endpoint behaviour — this PR only surfaces theforce=1path that was already implemented.Target branch
dev, notmainLinked Issue
Fixes #5983
Type of Change
Checklist
devdocker compose uporuvicorn app:app) and verified the change works end-to-end. Type-checks and unit tests are not enough.How to Test
Verified against two models in sequence (
qwen3-vl:8b-instructand a Gemma 4 build) — the re-run returns visibly different text for the same image, confirming it is hitting the model rather than the cache.Environment tested: Docker deployment, Ollama backend, Ubuntu, Firefox.
Visual / UI changes — REQUIRED if you touched anything that renders
vision-editor-btnclass already used by Close in the same row — no new CSS, no new color values, font sizes, or spacing units. The icon is an inline monochrome SVG matching the stroke style of the existing editor icons. No emoji. No font overrides. No hard-coded theme values.actionsrow alongside Close / Save / Regenerate message; nothing parallel was introduced.Co-Authored-Bytrailer.Screenshots / clips