Repository navigation
Name assistant-generated images even when the plan omits "alt" - #203
Merged
Merged
Conversation
Generated images are stored on disk as {uuid}{ext}; the only human-readable
label they get is the image block's `name`, which sync_note_assets copies into
the asset row the Assets tab lists. The executor filled that name from the
plan's optional "alt" and nothing else, so a plan without it registered every
image under its UUID.
The per-paragraph placement example added to the planner prompt showed
section/anchorText/position but no "alt", and "alt" was only ever "optionally"
asked for, so batch image plans that followed it came out nameless.
- The executor now falls back to the image prompt's first sentence, cut at a
word boundary to 60 chars, when "alt" is missing or blank.
- The planner prompt asks for "alt" on every image (a 3-8 word title) and the
per-paragraph example includes it.
Images already registered without a name keep their UUID label; they can be
renamed from the Assets tab.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RSFoSnyUt5dnN1eCnBqi6M
davior
marked this pull request as ready for review
October 7, 2026 01:32
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.
Problem
Images the assistant generates were showing up in the Assets tab by their UUID filename (
022b8a9a-…jpg) instead of a readable name.Generated files are stored on disk as
{uuid}{ext}. The only readable label they get is the image block'snameprop, whichsync_note_assetscopies intoNoteAsset.original_name, and the Assets tab showstitle or original_name or filename. The executor fillednameonly from the plan's optionalaltfield, so any plan withoutaltleft every image named by its UUID.#202 (per-paragraph placement) added a "Placing blocks" example to the planner prompt that lists
section/anchorText/positionbut noalt, and the image rule only said "Optionally set alt". Batch image plans that follow that example (for example, "an image above every paragraph") come out with no names.Changes
backend/app/assistant/executor.py: newimage_name(alt, prompt). It usesaltwhen the plan gives one. Otherwise it takes the image prompt's first sentence, cut at a word boundary to 60 characters. Every generated image block now carries a name.frontend/src/services/aiPlan.ts: the planner prompt now asks foralton every image as a 3–8 word title, and the per-paragraph example includes it. The parser still treatsaltas optional.alt, name taken from the prompt, cutting a long prompt, and an end-to-end check that theNoteAssetrow gets the name. On the old code, the two fallback tests fail with'' == …andNone == ….Not covered
Testing
pytest tests/test_assistant_executor.py: 62 passedvitest run src/services/aiPlan.test.ts: 26 passedtsc --noEmit: clean🤖 Generated with Claude Code
https://claude.ai/code/session_01RSFoSnyUt5dnN1eCnBqi6M
Generated by Claude Code