fix function require

This commit is contained in:
CakeCN
2025-09-11 21:58:22 +08:00
parent 6bd8b30513
commit d3bc321540

View File

@@ -46,7 +46,6 @@ class AgentNamespace(Namespace):
ex = current_app.extensions ex = current_app.extensions
uuid2username = ex["uuid2username"] uuid2username = ex["uuid2username"]
backboard_manager = ex["backboard_manager"] backboard_manager = ex["backboard_manager"]
agent_manager = ex["agent_manager"]
data = json.loads(data) data = json.loads(data)
user_uuid = data['user_uuid'] user_uuid = data['user_uuid']
course_id = data['course_id'] course_id = data['course_id']
@@ -112,7 +111,7 @@ class AgentNamespace(Namespace):
# emit('message',reply, room=uuid, namespace='/agent') # emit('message',reply, room=uuid, namespace='/agent')
# emit('request_function',res.content['function'], room=uuid, namespace='/agent') # emit('request_function',res.content['function'], room=uuid, namespace='/agent')
if data['type'] == 'function': if data['type'] == 'function': # 在这里 前端会发送允许执行的function与参数
print("function_call", data['data']) print("function_call", data['data'])
agent_manager.function_call(uuid, data['data']) agent_manager.function_call(uuid, data['data'])
@@ -126,7 +125,8 @@ class AgentNamespace(Namespace):
def receive_ase_next_chapter(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data): def receive_ase_next_chapter(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
print("receive_ase_next_chapter", data) print("receive_ase_next_chapter", data)
namespace_entry.emit('next_chapter', room=init_data['room'], namespace='/agent') namespace_entry.emit('request_function',data['data'], room=init_data['room'], namespace='/agent')
# namespace_entry.emit('next_chapter', room=init_data['room'], namespace='/agent')
def on_initiative(self,data): def on_initiative(self,data):
print("User active function call") print("User active function call")