Skip to content

feat(settings): Pick the Completer endpoint from a list, or type one - #520

Merged
omesser merged 9 commits into
mainfrom
feat/465-endpoint-picker
Sep 8, 2026
Merged

omesser merged 9 commits into
mainfrom
feat/465-endpoint-picker

Conversation

@omesser

@omesser omesser commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

Why

Settings → Director asked for the endpoint as free text. Every user types a URL,
and almost every user is typing one of a dozen well-known strings.

That is the wrong shape twice over. It asks people to remember
http://localhost:11434 to reach something already running on their own
machine, and it turns a typo into a silent failure — a wrong host does not
announce itself, it leaves the buddy on StaticDirector with a line in stderr
nobody is reading.

What changed

A Base URL picker — a FormRow::Composite holding one
CompositeControl::Popup — sits above the existing Base URL field. The field is
untouched: same id, same label, same batched, same frozen rule.

The pick writes into the field, not the file. That is why it is a composite
control rather than a FormRow::Popup: a popup that saved on its own would
commit the endpoint while the Model field held an unapplied edit, which is what
#279 forbids. Apply is still the only thing that reaches disk.

Each row stores the host alone, because model::completions_url
(src-tauri/src/model.rs:528) appends /v1 and the path. Every upstream doc
spells the /v1 this column drops.

Title Base URL
Custom — keeps whatever the field holds
Ollama http://localhost:11434
LM Studio http://localhost:1234
oMLX http://localhost:8000
llama.cpp http://localhost:8080
OpenAI https://api.openai.com
Anthropic https://api.anthropic.com
xAI https://api.x.ai

Every port was read off that project's current documentation rather than
recalled, then independently re-checked by a second reviewer against the same
sources.

Grouping rides in the title, not in header rows: GTK draws these choices as
a radio group, where an inert "header" radio is a click that silently does
nothing.

vLLM and mlx_lm.server are deliberately absent. They default to 8000 and
8080, already taken by oMLX and llama.cpp, so each would be a second name for a
URL already on the list. The field takes both.

Windows draws the box but leaves it empty, as it did before this PR. That
port commits no popup pick at all until #461, and populating the choices would
have given Windows a live-looking picker that writes nothing — the failure this
issue set out to remove, not to add.

Not done: probing GET /v1/models to validate the endpoint, and populating
the Model field. Both are named as follow-ons in the issue.

How to verify

cargo test --workspace          # 785 pass, 0 fail
cargo clippy --workspace --all-targets -- -D warnings

Four new tests in src-tauri/src/settings/form.rs: the local runtimes and their
ports are one pick away; every title round-trips through endpoint_url /
endpoint_title with Custom the only one that writes nothing; the frozen case;
the unfrozen case.

By hand, on macOS: open Settings → Director, pick Ollama, confirm the
Base URL field fills and Apply lights up, and that nothing is written until you
press it. Then export AI_BUDDY_DIRECTOR_BASE_URL and confirm the picker is
disabled and the help line says why.

Screenshots

macOS, Settings → Director, from a worktree build at 2x.

The picker at rest above the Base URL field

The picker sits directly above the Base URL field and rests on the title for the
endpoint in force — here oMLX (http://localhost:8000), which is what
the file holds.

The popup open over Custom and the seven named endpoints

Custom first, then the four local rows and the three hosted rows,
each carrying the URL it writes. The check marks the endpoint the field holds.
Nothing is clipped: the popup's 360pt width fits the longest title.

The picker disabled under AI_BUDDY_DIRECTOR_BASE_URL

With AI_BUDDY_DIRECTOR_BASE_URL=http://localhost:11434 exported: the picker is
greyed, still resting on the title the variable names, and its help line reads
"Off, for the same reason the Base URL below is." The field below carries
(overridden by env: AI_BUDDY_DIRECTOR_BASE_URL).

The first draw is blank, and the picker is where it shows

The picker empty on the first open of Settings

Open Settings, switch to Director, and the picker draws with no items at
all
— an empty box that will not open — while Base URL and Model show their
placeholders instead of the saved values. The resting shot above was taken after
one press of Cancel, which is the redraw that fills them.

This is not new here. build ends in refresh(), which is draw(false), so
director_staged reads the still-empty fields as a staged edit and #279's
if !staged.base_url guard skips filling them; both the guard and that
refresh() are on main. The picker is only where the symptom stops being
deniable — a text field showing a placeholder still looks plausible, an empty
popup does not. Read off set_director_buttons rather than tested: the same
first draw leaves Apply armed over a patch that would write "" to both rows.

The frozen case above escapes it, because a frozen row contributes no draft and
so is never staged — which is why that shot is correct on the first open.

Worth its own issue against the first draw, not a change to this PR.

The blank first draw in that last shot is not this PR — it is #530, which
predates the branch: build's closing refresh() runs while the fields are
still empty, so #279's staged guard skips filling them. #520 inherits it and
makes it louder, because an empty popup reads as broken where a placeholder
reads as unfilled. #530 also carries a config-wipe path this uncovered.

Notes

The frozen shot above still shows the previous Local — … titles. It could not
be recaptured: exporting AI_BUDDY_DIRECTOR_BASE_URL puts the endpoint in force
for the Director — director: http://localhost:11434 unreachable in the log —
but the Director tab now opens with the file's value in an editable field, so
the row never appears frozen. That looks like the reset-on-open #530 describes,
and it is not this branch's doing. The other three are current.

The GTK half has never been compiled. src-tauri/src/platform.rs:200-208
cfg-gates x11 out on macOS, so the 67 lines in x11/settings_window.rs are
unbuilt and untested anywhere — CI is the first thing that will compile them.
The change is modelled line-for-line on the existing FormRow::Popup arm. The
same caveat applies to the 24 lines in windows/settings_window.rs. I make no
build claim for either.

A follow-up worth doing but not done here: x11/settings_window.rs now
reproduces ~14 lines of the existing FormRow::Popup radio scaffold. Extracting
one radio_group helper would remove it, but refactoring code that cannot be
compiled on this machine seemed the wrong trade inside this PR.

docs/DEVELOPMENT.md still lists local-server ports independently of this list.
Left alone deliberately: different rows, different audience, and no generated
lane covers that file.

— Claude Code, on @omesser's behalf.

Closes #465

omesser and others added 5 commits September 8, 2026 01:06
Ports read off each project's current docs, not recalled. The pick fills
the Base URL field rather than the file, so the endpoint rows still apply
together (#279), and it freezes with the field when the env owns it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Populating it drew a live-looking dropdown that writes nothing, which is
the failure #465 set out to remove. Also pick the macOS selector by row id
rather than by whether options happen to be empty.
Four shots of Settings → Director on macOS: the picker at rest, the popup
open over its eight rows, the frozen case under AI_BUDDY_DIRECTOR_BASE_URL,
and the blank first draw the picker inherits from #279's staged guard.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The order carries the grouping, and localhost in the URL says the rest.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
omesser and others added 2 commits September 8, 2026 23:26
Merges main and resolves the form.rs test conflict, keeping both sides.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@omesser
omesser merged commit 8da619f into main Sep 8, 2026
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.

Pick the Completer endpoint from a list, or type one

1 participant