This commit is contained in:
Dax Raad 2025-11-19 12:53:56 -05:00
parent b3afa84058
commit 2e0e72c4df
2 changed files with 8 additions and 15 deletions

View file

@ -425,6 +425,7 @@ export function Prompt(props: PromptProps) {
},
body: {
agent: local.agent.current().name,
model: `${local.model.current().providerID}/${local.model.current().modelID}`,
command: inputText,
},
})

View file

@ -600,12 +600,9 @@ export namespace SessionPrompt {
throw new Error("Impossible")
})
async function resolveModel(input: { model: PromptInput["model"]; agent: Agent.Info }) {
if (input.model) {
return input.model
}
if (input.agent.model) {
return input.agent.model
async function lastModel(sessionID: string) {
for await (const item of MessageV2.stream(sessionID)) {
if (item.info.role === "user" && item.info.model) return item.info.model
}
return Provider.defaultModel()
}
@ -794,10 +791,7 @@ export namespace SessionPrompt {
tools: input.tools,
system: input.system,
agent: agent.name,
model: await resolveModel({
model: input.model,
agent,
}),
model: input.model ?? agent.model ?? (await lastModel(input.sessionID)),
}
const parts = await Promise.all(
@ -1100,7 +1094,7 @@ export namespace SessionPrompt {
SessionRevert.cleanup(session)
}
const agent = await Agent.get(input.agent)
const model = await resolveModel({ agent, model: undefined })
const model = agent.model ?? (await lastModel(input.sessionID))
const userMsg: MessageV2.User = {
id: Identifier.ascending("message"),
sessionID: input.sessionID,
@ -1338,10 +1332,8 @@ export namespace SessionPrompt {
return cmdAgent.model
}
}
if (input.model) {
return Provider.parseModel(input.model)
}
return await Provider.defaultModel()
if (input.model) return Provider.parseModel(input.model)
return await lastModel(input.sessionID)
})()
const agent = await Agent.get(agentName)