feat:部署服务器报错

This commit is contained in:
liailing1026
2026-01-29 16:40:10 +08:00
parent 1749ae4f1e
commit b3e6c7a618
2 changed files with 6 additions and 3 deletions

View File

@@ -7,3 +7,4 @@ mistralai==0.1.6
flask-socketio==5.3.6
python-socketio==5.11.0
simple-websocket==1.0.0
eventlet==0.40.4

View File

@@ -26,7 +26,7 @@ try:
with open(yaml_file, "r", encoding="utf-8") as file:
yaml_data = yaml.safe_load(file)
except Exception:
yaml_file = {}
yaml_data = {}
USE_CACHE: bool = os.getenv("USE_CACHE")
if USE_CACHE is None:
USE_CACHE = yaml_data.get("USE_CACHE", False)
@@ -37,7 +37,8 @@ AgentProfile_Dict = {}
Request_Cache: dict[str, str] = {}
app = Flask(__name__)
app.config['SECRET_KEY'] = 'agentcoord-secret-key'
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
# socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
socketio = SocketIO(app, cors_allowed_origins="*", async_mode='eventlet')
def truncate_rehearsal_log(RehearsalLog: List, restart_from_step_index: int) -> List:
@@ -1767,4 +1768,5 @@ if __name__ == "__main__":
args = parser.parse_args()
init()
# 使用 socketio.run 替代 app.run支持WebSocket
socketio.run(app, host="0.0.0.0", port=args.port, debug=True, allow_unsafe_werkzeug=True)
# socketio.run(app, host="0.0.0.0", port=args.port, debug=True, allow_unsafe_werkzeug=True)
socketio.run(app, host="0.0.0.0", port=args.port, debug=False, allow_unsafe_werkzeug=True)