Repair multimodal vision parsing and rerun fallback history
这个提交包含在:
@@ -523,6 +523,54 @@ export const appRouter = router({
|
||||
|
||||
return { count: queued.length, queued };
|
||||
}),
|
||||
|
||||
retryRun: protectedProcedure
|
||||
.input(z.object({ runId: z.number() }))
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const run = await db.getVisionTestRunById(input.runId);
|
||||
if (!run) {
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: "Vision run not found" });
|
||||
}
|
||||
if (ctx.user.role !== "admin" && run.userId !== ctx.user.id) {
|
||||
throw new TRPCError({ code: "FORBIDDEN", message: "No permission to retry this vision run" });
|
||||
}
|
||||
|
||||
await db.resetVisionTestRun(run.taskId);
|
||||
await db.retryBackgroundTask(run.userId, run.taskId);
|
||||
|
||||
if (ctx.user.role === "admin" && run.userId !== ctx.user.id) {
|
||||
await auditAdminAction({
|
||||
adminUserId: ctx.user.id,
|
||||
actionType: "vision_retry_run",
|
||||
entityType: "vision_test_run",
|
||||
entityId: String(run.id),
|
||||
targetUserId: run.userId,
|
||||
payload: { taskId: run.taskId, title: run.title },
|
||||
});
|
||||
}
|
||||
|
||||
return { taskId: run.taskId, runId: run.id };
|
||||
}),
|
||||
|
||||
retryFallbacks: adminProcedure
|
||||
.input(z.object({ limit: z.number().min(1).max(100).default(20) }).optional())
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const runs = await db.listRepairableVisionTestRuns(input?.limit ?? 20);
|
||||
|
||||
for (const run of runs) {
|
||||
await db.resetVisionTestRun(run.taskId);
|
||||
await db.retryBackgroundTask(run.userId, run.taskId);
|
||||
}
|
||||
|
||||
await auditAdminAction({
|
||||
adminUserId: ctx.user.id,
|
||||
actionType: "vision_retry_fallbacks",
|
||||
entityType: "vision_test_run",
|
||||
payload: { count: runs.length, runIds: runs.map((item) => item.id) },
|
||||
});
|
||||
|
||||
return { count: runs.length, runIds: runs.map((item) => item.id) };
|
||||
}),
|
||||
}),
|
||||
|
||||
task: router({
|
||||
|
||||
在新工单中引用
屏蔽一个用户