mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Dedupe user location passed in image, diagram generation prompts
This commit is contained in:
parent
2a32836d1a
commit
37317e321d
1 changed files with 5 additions and 11 deletions
|
@ -684,10 +684,7 @@ async def generate_better_diagram_description(
|
|||
prompts.personality_context.format(personality=agent.personality) if agent and agent.personality else ""
|
||||
)
|
||||
|
||||
if location_data:
|
||||
location_prompt = prompts.user_location.format(location=f"{location_data}")
|
||||
else:
|
||||
location_prompt = "Unknown"
|
||||
location = f"{location_data}" if location_data else "Unknown"
|
||||
|
||||
user_references = "\n\n".join([f"# {item['compiled']}" for item in note_references])
|
||||
|
||||
|
@ -705,7 +702,7 @@ async def generate_better_diagram_description(
|
|||
improve_diagram_description_prompt = prompts.improve_diagram_description_prompt.format(
|
||||
query=q,
|
||||
chat_history=chat_history,
|
||||
location=location_prompt,
|
||||
location=location,
|
||||
current_date=today_date,
|
||||
references=user_references,
|
||||
online_results=simplified_online_results,
|
||||
|
@ -770,10 +767,7 @@ async def generate_better_image_prompt(
|
|||
)
|
||||
model_type = model_type or TextToImageModelConfig.ModelType.OPENAI
|
||||
|
||||
if location_data:
|
||||
location_prompt = prompts.user_location.format(location=f"{location_data}")
|
||||
else:
|
||||
location_prompt = "Unknown"
|
||||
location = f"{location_data}" if location_data else "Unknown"
|
||||
|
||||
user_references = "\n\n".join([f"# {item['compiled']}" for item in note_references])
|
||||
|
||||
|
@ -790,7 +784,7 @@ async def generate_better_image_prompt(
|
|||
image_prompt = prompts.image_generation_improve_prompt_dalle.format(
|
||||
query=q,
|
||||
chat_history=conversation_history,
|
||||
location=location_prompt,
|
||||
location=location,
|
||||
current_date=today_date,
|
||||
references=user_references,
|
||||
online_results=simplified_online_results,
|
||||
|
@ -800,7 +794,7 @@ async def generate_better_image_prompt(
|
|||
image_prompt = prompts.image_generation_improve_prompt_sd.format(
|
||||
query=q,
|
||||
chat_history=conversation_history,
|
||||
location=location_prompt,
|
||||
location=location,
|
||||
current_date=today_date,
|
||||
references=user_references,
|
||||
online_results=simplified_online_results,
|
||||
|
|
Loading…
Reference in a new issue