refactor(*): 代码质量治理 - 收敛接口客户端、模型职责与异步计费巡检

This commit is contained in:
ddCat
2026-08-06 16:36:51 +08:00
parent 9ca9dd9df6
commit b3199c5e7e
42 changed files with 3051 additions and 2271 deletions

View File

@@ -1,8 +1,6 @@
import axios from "axios";
import { apiClient, request } from "@/services/api/request";
import type { BackendEnvelope } from "@/services/api/task-center";
const api = axios.create({ baseURL: import.meta.env.VITE_CANVAS_BACKEND_URL || "/api", withCredentials: true });
const api = apiClient;
export type Project = {
id: string;
@@ -167,16 +165,6 @@ export type ProjectDetail = {
assetCandidates: ProjectAssetCandidate[];
};
async function request<T>(promise: Promise<{ data: BackendEnvelope<T> }>) {
try {
const response = await promise;
if (response.data.code !== 0) throw new Error(response.data.msg || "请求失败");
return response.data.data;
} catch (error) {
if (axios.isAxiosError<BackendEnvelope<unknown>>(error)) throw new Error(error.response?.data?.msg || error.message || "请求失败");
throw error;
}
}
export function listProjects() {
return request<{ projects: ProjectSummary[] }>(api.get("/projects"));