Repository navigation
Agent: set the model's effort on a slider in the model chip - #1511
matthewrball wants to merge 20 commits into
Conversation
The model chip and the separate thinking button become one control. The
chip names the model and, in a quieter grey, its effort ("Kimi K3 High"),
and pressing it opens an effort popover:
- The level in large type, tinted by how hard the model thinks, over the
model's name. The name opens the model list, and a pick there returns
to the popover on the new model's levels. Enter does the same from the
keyboard. `/model` still opens the list on its own.
- A thick stepped slider with one stop per level the selected model
offers: Low / High / Max on GLM and Kimi, Off through Max on DeepSeek,
and so on. Drag it, click a stop, or press Left and Right. The level
under the thumb previews while dragging and saves on release.
- Reset returns to the level the runtime uses when nobody picked one
(Medium, or the nearest level the model accepts). That stop is drawn
as a ring.
- A model that does not think, and levels that are loading, saving or
unavailable (with Retry), show a status line in the slider's place.
Each level has a heat on one scale shared by every model. Heat drives
the fill, its glow and the label, so High is the same colour wherever
its stop sits. The thumb springs to its stop with a small overshoot,
lifts while held, and the dots glide to new stops after a model switch.
Frames are drawn only while something moves, and reduced motion jumps
instead of animating.
A pick made while another is saving now waits for it, and only the
latest waiting pick goes out. The popover stays open after a pick.
The level makes the chip wider than the old button. Send and the
context ring no longer shrink; when the row runs out of room, the
model's name truncates first and the level stays readable.
Menus get two hooks for content that is not rows: on_adjust, which Left
and Right call, and on_confirm, which Enter and Space call with no row
highlighted.
a83757d to
2f8357b
Compare
The reset is an icon button while it can act and a plain dimmed icon at the recommended level. Both arms now return an element of one type, so the popover still builds once icon buttons carry their own hover animation (#1509).
…state Slider, as a few springs: - The thumb follows the pointer through a stiff spring, so a drag is direct but smooth. It is drawn into each stop it passes as a soft notch, and on release it settles with a jelly overshoot. It stretches along its motion and squashes across it. - The fill's edge is a softer spring chasing the thumb. When the thumb runs ahead, a neck of fill thins between them. When it runs back, the fill drains after it with a droplet at the tip. - Dots swell as the fill flows over them. A ripple spreads from each stop a drag crosses and from each level that lands, and the thumb blooms in the level's colour. - Colour flows between the stops' heats instead of stepping. - Opening the popover, the content rises in, the thumb pops and the fill pours to it. - The hand cursor opens over the thumb and closes while it is held. Text and state, after torph's TextMorph: a new MorphText element. Letters two values share glide to their new places, leaving letters fade out, arriving ones rise in, and width and colour ease between them. The popover's level name and the chip's effort use it, so "High" becomes "Extra high" by keeping its "igh". The brain gives a small pulse as a level lands, and reset spins back as it acts. Everything asks for frames only while it moves, and reduced motion jumps instead.
The fill's edge still trails a thumb that runs ahead, but it no longer passes it. A thumb running back takes the edge with it, so the draining tail and its droplet are gone. The edge's spring is now close to critical damping (stiffness 220, damping ratio 0.9), so it doesn't slosh past the thumb on the opening pour or when the thumb settles. The fill's rounded end stays under the thumb, and the thumb's squash stops at the track's height. On open the thumb now settles in from slightly large (112%) instead of popping up from small, so it covers the track from the first frame. Changes of state: - The popover's level name swaps at once while a drag crosses stops, and morphs only on a pick, a key step or reset. A morph per stop garbled a fast sweep. - Arriving letters start fading in at 10% of a morph rather than 25%, so the text is never blank between values. - Reset's spin plays once, when it acts. It no longer replays every time the popover opens.
|
@AnthonyRonning flagging a decision for model grouping. It's not in this PR. We want the model list grouped again, like before: complex thinking, cheap and fast, and uncensored, with uncensored second. Models deploy without an app release, so if the grouping lives in the app, each new model sits ungrouped (or in the wrong group) until the next release ships. So adding a model to a group should be part of releasing the model. The catalog would serve each model's group and the group order, and the app would only render it. Can you decide how and where that's stored on the model side? The app side is small once the catalog carries it. |
Arriving at the selected model's top level (Max, or High on Gemma 4) by drag, click or arrow key flashes a warm disc behind the popover's brain and bursts a ring of rays from it. While the level stays at the top, the thumb keeps a warm halo, the fill glows a little more, and the chip's effort word turns from grey to the level's colour. An opening already at the top, or a model switch onto it, shows the halo without the spark; reduced motion keeps the halo and skips the spark.
Design review: Maple's users switch models more often than effort, so the chip now opens the model list with the selected model's effort slider docked under it, instead of an effort popover whose model name led to the list. A model pick closes the panel, as the plain list did, so switching models takes two clicks again; Left and Right step the effort, Up, Down and Enter pick a model. /model opens the same panel. Menu gains a footer that stays in view while the rows scroll, and loses on_confirm, which only the old popover used. ChatPopup::Effort, effort_return and the chat-effort-change-model string go with it.
Most capable, Uncensored, then Fast & cheap, as the list was grouped before, with a Popular badge on DeepSeek Uncensored. The catalog carries no group yet, so the app keeps a table of the current model ids; a model deployed after it lists under More models, and a catalog the table knows none of shows no headers at all.
The slider and the status line cross-fade when levels arrive, and the status line holds the slider's height, so the panel no longer jumps. A key step moves the thumb but plays no ripple, bloom, pulse, morph or spark. A drag ripples the stops it crosses and blooms once where it lets go, instead of a landing ripple, bloom and brain pulse at every stop. The brain pulses for a pointer pick or reset only, and never replays when the panel reopens. The halo fades out when the thumb leaves the top. Opening the panel, which happens on every model switch, settles the thumb without a bounce and with the fill already in place.
The ring that marked the level reset returns to read as a different kind of stop. Reset still dims at that level.
The brand coral on a grey pill read at under 2:1 in the light theme. The badge now sets deep coral on the soft coral container, 5.1:1 in light and 7:1 in dark, from a new accent_text token the contrast test holds to 4.5:1.
|
Moved to #1520 so the branch lives in this repo and can sit at the top of the bundle 2 stack (#1519). Same commits, plus a merge of the layer below. The model-grouping question for @AnthonyRonning above is still open; #1520's description links it. |
What changes
The composer's model chip and the separate brain (thinking) button become one control. The chip names the model and, in a quieter grey, its effort: "Kimi K3 High". Pressing it opens the model list with the selected model's effort slider docked under it:
/modelopens the same panel. Design review pointed out that Maple's users switch models more often than effort, unlike apps built around one frontier model, so the model leads and effort sits under it.badge_fillandbadge_texttokens carry the pair, held to 4.5:1 by the contrast test. The catalog carries no group yet, so for now the app keeps a table of the current model ids. A model deployed after it lists under More models until the table learns it; once the catalog serves groups (the plan in the comment to Anthony), the table goes.Adapting to each model's levels
Models offer different sets of levels: GLM 5.3, GLM-5.3 Flash and both Kimis offer Low / High / Max, DeepSeek V4.1 Flash offers Off / Low / High / Extra high / Max, and Gemma 4 offers Off through High. The slider spreads whatever the model offers evenly across the track, so it never shows a stop the model rejects. Each level also has a heat on one scale shared by every model, from Off to Max, and that heat drives the fill, its glow and the header colour. High is the same colour on every model even when it sits at a different stop. "Faster" and "Deeper" under the ends say which way is which.
Motion
The slider is built from a few springs, so it feels liquid:
Changes of state morph instead of swapping, after torph:
MorphTextelement: letters both values share glide to their new places, leaving letters fade out, arriving ones rise in, and width and colour ease (400 ms, exponential ease-out).Everything asks for frames only while it moves; at rest the panel is idle. Reduced motion skips the springs and effects and jumps.
Saving
Picks stay optimistic, as before. A pick made while another is saving now waits instead of being dropped, and only the latest one goes out, for the task and model it was made on even if you switch away first. Sweeping the slider across stops saves at most one more time. The chip shows a waiting pick at once, as the panel does. When a save fails while a newer pick for the same model waits, only the newer one's result is reported. An effort pick keeps the panel open; a model pick closes it.
Implementation
ui/effort_slider.rs: the slider as a painted gpui element. Thumb, fill edge, lift and entrance are springs; notches, ripples, dot swells, bloom and the stop morph are timed effects. Its state is held by its owner, so a model switch still glides when the panel reopens.ui/morph_text.rs:MorphText, a text element that morphs between values (a longest-common-subsequence match on letters, then glide, fade and rise).ui/chat/effort.rs: the panel's effort footer, level heat, andrecommended_level, which mirrors pi-ai'sclamp_thinking_level(Medium).ui/chat/composer.rs:model_menudocks the effort footer under the model rows and steps effort on Left and Right.ui/popup.rs:Menu::on_adjust, so Left and Right step a control inside a menu where they would otherwise enter or leave a submenu;Menu::footer, content docked under the rows that stays in view while they scroll (the keyboard skips it); andMenuItem::keep_open, for a row like Retry whose result shows in the menu.ui/chat/thinking.rs:thinking_menuis removed.pick_thinkingno longer closes the popup. A pick made during a save waits behind it and goes out for its own task and model (save_thinking), and the save's result is handled inthinking_saved.ChatPopup::ThinkingandComposerControl::Thinkingare removed;ChatPopup::Modelis the panel. Application Vim's row loses one stop.chat-effort,chat-effort-reset,chat-effort-faster,chat-effort-deeper,chat-model-effort-chip(the chip's accessible name, "Kimi K3, High effort"), the group headingschat-model-group-capable,-uncensored,-fastand-more,chat-model-popular, andchat-model-popular-row(the badged row's accessible name, "DeepSeek Uncensored, Popular"). Spanish revisions are recorded. New icons:rotate-ccw(Lucide) andeffort-burst, the brain's ring of rays.Testing
cargo test -p maple-agent-app --bin maple-agent: 1361 passed, 3 ignored. Clippy is clean apart from two lint groups that already fail on master with the local toolchain (unexpected_cfgsin the macOS objc files,nonminimal_boolin five untouched files).New tests:
/modelopens the same panel.recommended_levelmatches the runtime's fallback for each catalog shape.The updated chip and application Vim tests cover the merged control. The composer-menu float test now lays the chat out in a column, as the app does: the taller panel needs the room above the composer that the app gives it.
Rendered in both themes with real fonts through gpui's headless Metal renderer, using the catalog's real model names and level sets (images below).
Live catalog. In a signed-in debug build (the local PR stack with this branch merged, before the top-level spark and the models-first panel), each model's levels came from the runtime: DeepSeek Uncensored and DeepSeek V4.1 Flash showed five stops, GLM 5.3 three, and Gemma 4 five (Off through High). To run this branch alone in its own profile, sign in once:
The separate data root gives it its own store, sign-in and host, so it runs beside an installed or debug Maple Work.
Screenshots
Headless renders of this branch in a 900 px window, using the catalog's real model names and level sets.
Motion, recorded frame by frame at about 30 fps, so timing is approximate, before the models were grouped and before the motion fixes above. In order: the panel opens on DeepSeek's models and slider, a drag to Maximum (the brain sparks, the chip's effort turns coral) and down to Low, a one-click switch to GLM 5.3 that closes the panel, reopening on GLM's three stops, and the same to Gemma 4.
Stills, from the head of this branch:
Not in this PR
Model::thinking_levels). Collapsing it to Off / On is a runtime change and belongs in its own PR.