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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
Fix: move pre prompt to user massasge in chat mode (#126)
John Wange8e8f9e97de9
diff --git a/api/core/completion.py b/api/core/completion.pyindex 5bacce8f75f..d05d8417da8 100644--- a/api/core/completion.py+++ b/api/core/completion.py@@ -157,11 +157,6 @@ And answer according to the language of the user's question.else:messages: List[BaseMessage] = []- if pre_prompt:- # append pre prompt as system message- system_message = PromptBuilder.to_system_message(pre_prompt, inputs)- messages.append(system_message)-human_inputs = {"query": query}@@ -170,7 +165,7 @@ And answer according to the language of the user's question.if chain_output:human_inputs['context'] = chain_output- human_message_prompt = """Use the following CONTEXT as your learned knowledge.+ human_message_instruction = """Use the following CONTEXT as your learned knowledge.[CONTEXT]{context}[END CONTEXT]@@ -180,9 +175,16 @@ When answer to user:- If you don't know when you are not sure, ask for clarification.Avoid mentioning that you obtained the information from the context.And answer according to the language of the user's question.+"""+ if pre_prompt:+ human_inputs.update(inputs)+ human_message_instruction += pre_prompt + "\n"-Q:{query}-A:"""+ human_message_prompt = human_message_instruction + "Q:{query}\nA:"+ else:+ if pre_prompt:+ human_inputs.update(inputs)+ human_message_prompt = pre_prompt + "\n" + human_message_prompt# construct main prompthuman_message = PromptBuilder.to_human_message(