Use consistent field name for queries in chat history & better image prompt

This commit is contained in:
Debanjum Singh Solanky 2024-03-09 18:57:47 +05:30
parent 086d5f8324
commit b7fad04870

View file

@ -465,8 +465,8 @@ async def text_to_image(
chat_history += f"Q: {chat['intent']['query']}\n"
chat_history += f"A: {chat['message']}\n"
elif chat["by"] == "khoj" and "text-to-image" in chat["intent"].get("type"):
chat_history += f"Q: {chat['intent']['query']}\n"
chat_history += f"A: [generated image redacted by admin]. Enhanced image prompt: {chat['intent']['inferred-queries'][0]}\n"
chat_history += f"Q: Query: {chat['intent']['query']}\n"
chat_history += f"A: Improved Query: {chat['intent']['inferred-queries'][0]}\n"
try:
with timer("Improve the original user query", logger):
improved_image_prompt = await generate_better_image_prompt(