From 3634167dbada4c8dbb11d6e65fce89cfa4733ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B5=E5=BA=94?= Date: Wed, 8 Jul 2026 09:53:24 +0800 Subject: [PATCH] style: fix prettier formatting in 3 frontend files - AssetLibrary.tsx - GeneratePage.tsx - VoiceLibrary.tsx This fixes the CI Frontend Lint job failure. --- apps/web/src/pages/assets/AssetLibrary.tsx | 15 +- apps/web/src/pages/generate/GeneratePage.tsx | 38 ++- apps/web/src/pages/voices/VoiceLibrary.tsx | 273 ++++++++++++++----- 3 files changed, 240 insertions(+), 86 deletions(-) diff --git a/apps/web/src/pages/assets/AssetLibrary.tsx b/apps/web/src/pages/assets/AssetLibrary.tsx index 8e69d8f83..0958fcf1d 100644 --- a/apps/web/src/pages/assets/AssetLibrary.tsx +++ b/apps/web/src/pages/assets/AssetLibrary.tsx @@ -220,7 +220,15 @@ const AssetCard: React.FC<{ onDiagnose: () => void; onPlay: () => void; onDelete: () => void; -}> = ({ asset, selected, diagnosing, onToggle, onDiagnose, onPlay, onDelete }) => ( +}> = ({ + asset, + selected, + diagnosing, + onToggle, + onDiagnose, + onPlay, + onDelete, +}) => (
- e.stopPropagation()} - > + e.stopPropagation()}> diff --git a/apps/web/src/pages/generate/GeneratePage.tsx b/apps/web/src/pages/generate/GeneratePage.tsx index 4e09b86dc..7ec1ede1d 100644 --- a/apps/web/src/pages/generate/GeneratePage.tsx +++ b/apps/web/src/pages/generate/GeneratePage.tsx @@ -25,7 +25,11 @@ import { } from "@ant-design/icons"; import type { AssetItem } from "@/api/assets"; import { getAssets, getAssetLibraries } from "@/api/assets"; -import { createEditPlan, generateEditPlan, updateEditPlan } from "@/api/editPlans"; +import { + createEditPlan, + generateEditPlan, + updateEditPlan, +} from "@/api/editPlans"; import { getEditingTemplates } from "@/api/editingPlanner"; import { getTitles } from "@/api/titles"; import apiClient from "@/api/client"; @@ -655,26 +659,46 @@ const GeneratePage: React.FC = () => { const translateError = (msg: string): string => { if (!msg) return "生成失败,请检查网络后重试或联系管理员"; // 状态机相关错误 - if (msg.includes("editing") || msg.includes("draft") || msg.includes("状态")) { + if ( + msg.includes("editing") || + msg.includes("draft") || + msg.includes("状态") + ) { return "正在准备生成,请稍候再试"; } // 参数校验错误 - if (msg.includes("template_id") || msg.includes("not found") || msg.includes("不存在")) { + if ( + msg.includes("template_id") || + msg.includes("not found") || + msg.includes("不存在") + ) { return "所选模板或素材不可用,请重新选择"; } - if (msg.includes("asset") && (msg.includes("not found") || msg.includes("missing"))) { + if ( + msg.includes("asset") && + (msg.includes("not found") || msg.includes("missing")) + ) { return "素材数据异常,请返回素材库重新检查"; } // 网络/超时 - if (msg.includes("timeout") || msg.includes("network") || msg.includes("ECONN")) { + if ( + msg.includes("timeout") || + msg.includes("network") || + msg.includes("ECONN") + ) { return "网络连接超时,请检查网络后重试"; } // 配额/限制 - if (msg.includes("quota") || msg.includes("limit") || msg.includes("exceed")) { + if ( + msg.includes("quota") || + msg.includes("limit") || + msg.includes("exceed") + ) { return "已达到生成次数上限,请稍后再试或联系客服"; } // 兜底:返回原始消息(如果已经是中文人话)或默认提示 - if (msg.length > 0 && msg.length < 100 && !msg.includes("{")) return msg; + if (msg.length > 0 && msg.length < 100 && !msg.includes("{")) + return msg; return "生成失败,请稍后重试或联系管理员"; }; const finalMsg = translateError(rawError); diff --git a/apps/web/src/pages/voices/VoiceLibrary.tsx b/apps/web/src/pages/voices/VoiceLibrary.tsx index 63edd3f83..5b742e478 100644 --- a/apps/web/src/pages/voices/VoiceLibrary.tsx +++ b/apps/web/src/pages/voices/VoiceLibrary.tsx @@ -45,11 +45,7 @@ import { toVoiceClone, type VoiceClone, } from "@/api/voiceClone"; -import { - synthesizeSpeech, - getTTSJobStatus, - saveTtsToLibrary, -} from "@/api/tts"; +import { synthesizeSpeech, getTTSJobStatus, saveTtsToLibrary } from "@/api/tts"; import { uploadAssetDirect, getAssetLibraries, @@ -673,7 +669,9 @@ const VoiceLibrary: React.FC = () => { const [ttsVoiceId, setTtsVoiceId] = useState(""); const [ttsSpeed, setTtsSpeed] = useState(1.0); const [ttsJobId, setTtsJobId] = useState(null); - const [ttsStatus, setTtsStatus] = useState<"idle" | "synthesizing" | "done" | "error">("idle"); + const [ttsStatus, setTtsStatus] = useState< + "idle" | "synthesizing" | "done" | "error" + >("idle"); const [ttsAudioUrl, setTtsAudioUrl] = useState(null); const [ttsError, setTtsError] = useState(null); const ttsTimerRef = useRef | null>(null); @@ -1222,7 +1220,14 @@ const VoiceLibrary: React.FC = () => { width={520} maskClosable={uploadProgress === null} > -
+
{/* 拖拽上传区 */} { showUploadList={false} disabled={uploadProgress !== null} > -

+

点击或拖拽音频文件到此处

-

+

支持 MP3、WAV、AAC、FLAC 等格式,最大 200MB

{/* 已选文件信息 */} {uploadFile && ( -
- +
+
-
+
{uploadFile.name}
@@ -1275,33 +1304,49 @@ const VoiceLibrary: React.FC = () => { {/* 上传进度 */} {uploadProgress !== null && (
-
+
{uploadProgress}%
{uploadProgress < 100 ? "上传中..." : "处理中..."}
-
-
+ marginTop: 8, + overflow: "hidden", + }} + > +
)} {/* 名称 */}
-
+
素材名称
{ {/* 性别选择 */}
-
+
音色性别
@@ -1340,8 +1391,14 @@ const VoiceLibrary: React.FC = () => { padding: "6px 0", borderRadius: 8, border: `1px solid ${uploadGender === g ? "var(--primary-color)" : "var(--border-color)"}`, - background: uploadGender === g ? "var(--primary-soft)" : "transparent", - color: uploadGender === g ? "var(--primary-color)" : "var(--text-secondary)", + background: + uploadGender === g + ? "var(--primary-soft)" + : "transparent", + color: + uploadGender === g + ? "var(--primary-color)" + : "var(--text-secondary)", fontSize: 13, fontWeight: uploadGender === g ? 600 : 400, cursor: uploadProgress !== null ? "not-allowed" : "pointer", @@ -1356,7 +1413,13 @@ const VoiceLibrary: React.FC = () => { {/* 描述 */}
-
+
音色描述(可选)