2 Commits

Author SHA1 Message Date
CakeCN
58a25b3e07 fix clear session 2025-12-11 22:40:43 +08:00
CakeCN
c4743bcadd restart with clear user_session 2025-12-11 22:37:58 +08:00
3 changed files with 4 additions and 6 deletions

View File

@@ -31,8 +31,6 @@ def on_connect_to_ase(client, entry, init_data, **kwargs):
namespace_entry, ase_client = entry
namespace_entry.emit('open-iframe',"", room=init_data['room'], namespace='/agent')
namespace_entry.emit('message', "Agents服务已连接, 加载教案中", room=init_data['room'], namespace='/agent')
clear_user_session(init_data['asengine_url'], init_data['asengine_token'], init_data['room'])
restart = init_data.get("restart", False)
if restart: # 重启时,从-1章进入 0章

View File

@@ -23,7 +23,8 @@ from ..services.asectrl_service import (
receive_ase_process,
receive_ase_judge,
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(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
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(
callback=on_connect_to_ase,
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(
route='dialog',

View File

@@ -424,7 +424,6 @@ window.addEventListener('beforeunload', () => {
let currentChapterIndex = -1;
function next_chapter(data) {
// 直接获取页面中的 h3 元素(不再使用 iframe
var container = document.getElementById('markdown-content-container');
var titles = [];
var h3Elements = container.querySelectorAll('h3');