diff --git a/Html/apps/sockets/namespaces.py b/Html/apps/sockets/namespaces.py
index 48dd91a..8f40c80 100644
--- a/Html/apps/sockets/namespaces.py
+++ b/Html/apps/sockets/namespaces.py
@@ -63,6 +63,11 @@ class VSCodeNamespace(Namespace):
class AgentNamespace(Namespace):
+ def __init__(self):
+ super().__init__()
+ # 使用字典存储每个用户的chatmanager和ase_client,避免多用户冲突
+ self.user_chatmanagers = {}
+ self.user_ase_clients = {}
def _load_learning_progress(self, chatmanager, user_id, course_id, chapter_name, lesson_name, continue_learn):
"""加载并恢复用户学习进度
@@ -153,8 +158,9 @@ class AgentNamespace(Namespace):
if chatmanager.chat_historys:
emit('messages', chatmanager.chat_historys, room=user_uuid, namespace='/agent')
- self.chatmanager = chatmanager
- self.ase_client = user_uuid2ase_client[user_uuid]
+ # 存储每个用户的chatmanager和ase_client到字典中,使用用户UUID作为键
+ self.user_chatmanagers[user_uuid] = chatmanager
+ self.user_ase_clients[user_uuid] = user_uuid2ase_client[user_uuid]
# 将restart设置为False,避免后续重复处理
restart = chatmanager.restart
diff --git a/Html/apps/static/js/chatbox.js b/Html/apps/static/js/chatbox.js
index 7027d82..c160d6c 100644
--- a/Html/apps/static/js/chatbox.js
+++ b/Html/apps/static/js/chatbox.js
@@ -75,9 +75,6 @@ document.addEventListener('DOMContentLoaded', function () {
folder: user_data.folder
}
});
- console.log('Connecting to WebSocket server at wss://${host}/agent');
- console.log(user_data);
-
// 初始化聊天消息管理器
chatManager = new ChatMessageManager();
socket.on('connect', function () {