escape { in prompt

This commit is contained in:
an-lee
2024-10-13 11:58:28 +08:00
parent 0f10d23111
commit 5fbe381038

View File

@@ -14,9 +14,11 @@ export const summarizeTopicCommand = async (
): Promise<string> => {
if (!text) throw new Error("Text is required");
const formattedText = text.replace(/\{/g, "{{").replace(/\}/g, "}}");
const prompt = await ChatPromptTemplate.fromMessages([
["system", SYSTEM_PROMPT],
["human", text],
["human", formattedText],
]).format({
learning_language: LANGUAGES.find((l) => l.code === learningLanguage).name,
});