add auth check

This commit is contained in:
2026-08-03 11:16:49 +08:00
parent 6330b99860
commit 92780cedef
18 changed files with 381 additions and 242 deletions
+3 -6
View File
@@ -6,14 +6,13 @@
import threading
import io
import requests
import torch
from stable_baselines3 import SAC
# 关键:禁用 PyTorch 内部多线程,防止在 PyInstaller daemon 线程中 segfault
torch.set_num_threads(1)
from api import base_url, data_record_url, the_folder
from api import device_post, the_folder
class ModelManager:
@@ -50,8 +49,7 @@ class ModelManager:
def fetch_models():
try:
payload = {"type": "listModels", "folder": f"{the_folder}/model_config"}
resp = requests.post(data_record_url, json=payload, timeout=10)
result = resp.json()
result = device_post(payload, timeout=10)
if result.get("success"):
files = result.get("files", [])
@@ -98,8 +96,7 @@ class ModelManager:
# 获取临时下载 URL
payload = {"type": "downloadModel", "fileID": file_id}
resp = requests.post(data_record_url, json=payload, timeout=15)
result = resp.json()
result = device_post(payload, timeout=15)
if not result.get("success"):
err = result.get('errMsg', '未知错误')