fix clear session

This commit is contained in:
CakeCN
2025-12-11 22:40:43 +08:00
parent c4743bcadd
commit 58a25b3e07
2 changed files with 4 additions and 4 deletions

View File

@@ -34,7 +34,6 @@ def on_connect_to_ase(client, entry, init_data, **kwargs):
restart = init_data.get("restart", False) restart = init_data.get("restart", False)
if restart: # 重启时,从-1章进入 0章 if restart: # 重启时,从-1章进入 0章
clear_user_session(init_data['asengine_url'], init_data['asengine_token'], init_data['room'])
ase_client.chatmanager.next_chapter() ase_client.chatmanager.next_chapter()
ase_client.chatmanager.load_now_chapter(load_code=restart) ase_client.chatmanager.load_now_chapter(load_code=restart)
print("load_now_chapter with restart:", restart) print("load_now_chapter with restart:", restart)

View File

@@ -23,7 +23,8 @@ from ..services.asectrl_service import (
receive_ase_process, receive_ase_process,
receive_ase_judge, receive_ase_judge,
receive_ase_next_chapter, receive_ase_next_chapter,
receive_ase_chapter_score receive_ase_chapter_score,
clear_user_session
) )
@@ -129,7 +130,7 @@ class AgentNamespace(Namespace):
chatmanager.function_manager.add_function(judge, {'course_id': course_id, 'root_path': f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}'}) chatmanager.function_manager.add_function(judge, {'course_id': course_id, 'root_path': f'/home/{user_id}/{course_id}/{chapter_name}/{lesson_name}'})
chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid}) chatmanager.function_manager.add_function(next_chapter, {'user_uuid': user_uuid})
clear_user_session(current_app.config["ASE_ENGINE_URL"], current_app.config["ASE_ENGINE_URL_TOKEN"], user_id)
continue_learn = not chatmanager.restart continue_learn = not chatmanager.restart
need_skip_chapters = self._load_learning_progress(chatmanager, user_id, course_id, chapter_name, lesson_name, continue_learn) need_skip_chapters = self._load_learning_progress(chatmanager, user_id, course_id, chapter_name, lesson_name, continue_learn)
@@ -154,7 +155,7 @@ class AgentNamespace(Namespace):
user_uuid2ase_client[user_uuid].register_on_connect_entry( user_uuid2ase_client[user_uuid].register_on_connect_entry(
callback=on_connect_to_ase, callback=on_connect_to_ase,
entry=(self, user_uuid2ase_client[user_uuid]), entry=(self, user_uuid2ase_client[user_uuid]),
init_data={'room':user_uuid, 'restart':chatmanager.restart, 'asengine_url':current_app.config["ASE_ENGINE_URL"], 'asengine_token':current_app.config["ASE_ENGINE_URL_TOKEN"]} init_data={'room':user_uuid, 'restart':chatmanager.restart}
) )
user_uuid2ase_client[user_uuid].register_route_with_entry( user_uuid2ase_client[user_uuid].register_route_with_entry(
route='dialog', route='dialog',