mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Use consistent agent name across static and dynamic examples in prompts
Previously the examples constructed from chat history used "Khoj" as the agent's name but all 3 prompts using the func used static examples with "AI:" as the pertinent agent's name
This commit is contained in:
parent
f5793149a9
commit
f28fb89af8
1 changed files with 3 additions and 3 deletions
|
@ -112,15 +112,15 @@ def update_telemetry_state(
|
|||
]
|
||||
|
||||
|
||||
def construct_chat_history(conversation_history: dict, n: int = 4) -> str:
|
||||
def construct_chat_history(conversation_history: dict, n: int = 4, agent_name="AI") -> str:
|
||||
chat_history = ""
|
||||
for chat in conversation_history.get("chat", [])[-n:]:
|
||||
if chat["by"] == "khoj" and chat["intent"].get("type") == "remember":
|
||||
chat_history += f"User: {chat['intent']['query']}\n"
|
||||
chat_history += f"Khoj: {chat['message']}\n"
|
||||
chat_history += f"{agent_name}: {chat['message']}\n"
|
||||
elif chat["by"] == "khoj" and ("text-to-image" in chat["intent"].get("type")):
|
||||
chat_history += f"User: {chat['intent']['query']}\n"
|
||||
chat_history += f"Khoj: [generated image redacted for space]\n"
|
||||
chat_history += f"{agent_name}: [generated image redacted for space]\n"
|
||||
return chat_history
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue