mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-11 01:08:57 +08:00
fix: disable template string in query (#160)
This commit is contained in:
parent
90150a6ca9
commit
219011b62a
@ -124,6 +124,13 @@ class Completion:
|
|||||||
chain_output: Optional[str],
|
chain_output: Optional[str],
|
||||||
memory: Optional[ReadOnlyConversationTokenDBBufferSharedMemory]) -> \
|
memory: Optional[ReadOnlyConversationTokenDBBufferSharedMemory]) -> \
|
||||||
Union[str | List[BaseMessage]]:
|
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
|
pre_prompt = PromptBuilder.process_template(pre_prompt) if pre_prompt else pre_prompt
|
||||||
if mode == 'completion':
|
if mode == 'completion':
|
||||||
prompt_template = OutLinePromptTemplate.from_template(
|
prompt_template = OutLinePromptTemplate.from_template(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user