fix: 全量修复批量选择、JWT 60min、script-callback 认证与心跳数据流

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name
2026-06-01 12:17:47 +08:00
parent 73fdcafb81
commit 8311821590
25 changed files with 506 additions and 152 deletions
+16
View File
@@ -0,0 +1,16 @@
import { ApiError } from '@/api'
/** Turn FastAPI error bodies into a human-readable string. */
export function formatApiError(e: unknown, fallback: string): string {
if (e instanceof ApiError) {
const d = (e as ApiError & { detail?: unknown }).detail ?? e.message
if (typeof d === 'string') return d
if (Array.isArray(d)) {
return d.map((x: { msg?: string }) => x?.msg || JSON.stringify(x)).join('; ')
}
if (d && typeof d === 'object') return JSON.stringify(d)
return e.message || fallback
}
if (e instanceof Error) return e.message || fallback
return fallback
}