fix(media): 视频任务 - 统一轮询超时并支持失败任务人工恢复
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
|
||||
import type { ModelChannel } from "@/stores/use-config-store";
|
||||
import type { CreditLedgerEntry } from "@/services/api/wallet";
|
||||
import type { GenerationTask, TaskStatus } from "@/services/api/task-center";
|
||||
|
||||
const api = axios.create({ baseURL: import.meta.env.VITE_CANVAS_BACKEND_URL || "/api", withCredentials: true });
|
||||
|
||||
@@ -46,6 +47,7 @@ export type ApiCallLog = {
|
||||
channelId: string;
|
||||
channelName: string;
|
||||
taskId?: string;
|
||||
taskStatus?: TaskStatus;
|
||||
source: string;
|
||||
capability: "text" | "image" | "video" | "audio" | "";
|
||||
operation?: string;
|
||||
@@ -83,6 +85,13 @@ export type ApiCallLog = {
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
export type AdminProviderTaskQueryResult = {
|
||||
task: GenerationTask;
|
||||
providerStatus: string;
|
||||
recovered: boolean;
|
||||
billingSettled: boolean;
|
||||
};
|
||||
|
||||
export type AdminAuditEvent = {
|
||||
id: string;
|
||||
actorUserId: string;
|
||||
@@ -430,6 +439,10 @@ export function getAdminApiLog(id: string) {
|
||||
return request<{ log: ApiCallLog }>(api.get(`/admin/api-logs/${encodeURIComponent(id)}`));
|
||||
}
|
||||
|
||||
export function queryAdminApiLogTask(id: string) {
|
||||
return request<AdminProviderTaskQueryResult>(api.post(`/admin/api-logs/${encodeURIComponent(id)}/query-task`));
|
||||
}
|
||||
|
||||
export async function exportAdminApiLogs(params: AdminListParams & { ids?: string[] } = {}) {
|
||||
const response = await api.get<Blob>("/admin/api-logs-export.csv", { params: { ...params, ids: params.ids?.join(",") }, responseType: "blob" });
|
||||
return response.data;
|
||||
|
||||
@@ -24,6 +24,7 @@ export type GenerationTask = {
|
||||
operation?: string;
|
||||
provider?: string;
|
||||
model?: string;
|
||||
providerRequestId?: string;
|
||||
errorCode?: string;
|
||||
previewUrl?: string;
|
||||
previewKind?: "image" | "video";
|
||||
@@ -43,6 +44,13 @@ export type GenerationTask = {
|
||||
updated_at?: string;
|
||||
};
|
||||
|
||||
export type ProviderTaskQueryResult = {
|
||||
task: GenerationTask;
|
||||
providerStatus: string;
|
||||
recovered: boolean;
|
||||
billingSettled: boolean;
|
||||
};
|
||||
|
||||
export type AgentSession = {
|
||||
id: string;
|
||||
projectId?: string;
|
||||
@@ -185,6 +193,10 @@ export function retryGenerationTask(id: string) {
|
||||
return request<GenerationTask>(api.post(`/tasks/${encodeURIComponent(id)}/retry`));
|
||||
}
|
||||
|
||||
export function queryFailedVideoProviderTask(id: string) {
|
||||
return request<ProviderTaskQueryResult>(api.post(`/tasks/${encodeURIComponent(id)}/query-provider`));
|
||||
}
|
||||
|
||||
export function cancelGenerationTask(id: string) {
|
||||
return request<GenerationTask>(api.post(`/tasks/${encodeURIComponent(id)}/cancel`));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user