From 368586d33ea76dc5b1919789ee2a59ed87d2f06e Mon Sep 17 00:00:00 2001 From: "Azmat@qq.com" Date: Fri, 21 Aug 2026 18:41:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/frontend/src/admin-page.css | 15 +- core/frontend/src/components/overlays.tsx | 4 +- .../frontend/src/routes/admin/admin-tasks.tsx | 148 +++++++++--------- 3 files changed, 87 insertions(+), 80 deletions(-) diff --git a/core/frontend/src/admin-page.css b/core/frontend/src/admin-page.css index 2e3aa53..3de20be 100644 --- a/core/frontend/src/admin-page.css +++ b/core/frontend/src/admin-page.css @@ -539,7 +539,17 @@ } .admin-anomaly-chip { height: 28px; padding: 0 14px; font-size: 12.5px; cursor: pointer; } -.admin-drawer { width: 620px; max-width: 92vw; } +.admin-drawer { + --klein: #002fa7; + --st-muted: #6f747c; + --st-text: #17181a; + --st-line: rgba(34, 42, 54, 0.10); + --st-wash: rgba(34, 42, 54, 0.045); + width: 620px; + max-width: 92vw; + z-index: 1800; +} +.drawer-bg:has(+ .admin-drawer) { z-index: 1790; } .admin-json { background: var(--st-wash); border: 1px solid var(--st-line); @@ -551,7 +561,8 @@ line-height: 1.6; color: var(--black-alpha-72, var(--accent-black)); white-space: pre-wrap; - word-break: break-all; + overflow-wrap: anywhere; + word-break: break-word; max-height: 260px; overflow: auto; } diff --git a/core/frontend/src/components/overlays.tsx b/core/frontend/src/components/overlays.tsx index 0889b1d..a880fa7 100644 --- a/core/frontend/src/components/overlays.tsx +++ b/core/frontend/src/components/overlays.tsx @@ -181,7 +181,7 @@ export function SuccessModal({ open, title, detail, actions, close }: { ); } -export function Drawer({ title, open, close, children }: { title: string; open: boolean; close: () => void; children: ReactNode }) { +export function Drawer({ title, open, close, children, className }: { title: string; open: boolean; close: () => void; children: ReactNode; className?: string }) { useBodyScrollLock(open); const { mounted, show } = useOverlayTransition(open, close); if (!mounted) return null; @@ -189,7 +189,7 @@ export function Drawer({ title, open, close, children }: { title: string; open: return createPortal( <>
-
)} - {(detail || detailLoading) && ( -
{ if (e.target === e.currentTarget) setDetail(null); }}> -
-
-

任务详情

- + { setDetail(null); setDetailLoading(false); }} + className="admin-drawer" + > + {detailLoading || !detail ? ( + + ) : ( + <> + {(() => { + const attempts = detail.attempts || []; + const finalAttempt = [...attempts].reverse().find((attempt) => attempt.status === "succeeded"); + const fallbackUsed = attempts.some((attempt) => attempt.is_fallback); + return ( +
+
状态{statusPill(detail.status)}
+
团队{detail.team_name || "—"}
+
模型{detail.model_name || "—"}
+
计价{pts(detail.estimated_cost)} → {pts(detail.actual_cost)} 积分{detail.cost_anomaly ? " ⚠" : ""}
+
平台成本{Number(detail.base_cost || 0) > 0 ? `¥${detail.base_cost} · 毛利 ${detail.margin_yuan != null ? `¥${detail.margin_yuan}` : "—"}` : "未知"}
+
模型调用{attempts.length ? `${attempts.length} 次 · ${fallbackUsed ? "发生 Fallback" : "未切换"}` : "旧任务 · 无尝试链"}
+ {finalAttempt &&
最终成功模型{finalAttempt.provider_display_name || finalAttempt.provider_name} / {finalAttempt.model_display_name || finalAttempt.model_name}
}
-
- {detailLoading || !detail ? ( - - ) : ( - <> - {(() => { - const attempts = detail.attempts || []; - const finalAttempt = [...attempts].reverse().find((attempt) => attempt.status === "succeeded"); - const fallbackUsed = attempts.some((attempt) => attempt.is_fallback); - return ( -
-
状态{statusPill(detail.status)}
-
团队{detail.team_name || "—"}
-
模型{detail.model_name || "—"}
-
计价{pts(detail.estimated_cost)} → {pts(detail.actual_cost)} 积分{detail.cost_anomaly ? " ⚠" : ""}
-
平台成本{Number(detail.base_cost || 0) > 0 ? `¥${detail.base_cost} · 毛利 ${detail.margin_yuan != null ? `¥${detail.margin_yuan}` : "—"}` : "未知"}
-
模型调用{attempts.length ? `${attempts.length} 次 · ${fallbackUsed ? "发生 Fallback" : "未切换"}` : "旧任务 · 无尝试链"}
- {finalAttempt &&
最终成功模型{finalAttempt.provider_display_name || finalAttempt.provider_name} / {finalAttempt.model_display_name || finalAttempt.model_name}
} -
- ); - })()} - {detail.attempts?.length > 0 && ( - <> -
模型调用链 · {detail.attempts.length} 次
-
- {detail.attempts.map((attempt) => ( -
-
- {String(attempt.sequence).padStart(2, "0")} - {statusPill(attempt.status)} - {attemptKind(attempt)} -
-
- {attempt.provider_display_name || attempt.provider_name} - / - {attempt.model_display_name || attempt.model_name} -
-
- {attempt.operation} - {attempt.duration_ms == null ? "耗时 —" : `耗时 ${attempt.duration_ms} ms`} - {Number(attempt.platform_cost || 0) > 0 ? `平台成本 ¥${attempt.platform_cost}` : "平台成本未知"} - {attempt.provider_task_id && Provider ID {attempt.provider_task_id}} -
- {(attempt.error_type || attempt.raw_error) && ( -
- [{attempt.error_type || "unknown"}{attempt.provider_error_code ? ` · ${attempt.provider_error_code}` : ""}] - {attempt.raw_error || attempt.safe_error_summary} -
- )} -
- ))} + ); + })()} + {detail.attempts?.length > 0 && ( + <> +
模型调用链 · {detail.attempts.length} 次
+
+ {detail.attempts.map((attempt) => ( +
+
+ {String(attempt.sequence).padStart(2, "0")} + {statusPill(attempt.status)} + {attemptKind(attempt)}
- - )} - {detail.error_message && ( - <> -
错误
-
{detail.error_message}
- - )} -
请求 payload
-
{JSON.stringify(detail.request_payload, null, 2)}
-
响应 payload
-
{JSON.stringify(detail.response_payload, null, 2)}
- - )} -
-
-
- )} +
+ {attempt.provider_display_name || attempt.provider_name} + / + {attempt.model_display_name || attempt.model_name} +
+
+ {attempt.operation} + {attempt.duration_ms == null ? "耗时 —" : `耗时 ${attempt.duration_ms} ms`} + {Number(attempt.platform_cost || 0) > 0 ? `平台成本 ¥${attempt.platform_cost}` : "平台成本未知"} + {attempt.provider_task_id && Provider ID {attempt.provider_task_id}} +
+ {(attempt.error_type || attempt.raw_error) && ( +
+ [{attempt.error_type || "unknown"}{attempt.provider_error_code ? ` · ${attempt.provider_error_code}` : ""}] + {attempt.raw_error || attempt.safe_error_summary} +
+ )} +
+ ))} +
+ + )} + {detail.error_message && ( + <> +
错误
+
{detail.error_message}
+ + )} +
请求 payload
+
{JSON.stringify(detail.request_payload, null, 2)}
+
响应 payload
+
{JSON.stringify(detail.response_payload, null, 2)}
+ + )} + ); }