Spaces:
Sleeping
Sleeping
Update index.html
Browse files- index.html +3 -5
index.html
CHANGED
|
@@ -3,10 +3,10 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>🎵 AI 心情音樂特
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
|
| 9 |
-
<link rel="stylesheet" href="https://
|
| 10 |
|
| 11 |
<script>
|
| 12 |
tailwind.config = { darkMode: 'class' }
|
|
@@ -17,7 +17,7 @@
|
|
| 17 |
|
| 18 |
<div class="fixed top-4 right-4 z-50">
|
| 19 |
<button onclick="toggleTheme()" id="themeBtn" class="flex items-center justify-center p-2.5 rounded-xl bg-white hover:bg-slate-100 dark:bg-gray-800 dark:hover:bg-gray-700 text-slate-800 dark:text-yellow-400 border border-slate-200 dark:border-gray-700 shadow-lg backdrop-blur-sm transition-all duration-300 transform hover:scale-105 active:scale-95">
|
| 20 |
-
<i id="themeIcon" class="
|
| 21 |
</button>
|
| 22 |
</div>
|
| 23 |
|
|
@@ -138,13 +138,11 @@
|
|
| 138 |
if (!response.ok) {
|
| 139 |
const errorData = await response.json();
|
| 140 |
|
| 141 |
-
// 判斷後端傳回的 detail 是否為物件/陣列,如果是就直接替換成「請重新輸入...」
|
| 142 |
let userFriendlyMessage = "請重新輸入(字數過短、包含無意義內容或格式異常)。";
|
| 143 |
|
| 144 |
if (errorData.detail && typeof errorData.detail === 'string') {
|
| 145 |
userFriendlyMessage = errorData.detail;
|
| 146 |
} else if (errorData.detail && Array.isArray(errorData.detail) && errorData.detail[0]?.msg) {
|
| 147 |
-
// 如果是 Pydantic 預設的錯誤陣列,精準抓取它的 msg 欄位
|
| 148 |
userFriendlyMessage = `請重新輸入(錯誤提示:${errorData.detail[0].msg})`;
|
| 149 |
}
|
| 150 |
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>🎵 AI 心情音樂特特征轉換器</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
|
| 9 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
|
| 10 |
|
| 11 |
<script>
|
| 12 |
tailwind.config = { darkMode: 'class' }
|
|
|
|
| 17 |
|
| 18 |
<div class="fixed top-4 right-4 z-50">
|
| 19 |
<button onclick="toggleTheme()" id="themeBtn" class="flex items-center justify-center p-2.5 rounded-xl bg-white hover:bg-slate-100 dark:bg-gray-800 dark:hover:bg-gray-700 text-slate-800 dark:text-yellow-400 border border-slate-200 dark:border-gray-700 shadow-lg backdrop-blur-sm transition-all duration-300 transform hover:scale-105 active:scale-95">
|
| 20 |
+
<i id="themeIcon" class="fa-solid fa-circle-half-stroke text-lg flex items-center justify-center"></i>
|
| 21 |
</button>
|
| 22 |
</div>
|
| 23 |
|
|
|
|
| 138 |
if (!response.ok) {
|
| 139 |
const errorData = await response.json();
|
| 140 |
|
|
|
|
| 141 |
let userFriendlyMessage = "請重新輸入(字數過短、包含無意義內容或格式異常)。";
|
| 142 |
|
| 143 |
if (errorData.detail && typeof errorData.detail === 'string') {
|
| 144 |
userFriendlyMessage = errorData.detail;
|
| 145 |
} else if (errorData.detail && Array.isArray(errorData.detail) && errorData.detail[0]?.msg) {
|
|
|
|
| 146 |
userFriendlyMessage = `請重新輸入(錯誤提示:${errorData.detail[0].msg})`;
|
| 147 |
}
|
| 148 |
|