fix(tui): double file content injection in commands using $ARGUMENTS
This commit is contained in:
parent
4519a1da32
commit
5917aec929
1 changed files with 13 additions and 1 deletions
|
|
@ -1558,6 +1558,18 @@ export const layer = Layer.effect(
|
|||
}
|
||||
|
||||
const templateParts = yield* resolvePromptParts(template)
|
||||
const stripParams = (url: string) => {
|
||||
const u = new URL(url)
|
||||
u.search = ""
|
||||
u.hash = ""
|
||||
return u.href
|
||||
}
|
||||
const inputFileUrls = new Set(
|
||||
(input.parts ?? []).flatMap((p) => (p.type === "file" ? [stripParams(p.url)] : [])),
|
||||
)
|
||||
const dedupedTemplateParts = templateParts.filter(
|
||||
(p) => !(p.type === "file" && inputFileUrls.has(stripParams(p.url))),
|
||||
)
|
||||
const isSubtask = (agent.mode === "subagent" && cmd.subtask !== false) || cmd.subtask === true
|
||||
const parts = isSubtask
|
||||
? [
|
||||
|
|
@ -1570,7 +1582,7 @@ export const layer = Layer.effect(
|
|||
prompt: templateParts.find((y) => y.type === "text")?.text ?? "",
|
||||
},
|
||||
]
|
||||
: [...templateParts, ...(input.parts ?? [])]
|
||||
: [...dedupedTemplateParts, ...(input.parts ?? [])]
|
||||
|
||||
const userAgent = isSubtask ? (input.agent ?? (yield* agents.defaultInfo()).name) : agent.name
|
||||
const userModel = isSubtask
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue