From af1d8470cd72f38263b039cc0bc948083def6911 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 4 May 2024 13:21:35 -0700 Subject: [PATCH] fix: disable template variables in prompt --- src/lib/utils/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts index 60c3e685f..03cbc6262 100644 --- a/src/lib/utils/index.ts +++ b/src/lib/utils/index.ts @@ -473,6 +473,8 @@ export const blobToFile = (blob, fileName) => { }; export const promptTemplate = (template: string, prompt: string) => { + prompt = prompt.replace(/{{prompt}}|{{prompt:start:\d+}}|{{prompt:end:\d+}}/g, ''); + template = template.replace(/{{prompt}}/g, prompt); // Replace all instances of {{prompt:start:}} with the first characters of the prompt