fix(tui): Don't overwrite the agent that was specified on the command line (#20554)
This commit is contained in:
@@ -37,6 +37,7 @@ import { useToast } from "../../ui/toast"
|
|||||||
import { useKV } from "../../context/kv"
|
import { useKV } from "../../context/kv"
|
||||||
import { useTextareaKeybindings } from "../textarea-keybindings"
|
import { useTextareaKeybindings } from "../textarea-keybindings"
|
||||||
import { DialogSkill } from "../dialog-skill"
|
import { DialogSkill } from "../dialog-skill"
|
||||||
|
import { useArgs } from "@tui/context/args"
|
||||||
|
|
||||||
export type PromptProps = {
|
export type PromptProps = {
|
||||||
sessionID?: string
|
sessionID?: string
|
||||||
@@ -81,6 +82,7 @@ export function Prompt(props: PromptProps) {
|
|||||||
|
|
||||||
const keybind = useKeybind()
|
const keybind = useKeybind()
|
||||||
const local = useLocal()
|
const local = useLocal()
|
||||||
|
const args = useArgs()
|
||||||
const sdk = useSDK()
|
const sdk = useSDK()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const sync = useSync()
|
const sync = useSync()
|
||||||
@@ -202,7 +204,8 @@ export function Prompt(props: PromptProps) {
|
|||||||
// Only set agent if it's a primary agent (not a subagent)
|
// Only set agent if it's a primary agent (not a subagent)
|
||||||
const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent)
|
const isPrimaryAgent = local.agent.list().some((x) => x.name === msg.agent)
|
||||||
if (msg.agent && isPrimaryAgent) {
|
if (msg.agent && isPrimaryAgent) {
|
||||||
local.agent.set(msg.agent)
|
// Keep command line --agent if specified.
|
||||||
|
if (!args.agent) local.agent.set(msg.agent)
|
||||||
if (msg.model) {
|
if (msg.model) {
|
||||||
local.model.set(msg.model)
|
local.model.set(msg.model)
|
||||||
local.model.variant.set(msg.model.variant)
|
local.model.variant.set(msg.model.variant)
|
||||||
|
|||||||
Reference in New Issue
Block a user