mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Use default agent in others chats with an agent if agent made private
If a public or protected agent is made private. Other users who were having conversation with that agent will have to carry on their conversation using default agent instead
This commit is contained in:
parent
d628f89ce9
commit
80212c50fd
1 changed files with 22 additions and 16 deletions
|
@ -209,14 +209,17 @@ def chat_history(
|
|||
|
||||
agent_metadata = None
|
||||
if conversation.agent:
|
||||
agent_metadata = {
|
||||
"slug": conversation.agent.slug,
|
||||
"name": conversation.agent.name,
|
||||
"isCreator": conversation.agent.creator == user,
|
||||
"color": conversation.agent.style_color,
|
||||
"icon": conversation.agent.style_icon,
|
||||
"persona": conversation.agent.personality,
|
||||
}
|
||||
if conversation.agent.privacy_level == Agent.PrivacyLevel.PRIVATE:
|
||||
conversation.agent = None
|
||||
else:
|
||||
agent_metadata = {
|
||||
"slug": conversation.agent.slug,
|
||||
"name": conversation.agent.name,
|
||||
"isCreator": conversation.agent.creator == user,
|
||||
"color": conversation.agent.style_color,
|
||||
"icon": conversation.agent.style_icon,
|
||||
"persona": conversation.agent.personality,
|
||||
}
|
||||
|
||||
meta_log = conversation.conversation_log
|
||||
meta_log.update(
|
||||
|
@ -265,14 +268,17 @@ def get_shared_chat(
|
|||
|
||||
agent_metadata = None
|
||||
if conversation.agent:
|
||||
agent_metadata = {
|
||||
"slug": conversation.agent.slug,
|
||||
"name": conversation.agent.name,
|
||||
"isCreator": conversation.agent.creator == user,
|
||||
"color": conversation.agent.style_color,
|
||||
"icon": conversation.agent.style_icon,
|
||||
"persona": conversation.agent.personality,
|
||||
}
|
||||
if conversation.agent.privacy_level == Agent.PrivacyLevel.PRIVATE:
|
||||
conversation.agent = None
|
||||
else:
|
||||
agent_metadata = {
|
||||
"slug": conversation.agent.slug,
|
||||
"name": conversation.agent.name,
|
||||
"isCreator": conversation.agent.creator == user,
|
||||
"color": conversation.agent.style_color,
|
||||
"icon": conversation.agent.style_icon,
|
||||
"persona": conversation.agent.personality,
|
||||
}
|
||||
|
||||
meta_log = conversation.conversation_log
|
||||
scrubbed_title = conversation.title if conversation.title else conversation.slug
|
||||
|
|
Loading…
Add table
Reference in a new issue