fix init ChatMessagePromptTemplate error issue #1351 (#1535)

fix init ChatMessagePromptTemplate error issue #1351.ChatMessagePromptTemplate init had role properties,but the params not passing through

issue:https://github.com/logspace-ai/langflow/issues/1351
This commit is contained in:
chenhongsheng 2024-03-22 00:21:50 +08:00 committed by GitHub
commit d39ace293c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,6 +32,8 @@ def check_tools_in_params(params: Dict):
def instantiate_from_template(class_object, params: Dict):
from_template_params = {"template": params.pop("prompt", params.pop("template", ""))}
from_template_params.update(params)
if not from_template_params.get("template"):
raise ValueError("Prompt template is required")
return class_object.from_template(**from_template_params)