Browse Source

fix: template parse error when pre prompt include {{}} (#462)

John Wang 1 year ago
parent
commit
835bf9fd8d
1 changed files with 1 additions and 0 deletions
  1. 1 0
      api/core/prompt/prompt_template.py

+ 1 - 0
api/core/prompt/prompt_template.py

@@ -14,6 +14,7 @@ class JinjaPromptTemplate(PromptTemplate):
     def from_template(cls, template: str, **kwargs: Any) -> PromptTemplate:
         """Load a prompt template from a template."""
         env = Environment()
+        template = template.replace("{{}}", "{}")
         ast = env.parse(template)
         input_variables = meta.find_undeclared_variables(ast)