Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: disable template string in query (#160)

John Wang219011b62ae8
diff --git a/api/core/completion.py b/api/core/completion.py
index afa40b45cd5..6b4250c4c5b 100644
--- a/api/core/completion.py
+++ b/api/core/completion.py
@@ -124,6 +124,13 @@ class Completion:
chain_output: Optional[str],
memory: Optional[ReadOnlyConversationTokenDBBufferSharedMemory]) -> \
Union[str | List[BaseMessage]]:
+ # disable template string in query
+ query_params = OutLinePromptTemplate.from_template(template=query).input_variables
+ if query_params:
+ for query_param in query_params:
+ if query_param not in inputs:
+ inputs[query_param] = '{' + query_param + '}'
+
pre_prompt = PromptBuilder.process_template(pre_prompt) if pre_prompt else pre_prompt
if mode == 'completion':
prompt_template = OutLinePromptTemplate.from_template(