mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 21:29:12 +00:00
Pass username, location context in system prompt instead of chat message
The username and location in system prompt should disambiguate user context from user's actual message for the chat model. It doesn't need to be told to not mention the context or acknowledge the context instructions in it's response, as it understands that this information is just context and not part of the user's actual message.
This commit is contained in:
@@ -137,11 +137,11 @@ def converse(
|
||||
if location_data:
|
||||
location = f"{location_data.city}, {location_data.region}, {location_data.country}"
|
||||
location_prompt = prompts.user_location.format(location=location)
|
||||
conversation_primer = f"{location_prompt}\n{conversation_primer}"
|
||||
system_prompt = f"{system_prompt}\n{location_prompt}"
|
||||
|
||||
if user_name:
|
||||
user_name_prompt = prompts.user_name.format(name=user_name)
|
||||
conversation_primer = f"{user_name_prompt}\n{conversation_primer}"
|
||||
system_prompt = f"{system_prompt}\n{user_name_prompt}"
|
||||
|
||||
# Get Conversation Primer appropriate to Conversation Type
|
||||
if conversation_commands == [ConversationCommand.Notes] and is_none_or_empty(compiled_references):
|
||||
|
||||
Reference in New Issue
Block a user