diff --git a/apps/web/src/pages/assets/AssetLibrary.tsx b/apps/web/src/pages/assets/AssetLibrary.tsx index 2f945e4dc..4bee329b0 100755 --- a/apps/web/src/pages/assets/AssetLibrary.tsx +++ b/apps/web/src/pages/assets/AssetLibrary.tsx @@ -32,6 +32,7 @@ import { ThunderboltOutlined, CheckCircleOutlined, CloseCircleOutlined, + AudioOutlined, } from "@ant-design/icons" import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query" import { @@ -56,7 +57,7 @@ import "./assets.css" /* ============================================================ * 类型 * ============================================================ */ -type AssetKind = "video" | "image" +type AssetKind = "video" | "image" | "voice" type StatusType = "ok" | "warn" | "bad" | "info" interface LibraryItem { @@ -88,6 +89,7 @@ interface AssetItem { /** 根据 mime_type 推断前端 AssetKind */ const inferKind = (mimeType: string): AssetKind => { if (mimeType.startsWith("video/")) return "video" + if (mimeType.startsWith("audio/")) return "voice" return "image" } @@ -142,7 +144,7 @@ const formatDuration = (seconds: number): string => { const mapLibrary = (item: AssetLibraryItem): LibraryItem => ({ id: item.id, name: item.name, - kind: (item.kind === "voice" ? "video" : item.kind) || inferKind("video"), + kind: item.kind || inferKind("video"), count: item.asset_count ?? 0, }) @@ -191,6 +193,8 @@ const kindIcon = (kind: AssetKind) => { return case "image": return + case "voice": + return } } @@ -200,6 +204,8 @@ const kindLabel = (kind: AssetKind) => { return "视频" case "image": return "图片" + case "voice": + return "配音" } } @@ -210,6 +216,8 @@ const thumbGradient = (kind: AssetKind): string => { return "linear-gradient(135deg, #312e81 0%, #4f46e5 50%, #6366f1 100%)" case "image": return "linear-gradient(135deg, #78350f 0%, #d97706 50%, #f59e0b 100%)" + case "voice": + return "linear-gradient(135deg, #064e3b 0%, #059669 50%, #10b981 100%)" } }