mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-10 22:19:01 +08:00
fix: template parse error when pre prompt include {{}} (#462)
This commit is contained in:
parent
c720f831af
commit
835bf9fd8d
@ -14,6 +14,7 @@ class JinjaPromptTemplate(PromptTemplate):
|
|||||||
def from_template(cls, template: str, **kwargs: Any) -> PromptTemplate:
|
def from_template(cls, template: str, **kwargs: Any) -> PromptTemplate:
|
||||||
"""Load a prompt template from a template."""
|
"""Load a prompt template from a template."""
|
||||||
env = Environment()
|
env = Environment()
|
||||||
|
template = template.replace("{{}}", "{}")
|
||||||
ast = env.parse(template)
|
ast = env.parse(template)
|
||||||
input_variables = meta.find_undeclared_variables(ast)
|
input_variables = meta.find_undeclared_variables(ast)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user