浏览代码

fix: disable template variables in prompt

Timothy J. Baek 1 年之前
父节点
当前提交
af1d8470cd
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      src/lib/utils/index.ts

+ 2 - 0
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:<length>}} with the first <length> characters of the prompt