This commit is contained in:
CakeCN
2024-12-11 20:17:52 +08:00
parent 859dbcfb59
commit 0792ec8c71
2 changed files with 7 additions and 6 deletions

View File

@@ -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,10 +35,11 @@ uuid2user_id = {}
user_id2uuid = {}
# 定义命名空间:用于和 VSCode 插件交流
class VSCodeNamespace(Namespace):
def on_connect(self):
print("VSCode client connected")
def on_login(self,data):
print(f"New login from VSCode client: {data}")
def on_message(self, data):
print(f"Received from VSCode client: {data}")
@@ -239,5 +240,5 @@ socketio.on_namespace(AgentNamespace('/agent'))
if __name__ == '__main__':
socketio.run(app, host='localhost', port=5500, debug=True)
socketio.run(app, host='0.0.0.0', port=5500, debug=True)