mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +00:00
Merge branch 'features/add-agents-ui' of github.com:khoj-ai/khoj into features/chat-socket-streaming
This commit is contained in:
@@ -394,8 +394,9 @@ class ClientApplicationAdapters:
|
||||
|
||||
|
||||
class AgentAdapters:
|
||||
DEFAULT_AGENT_NAME = "khoj"
|
||||
DEFAULT_AGENT_NAME = "Khoj"
|
||||
DEFAULT_AGENT_AVATAR = "https://khoj-web-bucket.s3.amazonaws.com/lamp-128.png"
|
||||
DEFAULT_AGENT_SLUG = "khoj"
|
||||
|
||||
@staticmethod
|
||||
async def aget_agent_by_id(agent_id: int):
|
||||
@@ -447,6 +448,8 @@ class AgentAdapters:
|
||||
agent = Agent.objects.filter(name=AgentAdapters.DEFAULT_AGENT_NAME).first()
|
||||
agent.tuning = default_personality
|
||||
agent.chat_model = default_conversation_config
|
||||
agent.slug = AgentAdapters.DEFAULT_AGENT_SLUG
|
||||
agent.name = AgentAdapters.DEFAULT_AGENT_NAME
|
||||
agent.save()
|
||||
return agent
|
||||
|
||||
@@ -459,6 +462,7 @@ class AgentAdapters:
|
||||
tuning=default_personality,
|
||||
tools=["*"],
|
||||
avatar=AgentAdapters.DEFAULT_AGENT_AVATAR,
|
||||
slug=AgentAdapters.DEFAULT_AGENT_SLUG,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@@ -36,4 +36,8 @@ async def all_agents(
|
||||
"managed_by_admin": agent.managed_by_admin,
|
||||
}
|
||||
)
|
||||
|
||||
# Make sure that the agent named 'khoj' is first in the list. Everything else is sorted by name.
|
||||
agents_packet.sort(key=lambda x: x["name"])
|
||||
agents_packet.sort(key=lambda x: x["slug"] == "khoj", reverse=True)
|
||||
return Response(content=json.dumps(agents_packet), media_type="application/json", status_code=200)
|
||||
|
||||
Reference in New Issue
Block a user