function call and return

This commit is contained in:
CakeCN
2025-09-14 13:31:07 +08:00
parent b1e132db8d
commit 72f6573c9d

View File

@@ -5,10 +5,9 @@ from flask_socketio import Namespace, join_room, leave_room, emit
from ..function_tools import judge
from ..function_tools import next_chapter
from ..services.memory_service import save_chapter_memory_by_uuid
from ..services.backboard_service import realtime_response
from ..services.markdown_service import load_full_markdown_file
from ..extension_ase.ase_client import HSAEngineClient, ChatManager
from ..extension_ase.ase_client import HSAEngineClient
@@ -112,7 +111,9 @@ class AgentNamespace(Namespace):
if data['type'] == 'function': # 在这里 前端会发送允许执行的function与参数
print("function_call", data['data'])
chatmanager[uuid].function_call(uuid, data['data'])
res = chatmanager[uuid].function_call(uuid, data['data'])
data['data'] = res
emit(data['route'], data, room=uuid, namespace='/agent')
def receive_ase_dialog(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
@@ -121,7 +122,7 @@ class AgentNamespace(Namespace):
def receive_ase_judge(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
print("receive_ase_judge", data)
namespace_entry.emit('request_function', data['data'], room=init_data['room'], namespace='/agent') # data 是一个列表 /dict也支持
namespace_entry.emit('request_function', data, room=init_data['room'], namespace='/agent') # data 是一个列表 /dict也支持
def receive_ase_next_chapter(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
print("receive_ase_next_chapter", data)