vscode plugin ws ok
This commit is contained in:
12
Html/app.py
12
Html/app.py
@@ -14,8 +14,8 @@ sys.path.insert(0, current_dir)
|
||||
from AlgoriAgent.projects.algoriAgent.agent_manager import AgentManager
|
||||
|
||||
app = Flask(__name__)
|
||||
socketio = SocketIO(app, cors_allowed_origins="*",ping_timeout=60, ping_interval=5)
|
||||
# socketio = SocketIO(app, cors_allowed_origins="http://localhost:9888") # 设置跨域支持
|
||||
# socketio = SocketIO(app, cors_allowed_origins="*",ping_timeout=60, ping_interval=5)
|
||||
socketio = SocketIO(app, cors_allowed_origins="http://localhost:9888") # 设置跨域支持
|
||||
import logging
|
||||
app.secret_key = 'cakebaker'
|
||||
app.logger.setLevel(logging.DEBUG)
|
||||
@@ -35,6 +35,7 @@ uuid2user_id = {}
|
||||
user_id2uuid = {}
|
||||
|
||||
|
||||
|
||||
# 定义命名空间:用于和 VSCode 插件交流
|
||||
class VSCodeNamespace(Namespace):
|
||||
def on_login(self,data):
|
||||
@@ -97,9 +98,10 @@ agent_manager = AgentManager()
|
||||
|
||||
|
||||
class AgentNamespace(Namespace):
|
||||
def on_connect(self):
|
||||
user = request.args.get('username')
|
||||
folder_name = request.args.get('folder')
|
||||
def on_login(self, data):
|
||||
data = json.loads(data)
|
||||
user = data['username']
|
||||
folder_name = data['folder']
|
||||
user_uuid = user_id2uuid[user]
|
||||
session['user_id'] = user_uuid
|
||||
print(f'User connected with session user_id: {user_uuid}')
|
||||
|
||||
Reference in New Issue
Block a user