fix(app): make prompt input agent toggle reactive (#38653)

This commit is contained in:
Brendan Allan 2026-07-24 16:12:57 +08:00 committed by GitHub
parent bce2992729
commit ce7f54d5e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -447,15 +447,16 @@ export function usePromptInputV2Controller(props: PromptInputV2ControllerProps):
},
view: {
placeholder: designPlaceholder,
agent:
props.controls.agents.visible && props.controls.agents.options.length > 0
get agent() {
return props.controls.agents.visible && props.controls.agents.options.length > 0
? {
options: () => props.controls.agents.options.map((name) => ({ id: name, label: name })),
current: () => props.controls.agents.current,
onSelect: props.controls.agents.select,
onSelect: (value: string) => props.controls.agents.select(value),
keybind: () => command.keybindParts("agent.cycle"),
}
: undefined,
: undefined
},
variant: {
options: () => variants().map((value) => ({ id: value, label: value })),
current: () => props.controls.model.selection.variant.current() ?? "default",