if input not templated, render it at the end of slash command

This commit is contained in:
Nate 2025-02-24 00:10:15 -08:00
parent c745378efb
commit a187ff7dfe

View file

@ -20,11 +20,16 @@ export function slashFromCustomCommand(
}
// Render prompt template
const promptUserInput = await renderTemplatedString(
customCommand.prompt,
ide.readFile.bind(ide),
{ input: userInput },
);
let promptUserInput: string;
if (customCommand.prompt.includes("{{{ input }}}")) {
promptUserInput = await renderTemplatedString(
customCommand.prompt,
ide.readFile.bind(ide),
{ input: userInput },
);
} else {
promptUserInput = customCommand.prompt + "\n\n" + userInput;
}
const messages = [...history];
// Find the last chat message with this slash command and replace it with the user input