Skip to content

feat(images): image creation settings in the Agent UI and the TUI - #6494

Merged
kovtcharov-amd merged 23 commits into
amd:mainfrom
kovtcharov:feat/image-creation
Nov 20, 2026
Merged

kovtcharov-amd merged 23 commits into
amd:mainfrom
kovtcharov:feat/image-creation

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

GAIA always created images with SDXL-Turbo at its defaults, whatever image models you had downloaded, and neither app had a setting for it. Now Settings › Image creation in the Agent UI and /image in the TUI pick the model, size and steps, shared through ~/.gaia/config.json, and the agent uses them whenever a request names no model.

  • Choices come from Lemonade, not a hard-coded list. Models are the image models you have downloaded, plus the older SD models that download on first use. Each offers only the sizes under its own soft_pixel_cap, so a saved setting is one the model can run. Automatic keeps the model's own size or steps.
  • Agent UI: a new Settings section. If your chat model is too small to be offered image creation (Gemma 4 E4B), it says so and links to Settings › Model; if your saved model has been removed, it says that too.
  • TUI: /image shows and sets the same settings (and gives the same too-small-chat-model warning), a created image prints as a link, and /image open opens it in the PC's viewer.
  • Backend: GET/PUT /api/images/settings; 422 names a model this Lemonade doesn't have or a size it doesn't take, and nothing is saved.

Stacked on #6194 (image editing and upscaling) and merges it in, since both change the SD mixin. Merge #6194 first; its edit and upscale tools stay off by default, as that PR intends.

The generate_image docstring now says an omitted model means "the user's chosen image model". Eval category to watch at the next RC: vision (sd_graceful_degradation).

Test plan

  • pytest tests/unit/chat/ui/test_image_settings.py (choices from a catalog slice, pixel caps, config coercion, routes incl. 422/503, the mixin using saved settings, a removed saved model) plus the SD, image-edit and local-only suites from main and feat(images): add Lemonade image editing and upscaling #6194 (281 pass)
  • npm test (2,457) and npm run test:rtl, with image settings in Arabic light/dark and English; a new rule fails when an <option> carries the bracketed English hint, which this pane did before the fix
  • go build ./..., go vet ./..., go test ./... in tui/, and the drift test pinning the TUI's size list to gaia.sd.settings
  • Real Lemonade 2026.44.1: the route listed SDXL-Turbo (downloaded) and three legacy models, saved SDXL-Turbo at 768x768 / 2 steps, refused 1280x720 with the allowed list; the mixin then created a 768×768 PNG from those settings in 11.5 s
  • Screenshots read in English and Arabic, light and dark, and at 390 px
  • Both apps end to end against a stand-in Lemonade, in an isolated GAIA home: a model, size and steps set in the Agent UI showed in the TUI's /image; switching to a model that can't make the saved size reset it to Automatic; a removed saved model and a Lemonade that stops answering each get a plain message (Try again recovers)
  • Reviewer: pick a model and size in Settings › Image creation, ask the chat for a picture, and check it uses them; repeat with /image in the TUI

@github-actions github-actions Bot added documentation Documentation changes llm LLM backend changes tests Test changes electron Electron app changes performance Performance-critical changes agents tui Go terminal UI (gaia-tui) labels Nov 3, 2026
Adds image_model, image_size and image_steps to the shared config, the
choices read off Lemonade's catalog, GET/PUT /api/images/settings, and
the SD mixin following them when a request names no model.
GAIA always created images with SDXL-Turbo at its defaults. Settings ›
Image creation and /image now pick the model, size and steps, shared in
~/.gaia/config.json, and the flagship uses them when a request names no
model.

- Choices come from Lemonade's catalog: downloaded image models plus the
  legacy SD models that download on first use, each offering only sizes
  under its soft_pixel_cap.
- Agent UI: settings pane, a notice when the chat model is too small to
  be offered image creation, and "Created an image" in the activity list.
- TUI: /image, /image model|size|steps, a link to each created image and
  /image open.
- An rtl rule now fails an <option> that carries the English hint.
Main's new Settings layout brought its own .settings-notice in a column, and
this branch's rule for the same class gave the text a 16rem flex basis, so the
notice stretched into a tall empty box. The pane now uses main's style alone.

- The image-settings layout test asserts the notice stays under 160px; it
  fails on the old CSS.
- settings-general screenshots updated for the Image creation entry.
Merging amd#6194 over the latest main undid two of main's changes to the image tools. A saved image's name stripped the model to "repomodelname" instead of "repo_model_name", and the path check stopped being swappable in tests, so main's variation-refusal test saw a real request.

Model names in saved filenames use main's rule again, and runs of dots are replaced too, as amd#6194 asks. The path checks are called through their module.
Three problems found driving both apps against a stand-in Lemonade:

- With Lemonade down, Settings › Image creation printed a raw Python connection traceback. It now says Lemonade isn't answering, keeps the server's text as a detail line, and offers Try again.
- The "too small to be offered image creation" notice named the chat model by its id (Gemma-4-E4B-it-GGUF) where the rest of the app says Gemma 4 E4B.
- The TUI's /image never said that the chat model doesn't create images, so a Gemma user set options that never applied. It now gives the same warning, read from setup's catalog, and points to /models.
@kovtcharov
kovtcharov marked this pull request as ready for review November 5, 2026 23:02
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Verdict: Request changes

This adds an image-creation setting (model, size, steps) shared by the Agent UI and the TUI, with choices read from Lemonade's catalog and checked before saving. The settings flow, the 422/503 handling and the tests are solid. Two things undo the feature in normal use and should be fixed before merge:

  • The saved size and steps are dropped when the agent names the saved model. The image skill tells the model to pick an exact model id from list_sd_models, and that listing now reports the user's saved model as the default. When the agent passes that model by name, the request counts as "a request that named a model", so GAIA uses the model's own defaults and ignores the size and steps the user just chose. Apply the saved size and steps whenever the requested model is the saved one.
  • The TUI says "Created image" for pictures it only looked at. Any successful tool result that carries an image path gets recorded as a created image. That includes image analysis and image Q&A, so asking about a photo prints "Created image: ", and /image open then opens that photo. Only record results from the tools that create images.

The image-gen skill also still tells the agent that SDXL-Turbo is the default and to tune for it. That's no longer true once a user picks another model.

Real-world evidence

N/A: no evidence bundle was produced for this run. The verdict rests on static review and on the author's own description: a run against real Lemonade 2026.44.1 that saved SDXL-Turbo at 768×768 / 2 steps, refused 1280×720 and created a 768×768 PNG, plus end-to-end checks of both apps against a stand-in Lemonade. That description doesn't embed any before/after screenshot of the new Settings › Image creation pane. Please add one, rendered on the PR.

🔍 Technical details

🟡 Saved size/steps skipped when the request names the saved model (src/gaia/sd/mixin.py:661)
if saved and not model: applies the saved size and steps only when model is omitted. list_sd_models now returns default_model = saved["model"] (line 1163 in the diff), and hub/skills/image-gen/SKILL.md:35-37 says "Select an exact model ID from its models list". So a skill-following agent passes model="Z-Image-Turbo", which skips the saved image_size / image_steps. Keep the "named a different model → its own defaults" rule, but treat naming the saved model like omitting it:

        saved = self._saved_image_settings()
        if saved and (not model or model == saved["model"]):
            model = saved["model"]
            size = size or saved["size"]
            steps = steps if steps is not None else saved["steps"]

Add a test in tests/unit/chat/ui/test_image_settings.py for generate_image(model=<saved model>) using the saved size/steps.

🟡 TUI records analysed images as created (tui/internal/ui/chat/imagecmd.go:286, called from canonical.go:186,217)
createdImagePath matches any tool result whose Data has an image_path with an image extension, whatever the tool. analyze_image and answer_question_about_image both return {"status": "success", "image_path": str(path), ...} (src/gaia/vlm/mixin.py:182-187, 229-235), so the TUI appends "Created image: …" and points /image open at the user's input file. Restrict it to the creating tools (generate_image, edit_image, upscale_image, create_image_variation) or to render == "image". Pass e.Tool into noteCreatedImage and add a test that an analyze_image result is ignored. The tests only feed generate_image (imagecmd_test.go:239-242).

🟡 Doc drift: image-gen skill still assumes SDXL-Turbo (hub/skills/image-gen/SKILL.md:58-68)
"SDXL-Turbo is the default and it is distilled to converge in about 4 steps…" now holds only while image_model is unset. With Z-Image or Flux saved, this section tells the agent not to raise steps or CFG on a model that needs them. Reword it to "the default is the user's chosen image model (SDXL-Turbo when none is chosen)", scoping the Turbo tuning advice to Turbo models. Line 37 should also say default_model is the user's choice and that passing it keeps their size/steps.

🟢 Changing image_model from gaia config set keeps an old size (src/gaia/config.py:866)
The UI and TUI reset size and steps on a model switch, but gaia config set image_model X only checks the value's shape. A size saved for the previous model then goes to X, and Lemonade may refuse it at generation time. A one-line note in the cli.mdx config table ("set image_size auto when switching models") would be enough.

Strengths

  • Choices come from Lemonade's image_defaults / soft_pixel_cap, and the PUT validates against that catalog before saving anything. A 422 names the allowed sizes, so a saved setting is one the model can actually run.
  • One source of truth across Python and Go, with a drift test (test_tui_image_sizes_drift.py) pinning the TUI's size list to gaia.sd.settings.
  • A removed saved model gives a specific message in both the mixin and the UI rather than a generic "invalid model", and a corrupt config fails loudly rather than falling back.

…aved model

Review fixes:

- The image skill has the agent pass list_sd_models' default model by name, and that default is now the user's choice. Naming it counted as "a request that named a model", so the size and steps the user picked were dropped. Naming the saved model now keeps them.
- The TUI recorded any tool result with an image_path as a created image, so asking about a photo printed "Created image: <the photo>" and /image open opened it. Only the four tools that create images count.
- The image-gen skill still called SDXL-Turbo the default; it now says the default is the user's chosen model and scopes the few-step advice to Turbo models. The CLI reference says to reset image_size when changing image_model by hand.
- The RTL audit's option rule exempts every language picker (options tagged with lang), including setup's, which made the Arabic setup screens fail.
test_export_openapi failed in CI because api.schemas.json and api.gen.ts lacked the image settings models.
The RTL audit flags an <option> that carries the bracketed English hint, which an option cannot style and whose brackets scramble right to left. The memory dashboard's category, context and priority pickers, the activity filter, the document target and setup's empty chat-model choice all did ("عنك (About you)"). They use t.bare now, as the rule asks.
# Conflicts:
#	src/gaia/apps/webui/visual/__screenshots__/settings-general-dark-win32.png
#	src/gaia/apps/webui/visual/__screenshots__/settings-general-light-win32.png
# Conflicts:
#	src/gaia/apps/webui/visual/rtl.visual.ts
#	src/gaia/config.py
# Conflicts:
#	src/gaia/apps/webui/src/components/AgentActivity.tsx
Read aloud landed on main and added entries in the same places as image creation; both are kept. The image settings calls move to imageApi.ts so api.ts stays under its size check.
@github-actions github-actions Bot added the cli CLI changes label Nov 10, 2026
Asking GAIA to describe, edit, upscale or vary a picture it had just made was refused: generated media sits in GAIA's own folder, which no approval can open. Those two folders are now readable, never writable, the same way transcripts are.
@github-actions github-actions Bot added the security Security-sensitive changes label Nov 10, 2026
@kovtcharov-amd kovtcharov-amd added enhancement New feature or request image-generation Issue related to image generation agent-ui Agent UI changes labels Nov 12, 2026
# Conflicts:
#	docs/guides/agent-ui.mdx
#	src/gaia/apps/webui/src/components/__tests__/AgentActivity.toolLabels.test.tsx
#	src/gaia/apps/webui/src/components/settings/SettingsDialog.tsx
#	src/gaia/apps/webui/src/i18n/locales/ar.ts
#	src/gaia/apps/webui/src/i18n/locales/en.ts
#	src/gaia/vlm/mixin.py
#	tui/internal/ui/components/helpoverlay.go
Main now labels generate_image "Made image" and maps its icon, so the
duplicate label keys and the second ImageIcon import go.
@kovtcharov-amd kovtcharov-amd added the ready_for_ci Run CI workflows on draft PR without requesting review label Nov 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve with suggestions

This PR lets users choose the image model, size and steps GAIA creates pictures with. The Agent UI gets a Settings › Image creation section, the TUI gets /image, and both save to the same ~/.gaia/config.json. The flagship agent then uses those settings whenever a request names no model. Both apps take the choices from Lemonade's catalog, check them the same way, refuse a size a model can't make before saving it, and give a plain message when Lemonade is down or the saved model has been removed. I found no correctness or security problems in the new code.

Fix before merging:

  • The CLI reference now lists the project_context setting twice. The new image rows were added next to a second copy of the existing project_context row, which leaves out "after you trust the folder". Delete the added copy.

Non-blocking:

  • No screenshot is embedded in the description. It says the screenshots were checked in English and Arabic, but none are on the PR. Embed one of Settings › Image creation so reviewers can see it.

Real-world evidence

N/A: no evidence bundle was produced for this run. The verdict rests on reading the code, plus the author's own account of testing against a real Lemonade (2026.44.1): the route listed the models, saved 768x768 at 2 steps, refused 1280x720, and the mixin then created an image. The Agent UI pane and /image in the TUI were not exercised here.

🔍 Technical details

🟡 Duplicate project_context row (docs/reference/cli.mdx:1947)
The diff adds a project_context row above the new image_* rows. The existing row stays at line 1951 with more accurate wording ("after you trust the folder when asked"), so the config table now has two rows for one key that disagree. This looks like a merge artifact. Delete line 1947 (the added | project_context | … (Claude gets them, other models don't). GAIA_PROJECT_CONTEXT overrides it … row) and keep the original at 1951.

🟢 Screenshot evidence (PR description)
The Settings pane is an Agent UI surface. The rubric wants a rendered before/after screenshot embedded with a raw.githubusercontent.com URL. The rtl.visual.ts rule and the updated baselines cover the layout in CI, so this is a nudge, not a blocker.

Checked, no finding:

  • Sibling paths. The TUI images.Choices/Check match gaia.sd.settings, and test_tui_image_sizes_drift.py pins sizes.json. The generate_image path and the list_sd_models default both read _saved_image_settings(). A saved model that has been removed gets its own message naming where to fix it. A legacy SD model skips the catalog check, as before.
  • Read-only media folders. generated_media_dirs() resolves through GAIA_CONFIG_DIR, so it follows GAIA_HOME. It matches ui.generated_media.media_dir and the flagship's sd_output_dir. It is not added when GAIA_ALLOWED_PATHS confines the session, and the tests cover traversal, write refusal and the files next to it.
  • Deadlines. The TUI catalog and plan reads use 15 s contexts. The router goes through LemonadeClient.list_models, the same way memory.py does.
  • Fail loudly. A config.json that can't be read is a 500 from the route and a GaiaConfigError from the mixin, never a silent fallback to defaults. A Lemonade that isn't answering is a 503 with the URL, and the UI offers Try again.
  • /image open. It hands over only an existing regular file with an image suffix. On Windows it goes through rundll32 with a file:// URL, so no shell re-parses the path, and rundll32 opens no console window.
  • Evals. The generate_image docstring and the image-gen SKILL.md text changed, and the PR names vision (sd_graceful_degradation) for the next RC, as CLAUDE.md requires.

Strengths

  • The Python and Go sides share one rule set, with a drift test, and the Python and Go tests use the same catalog slice.
  • The error states are designed rather than bolted on: an unreachable Lemonade, a removed saved model, a chat model too small to make images (with a link to the fix), and a 422 that names the sizes the model accepts.
  • Switching models resets size and steps in both the API and the TUI, so the config is never left with a size the model can't make.

@kovtcharov-amd kovtcharov-amd added ready_for_ci Run CI workflows on draft PR without requesting review and removed ready_for_ci Run CI workflows on draft PR without requesting review labels Nov 16, 2026
Main's tighter read rule for generated images (amd#8478) replaces this
branch's folder-wide read grant for the image and audio folders; the
security doc now describes main's rule.
@kovtcharov-amd
kovtcharov-amd merged commit 6e606fa into amd:main Nov 20, 2026
114 checks passed
kovtcharov-amd added a commit that referenced this pull request Nov 20, 2026
Getting a document as audio used to take two hand-described steps,
produced only WAV (3 minutes is 9 MB), and showed no player once the
file was saved to a folder of your own. Now one sentence does it in the
Agent UI and the TUI: attach or name a PDF, Word, Excel, text or
Markdown file, say "turn this into audio", and GAIA records it, plays it
in the chat, and saves the audio where you asked. It reads the document
as written, or rewrites tables, charts, footnotes and web addresses into
spoken sentences when it has them, says which it chose, and saves that
listening script beside the audio.

What a reviewer should weigh:

- **One tool does the whole job.** `dictate_document` reads the file
itself, so a long document is never shortened by passing through the
model, and a new `dictation` skill tells the agent to call it without
questions.
- **The player works for any save location, with the media boundary
intact.** The recording always stays in GAIA's audio folder and a copy
goes to the user's path; `text_to_speech` now does the same. The only
change to what the Agent UI serves is `.mp3`.
- **MP3 needs nothing new.** It is Lemonade's own encoding of the Kokoro
voice, joined frame by frame: 3 min 16 s is 3.9 MB against about 9 MB as
WAV. A lower bitrate would need ffmpeg and is left out.
- **Long documents show progress and stop cleanly** in both apps. The
TUI's live line now shows a running tool's own progress, which also
benefits other long tools.
- **A rewrite cannot change a number.** Every figure in a listening
script is checked against the document before recording. Gemma 4 E4B
wrote 13,110 for 13,100 on the test report; that is now asked for once
more and, if still wrong, refused with as-written offered instead.
- **Numbers are respelled for the voice.** Transcribing the voice back
showed it misreads decimals ("3.5" as "three. five"), footnote marks,
and abbreviations; those are fixed before recording.

Limits, stated in the guide: English Kokoro voices only (other Lemonade
speech models are not offered, as GAIA has not proven them); charts are
described from the document's text, not the picture; one dictation
covers about two hours of audio, and a longer document is recorded in
page ranges.

Two notes for the reviewer:

- **No eval was run.** This adds a tool, a skill and a tool bundle,
which is LLM-affecting, but another session's eval was running on this
machine, and evals run one at a time. Categories to watch on the next
RC: `tool_selection`, `gaia_tool_selection`, `web_system` (it holds the
`text_to_speech` scenario) and `rag_quality` (the document tools next to
it). The `dictation` skill is listed as deferred in the skill-scenario
coverage test, because the text lanes cannot judge audio.
- **Not the same as the voice-typing "dictation" in #6789.**
That is speech to text in the composer; this is document to audio. This
PR does not need the generated-media read grant from #6494.

## Screenshots

The audio card after a dictation saved to a folder of the user's, from
the `rtl.visual.ts` scene (English, then Arabic). The path stays left to
right inside the Arabic line.

![Audio card,
English](https://raw.githubusercontent.com/kovtcharov/gaia/f9cf80e5645eaaa25bd0077af96e6b61281b41c4/dictation-card-en.png)

![Audio card,
Arabic](https://raw.githubusercontent.com/kovtcharov/gaia/f9cf80e5645eaaa25bd0077af96e6b61281b41c4/dictation-card-ar.png)

## Test plan

Run against the real apps from an isolated GAIA home, chat model
DeepSeek through Fireworks, voice `kokoro-v1` on Lemonade.

- [x] Agent UI, typed path and a named folder: listening form chosen for
a 2-page report with a table, chart and footnote; player in the chat
(3:27); MP3 and `.script.md` saved in the folder; the reply named the
form and why
- [x] Agent UI, PDF dropped on the composer, "word for word": as-written
MP3 with a player and no permission prompt
- [x] Agent UI, 36-page PDF (20,000 words): refused as too long with a
page range, then recorded in parts; the first part ran 10 minutes as one
tool call and produced 34 min 28 s of audio with progress shown
throughout; Stop during the next part ended the turn and left no partial
file
- [x] TUI: one sentence produced the MP3 and script in the named folder,
progress on the live line, and the audio card with its open and reveal
keys
- [x] Listen-back with Whisper Large v3 Turbo: listening form 95.6% word
match (1 of 62 numbers heard differently, and correct when that sentence
was recorded alone); as-written 90.1% with every number heard; the last
two minutes of the 34-minute file 95.5% against the script's end
- [x] `python -m pytest tests/unit/test_dictation.py
tests/unit/test_lemonade_speech.py
tests/unit/chat/ui/test_generated_media.py
tests/unit/test_chat_tool_requests.py`
- [x] Routing: "Read notes.pdf aloud and save it as report.mp3",
"Narrate chapter1.txt and save as chapter1.wav" and six more variants
offer `dictate_document` first; "Transcribe meeting.mp3", "what does
interview.mp3 say?" and six more that read an existing audio file still
offer `transcribe_media` (`tests/unit/test_chat_tool_requests.py`)
- [x] `python -m pytest tests/unit/test_flagship_tool_labels.py`
(activity label in English and Arabic, live-progress phrase)
- [x] `python -m pytest
hub/agents/gaia/python/tests/test_chat_dictation_tool.py
hub/agents/gaia/python/tests/test_chat_tts_tool.py`
- [x] `cd src/gaia/apps/webui && npm test && npm run test:rtl` (3,449
unit and 456 visual tests pass; a new visual test renders the audio card
with its "Saved to" and "Script saved to" lines in English and Arabic,
and both were read on screen)
- [x] `cd tui && go test ./internal/ui/...`
- [x] `python util/lint.py --tool-descriptions`, black, isort, and
`python util/check_doc_links.py --internal-only`
- [x] Listening rewrite on Gemma 4 E4B (local, GPU): 6 of 7 runs passed
the figure check (one after its retry), 1 was refused for a wrong
figure; a full dictation gave 3 min 33 s of audio in 90 s with 95.1%
listen-back match
- [ ] Not tested: the listening rewrite on Qwen3.6; Linux and macOS; the
packaged desktop app

---------

Co-authored-by: Kalin Ovtcharov <[email protected]>
kovtcharov-amd added a commit to huong8373tt-beep/gaia that referenced this pull request Nov 21, 2026
main already carries an earlier copy of this change (merged in with amd#6494),
so the merge keeps main's follow_user_settings and keeps this branch's
opt-in default, the not-downloaded model check, and the index-first
output names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-ui Agent UI changes agents cli CLI changes documentation Documentation changes electron Electron app changes enhancement New feature or request image-generation Issue related to image generation llm LLM backend changes performance Performance-critical changes ready_for_ci Run CI workflows on draft PR without requesting review security Security-sensitive changes tests Test changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants