show and update agentname/identifier
This commit is contained in:
1 parent
6530ff0a24
commit
ba48846ba1
3 files changed
+109
-2
No files matched your search
+7
-2
@@ -73,11 +73,12 @@ class App:
|
||||
user_connections[remotename] = []
|
||||
user_connections[remotename].append(channel)
|
||||
|
||||
def create_agent(self, user_id, name, description, picture, kind, data):
|
||||
def create_agent(self, user_id, name, agentname, description, picture, kind, data):
|
||||
with self.sql_session() as session:
|
||||
agent = db.Agent()
|
||||
agent.user_id = user_id
|
||||
agent.name = name
|
||||
agent.agentname = agentname
|
||||
agent.description = description
|
||||
agent.picture = picture
|
||||
agent.kind = kind
|
||||
@@ -108,7 +109,7 @@ class App:
|
||||
return chat_id
|
||||
|
||||
# Updates the agent's basic fields, and applies field updates in its data
|
||||
def update_agent(self, agent_id, name=None, description=None, picture=None, data=None):
|
||||
def update_agent(self, agent_id, name=None, description=None, picture=None, agentname=None, data=None):
|
||||
with self.sql_session() as session:
|
||||
agent = session.execute(
|
||||
select(db.Agent).where(db.Agent.id == agent_id)
|
||||
@@ -128,6 +129,9 @@ class App:
|
||||
if picture != None:
|
||||
agent.picture = picture
|
||||
summary.append('picture')
|
||||
if agentname != None:
|
||||
agent.agentname = agentname
|
||||
summary.append('agentname')
|
||||
|
||||
if data:
|
||||
# Assign a copy to trigger a value change
|
||||
@@ -154,6 +158,7 @@ class App:
|
||||
return [{
|
||||
"id": agent.id,
|
||||
"name": agent.name,
|
||||
"agentname": agent.agentname,
|
||||
"description": agent.description,
|
||||
"picture": agent.picture,
|
||||
"kind": agent.kind,
|
||||
|
||||
@@ -122,6 +122,7 @@ def start_server(app):
|
||||
agent_id = app.create_agent(
|
||||
user_id=user_id,
|
||||
name=body['name'],
|
||||
agentname=body.get('agentname'),
|
||||
description=body.get('description'),
|
||||
picture=body.get('picture'),
|
||||
kind=body['kind'],
|
||||
@@ -134,6 +135,7 @@ def start_server(app):
|
||||
app.update_agent(
|
||||
agent_id=agent_id,
|
||||
name=body.get('name'),
|
||||
agentname=body.get('agentname'),
|
||||
description=body.get('description'),
|
||||
picture=body.get('picture'),
|
||||
data=body.get('data', {})
|
||||
|
||||
Reference in new issue
Block a user