backend: separated agent classes. frontend: chat message context menu (does nothing)
This commit is contained in:
1 parent
3f37f727af
commit
22fe5619d8
5 files changed
+205
-82
No files matched your search
+13
-3
@@ -10,8 +10,8 @@ from quart import Quart, Response, request, send_from_directory, jsonify, websoc
|
||||
import replicate
|
||||
|
||||
import database as db
|
||||
import agent as agent_mod
|
||||
from server import start_server
|
||||
from agent import Agent
|
||||
|
||||
MESSAGE_PAGE_SIZE = 32
|
||||
|
||||
@@ -34,7 +34,12 @@ class App:
|
||||
raise Exception("Horde only works with a replicate connection. Please provide an API Token.")
|
||||
|
||||
# `Agent` is the kind 'basic', will be class `BasicAgent` in the future
|
||||
self.agent_classes = [Agent]
|
||||
self.agent_classes = [
|
||||
agent_mod.BasicAgent,
|
||||
agent_mod.Llama8bAgent,
|
||||
agent_mod.CoderV1Agent,
|
||||
agent_mod.ToolUsingAgent,
|
||||
]
|
||||
|
||||
def sql_session(self):
|
||||
return Session(self.sql_engine)
|
||||
@@ -255,8 +260,13 @@ class App:
|
||||
|
||||
if not agent:
|
||||
raise Exception(f"Agent not found with id {agent_id}")
|
||||
|
||||
agent_class = next((kind for kind in self.agent_classes if kind.identifier == agent.kind), None)
|
||||
if agent_class is None:
|
||||
raise Exception(f"invalid agent kind: {agent.kind}")
|
||||
|
||||
control = Agent.create_from_data(app, agent_id, agent.kind, agent.data)
|
||||
control = agent_class(app, agent.data)
|
||||
control._set_basic_info(agent_id, agent.name)
|
||||
return control
|
||||
|
||||
def get_agent_config_fields(self, agent_id):
|
||||
|
||||
Reference in new issue
Block a user