Agent actions and gral function. Need agent classes to separate advanced agent functionality.

This commit is contained in:
Shivering Ocelot committed 2025-05-27 23:51:28 -05:00
1 parent c3e55e89f2
commit 9a8e68f021
8 files changed
+222 -53

No files matched your search

+15
View File
@@ -25,6 +25,7 @@ class App:
self.data_directory = data_directory
self.sql_engine = db.create_sql_engine(self.data_directory)
self.user_connections = {}
self.remote_connections = {}
self.streams = {}
if replicate_api_token:
@@ -51,6 +52,15 @@ class App:
if not self.user_connections[user_id]: # Check if the list is empty
del self.user_connections[user_id]
def add_remote_connection(self, user_id, remotename, channel):
if user_id not in self.remote_connections:
self.remote_connections[user_id] = {}
user_connections = self.remote_connections[user_id]
if channel_list not in user_connections[remotename]:
user_connections[remotename] = []
user_connections[remotename].append(channel)
def create_agent(self, user_id, name, description, picture, kind, data):
with self.sql_session() as session:
agent = db.Agent()
@@ -276,6 +286,11 @@ class App:
response = await control.prompt(message)
return response
async def call_agent_action(self, agent_id, action, args):
control = self.get_agent_control(agent_id)
response = await control.execute_action(action, args)
return response
def notify_message_to_user(self, user_id, message):
if user_id in self.user_connections:
user_message = {