diff --git a/Html/apps/function_tools/chapter.py b/Html/apps/function_tools/chapter.py
new file mode 100644
index 0000000..e69de29
diff --git a/Html/apps/sockets/namespaces.py b/Html/apps/sockets/namespaces.py
index 050ee39..d877bf2 100644
--- a/Html/apps/sockets/namespaces.py
+++ b/Html/apps/sockets/namespaces.py
@@ -4,12 +4,14 @@ from flask import current_app, request, session
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
+
class VSCodeNamespace(Namespace):
def on_login(self,data):
ex = current_app.extensions
@@ -69,10 +71,18 @@ class AgentNamespace(Namespace):
entry=self,
init_data={'room': user_uuid}
)
+ user_uuid2ase_client[user_uuid].register_route_with_entry(
+ route='next_chapter',
+ callback=self.receive_ase_next_chapter,
+ entry=self,
+ init_data={'room': user_uuid}
+ )
+
fmd,fmdp,fsp = load_full_markdown_file(course_id, chapter_name, lesson_name)
user_uuid2chatmanager[user_uuid] = ChatManager(user_uuid, user_uuid2ase_client[user_uuid], fmd, fmdp, fsp, max_iter=5, app=current_app, socketio=self)
chatmanager = user_uuid2chatmanager[user_uuid]
chatmanager.function_manager.add_function(judge, {'course_id': course_id, 'lesson_name': lesson_name, 'root_path': f'../../study/{user_id}/{course_id}/{chapter_name}/{lesson_name}'})
+ chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid})
user_uuid2ase_client[user_uuid].loadmarkdown(fmd, fmdp, fsp)
@@ -103,6 +113,7 @@ class AgentNamespace(Namespace):
# emit('request_function',res.content['function'], room=uuid, namespace='/agent')
if data['type'] == 'function':
+ print("function_call", data['data'])
agent_manager.function_call(uuid, data['data'])
@@ -113,6 +124,10 @@ class AgentNamespace(Namespace):
print("receive_ase_judge", data)
namespace_entry.emit('request_function', data['data'], room=init_data['room'], namespace='/agent')
+ def receive_ase_next_chapter(client_entry: HSAEngineClient, namespace_entry: Namespace, data, init_data):
+ print("receive_ase_next_chapter", data)
+ namespace_entry.emit('next_chapter', room=init_data['room'], namespace='/agent')
+
def on_initiative(self,data):
print("User active function call")
ex = current_app.extensions