feat(opc): 算力中心 /opc/compute 转发 server-core(修复 base/模型/令牌)

- 新增 GET /opc/compute/{base,models,prices,tokens} + POST /opc/compute/tokens + DELETE /opc/compute/tokens/{id}
- 转发到 server-core(DEMO_API_BASE_URL) 并透传 JWT; 修复 OPC 桌面端算力中心页数据与令牌创建/删除(此前 404)
This commit is contained in:
Pine
2026-08-25 14:03:40 +08:00
parent 119c6d0185
commit c033e3f824
+33
View File
@@ -273,6 +273,39 @@ async def opc_add_finance(req: dict, request: Request):
return await forward("POST", "/opc/finance/record", body=req, auth_header=_auth(request))
# ---------------------------------------------------------------------------
# 算力中心(转发 server-core /opc/compute,透传 JWT
# ---------------------------------------------------------------------------
@router.get("/opc/compute/base")
async def opc_compute_base(request: Request):
return await forward("GET", "/opc/compute/base", auth_header=_auth(request))
@router.get("/opc/compute/models")
async def opc_compute_models(request: Request):
return await forward("GET", "/opc/compute/models", auth_header=_auth(request))
@router.get("/opc/compute/prices")
async def opc_compute_prices(request: Request):
return await forward("GET", "/opc/compute/prices", auth_header=_auth(request))
@router.get("/opc/compute/tokens")
async def opc_compute_tokens(request: Request):
return await forward("GET", "/opc/compute/tokens", auth_header=_auth(request))
@router.post("/opc/compute/tokens")
async def opc_compute_tokens_create(request: Request):
return await forward("POST", "/opc/compute/tokens", body={}, auth_header=_auth(request))
@router.delete("/opc/compute/tokens/{token_id}")
async def opc_compute_tokens_delete(token_id: int, request: Request):
return await forward("DELETE", f"/opc/compute/tokens/{token_id}", auth_header=_auth(request))
# ---------------------------------------------------------------------------
# 各业务端口工作台
# ---------------------------------------------------------------------------