index.html 189 KB
Newer Older
LiangLiu's avatar
LiangLiu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LightX2V 文生视频服务</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <!-- 主要图标库 -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <!-- 备用图标库 -->
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet" media="print" onload="this.media='all'">
    <!-- 本地备用图标(如果CDN都失败) -->
    <style>
        /* 备用图标样式,防止CDN失败时图标不显示 */
        .icon-fallback {
            display: inline-block;
            width: 1em;
            height: 1em;
            background-color: currentColor;
            border-radius: 50%;
        }
        .icon-fallback.small {
            width: 0.75em;
            height: 0.75em;
        }
        .icon-fallback.large {
            width: 1.5em;
            height: 1.5em;
        }
        .icon-fallback.xl {
            width: 2em;
            height: 2em;
        }

        /* 登录页面样式 */
        .login-container {
            min-height: 100%;
            min-width: 100%;
            background: linear-gradient(135deg, #0b0a20 0%, #1b1240 50%, #0f0e22 100%);
            position: relative;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .login-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background:
                radial-gradient(circle at 20% 80%, rgba(154, 114, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(183, 139, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(124, 106, 255, 0.05) 0%, transparent 50%);
            animation: backgroundShift 20s ease-in-out infinite;
        }

        /* 登录页面样式 */
        .main-container {
            min-height: 100%;
            min-width: 100%;
            background: linear-gradient(135deg, #0b0a20 0%, #1b1240 50%, #0f0e22 100%);
            overflow: hidden;
            display: flex;
        }

        @keyframes backgroundShift {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.8; }
        }

        .login-card {
            background: rgba(27, 18, 64, 0.8);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(154, 114, 255, 0.2);
            border-radius: 24px;
            box-shadow:
                0 20px 40px rgba(0, 0, 0, 0.3),
                0 0 40px rgba(154, 114, 255, 0.1),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
            position: relative;
            overflow: hidden;
            transition: all 0.3s ease;
            max-width: 500px;
            width: 100%;
        }

        .login-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(154, 114, 255, 0.1), transparent);
            transition: left 0.5s ease;
        }

        .login-card:hover::before {
            left: 100%;
        }

        .login-card:hover {
            transform: translateY(-5px);
            box-shadow:
                0 25px 50px rgba(0, 0, 0, 0.4),
                0 0 60px rgba(154, 114, 255, 0.2),
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
        }

        .login-logo {
            background: linear-gradient(135deg, #9a72ff, #b78bff, #7c6aff);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            font-size: 3rem;
            font-weight: 700;
            margin-bottom: 1rem;
            animation: logoGlow 3s ease-in-out infinite alternate;
        }

        @keyframes logoGlow {
            0% {
                filter: drop-shadow(0 0 10px rgba(154, 114, 255, 0.5));
            }
            100% {
                filter: drop-shadow(0 0 20px rgba(154, 114, 255, 0.8));
            }
        }

        .login-subtitle {
            color: rgba(255, 255, 255, 0.7);
            font-size: 1.1rem;
            margin-bottom: 2rem;
            font-weight: 300;
        }

        .btn-github {
            background: linear-gradient(135deg, #d2c1ff, #a88bff, #8e88ff);
            border: 1px solid rgba(154, 114, 255, 0.3);
            font-weight: 500;
            font-size: 16px;
            letter-spacing: 0.2px;
            font-family: 'Inter', sans-serif;
            padding: 20px 30px;
            border-radius: 14px;
            position: relative;
            overflow: hidden;
            text-decoration: none;
            box-shadow: 0 10px 30px rgba(140, 110, 255, 0.4);
            transition: transform 0.5s ease, box-shadow 0.15s ease;
        }

        .btn-github::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
            transition: left 0.5s ease;
        }

        .btn-github:hover::before {
            left: 100%;
        }

        .btn-github:hover {
            background: linear-gradient(135deg, #c1a5ff, #8b5cf6);
            border-color: rgba(168, 85, 247, 0.5);
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(168, 85, 247, 0.3);
        }

        .btn-github:active {
            transform: translateY(0);
            background: linear-gradient(135deg, #c1a5ff, #8b5cf6);
            box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
        }

        .btn-github:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .btn-github:disabled:hover {
            transform: none;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .floating-particles {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            overflow: hidden;
            pointer-events: none;
        }

        .particle {
            position: absolute;
            width: 4px;
            height: 4px;
            background: rgba(193, 169, 255, 0.6);
            border-radius: 50%;
            animation: floatParticle 15s linear infinite;
        }

        .particle:nth-child(1) { left: 10%; animation-delay: 0s; }
        .particle:nth-child(2) { left: 20%; animation-delay: 12s; }
        .particle:nth-child(3) { left: 30%; animation-delay: 10s; }
        .particle:nth-child(4) { left: 40%; animation-delay: 6s; }
        .particle:nth-child(5) { left: 50%; animation-delay: 8s; }
        .particle:nth-child(6) { left: 60%; animation-delay: 14s; }
        .particle:nth-child(7) { left: 70%; animation-delay: 16s; }
        .particle:nth-child(8) { left: 80%; animation-delay: 2s; }
        .particle:nth-child(9) { left: 90%; animation-delay: 4s; }

        @keyframes floatParticle {
            0% {
                transform: translateY(100vh) scale(0);
                opacity: 0;
            }
            10% {
                opacity: 1;
            }
            90% {
                opacity: 1;
            }
            100% {
                transform: translateY(-100px) scale(1);
                opacity: 0;
            }
        }

        .login-features {
            margin-top: 2rem;
            padding-top: 2rem;
            padding-left: 10rem;
            border-top: 1px solid rgba(154, 114, 255, 0.2);
        }

        .feature-item {
            display: flex;
            align-items: center;
            margin-bottom: 1rem;
            color: rgba(255, 255, 255, 0.8);
            font-size: 0.9rem;
        }

        .feature-icon {
            width: 20px;
            height: 20px;
            background: linear-gradient(135deg, #9a72ff, #b78bff);
            border-radius: 50%;
            margin-right: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 10px;
            color: white;
        }

        /* 登录页面进入动画 */
        .login-container {
            animation: fadeInUp 0.8s ease-out;
        }

        .login-card {
            animation: slideInUp 0.6s ease-out 0.2s both;
        }

        .login-logo {
            animation: logoGlow 3s ease-in-out infinite alternate, fadeInScale 0.8s ease-out 0.4s both;
        }

        .login-subtitle {
            animation: fadeIn 0.8s ease-out 0.6s both;
        }

        .btn-github {
            animation: fadeInUp 0.8s ease-out 0.8s both;
        }

        .login-features {
            animation: fadeIn 0.8s ease-out 1s both;
        }

        .feature-item {
            animation: slideInLeft 0.6s ease-out both;
        }

        .feature-item:nth-child(1) { animation-delay: 1.2s; }
        .feature-item:nth-child(2) { animation-delay: 1.4s; }
        .feature-item:nth-child(3) { animation-delay: 1.6s; }
        .feature-item:nth-child(4) { animation-delay: 1.8s; }
        .feature-item:nth-child(5) { animation-delay: 2.0s; }
        .feature-item:nth-child(6) { animation-delay: 2.2s; }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes slideInUp {
            from {
                opacity: 0;
                transform: translateY(50px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeInScale {
            from {
                opacity: 0;
                transform: scale(0.8);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }

        @keyframes slideInLeft {
            from {
                opacity: 0;
                transform: translateX(-20px);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .login-logo {
                font-size: 2.5rem;
            }

            .login-subtitle {
                font-size: 1rem;
            }

            .btn-github {
                padding: 14px 28px;
                font-size: 1rem;
            }

            .login-card {
                margin: 20px;
                border-radius: 20px;
            }
        }

        @media (max-width: 480px) {
            .login-logo {
                font-size: 2rem;
            }

            .login-subtitle {
                font-size: 0.9rem;
            }

            .btn-github {
                padding: 12px 24px;
                font-size: 0.95rem;
            }

            .login-card .card-body {
                padding: 2rem !important;
            }
        }
    </style>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#9a72ff', // 主紫色
                        secondary: '#1b1240', // 深紫色背景
                        accent: '#b78bff', // 亮紫色强调
                        dark: '#0b0a20', // 深色背景
                        'dark-light': '#0f0e22', // 稍亮的深色
                        'laser-purple': '#9a72ff', // 激光紫色
                        'neon-purple': '#b78bff', // 霓虹紫色
                        'electric-purple': '#7c6aff', // 电光紫色
                    },
                    fontFamily: {
                        inter: ['Inter', 'sans-serif'],
                    },
                    boxShadow: {
                        'neon': '0 0 10px rgba(154, 114, 255, 0.5), 0 0 20px rgba(154, 114, 255, 0.3)',
                        'neon-lg': '0 0 15px rgba(154, 114, 255, 0.7), 0 0 30px rgba(154, 114, 255, 0.5)',
                        'laser': '0 0 20px rgba(154, 114, 255, 0.8), 0 0 40px rgba(154, 114, 255, 0.6), 0 0 60px rgba(154, 114, 255, 0.4), 0 0 80px rgba(154, 114, 255, 0.2)',
                        'laser-intense': '0 0 25px rgba(154, 114, 255, 0.9), 0 0 50px rgba(154, 114, 255, 0.7), 0 0 75px rgba(154, 114, 255, 0.5), 0 0 100px rgba(154, 114, 255, 0.3), 0 0 125px rgba(154, 114, 255, 0.1)',
                        'electric': '0 0 15px rgba(124, 106, 255, 0.8), 0 0 30px rgba(124, 106, 255, 0.6), 0 0 45px rgba(124, 106, 255, 0.4)'
                    }
                }
            }
        }
    </script>
    <style type="text/tailwindcss">

        [v-cloak] { display: none; }
        /* 确保html和body能够正确填充 */
        html {
            height: 100%;
        }

        /* 确保body和app容器能够正确填充 */
        body {
            margin: 0;
            padding: 0;
            width: 125vw;
            height: 125vh;
            overflow-x: hidden;
            overflow-y: auto;
            /* 整体缩放80% */
            transform: scale(0.8);
            transform-origin: top left;
        }


        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .text-gradient {
                background-clip: text;
                -webkit-background-clip: text;
                -webkit-text-fill-color: transparent;
            }
            /* 新增渐变图标颜色类 */
            .text-gradient-icon {
                background: linear-gradient(135deg, #d2c1ff, #a88bff, #8e88ff);
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
            }
            .bg-grid {
                background-size: 40px 40px;
                background-image:
                    linear-gradient(to right, rgba(210, 193, 255, 0.15) 1px, transparent 1px),
                    linear-gradient(to bottom, rgba(210, 193, 255, 0.15) 1px, transparent 1px);
            }
            .scrollbar-thin {
                scrollbar-width: thin;
            }
            .scrollbar-thin::-webkit-scrollbar {
                width: 4px;
            }
            .scrollbar-thin::-webkit-scrollbar-thumb {
                background-color: rgba(210, 193, 255, 0.6);
                border-radius: 2px;
            }

            /* 历史任务区域滚动条样式 - 与主内容区域保持一致 */
            .history-tasks-scroll::-webkit-scrollbar {
                width: 8px !important;
            }

            .history-tasks-scroll::-webkit-scrollbar-track {
                background: rgba(27, 18, 64, 0.3) !important;
                border-radius: 4px;
            }

            .history-tasks-scroll::-webkit-scrollbar-thumb {
                background: linear-gradient(135deg, rgba(210, 193, 255, 0.8), rgba(168, 139, 255, 0.8)) !important;
                border-radius: 4px;
                border: 1px solid rgba(210, 193, 255, 0.3);
            }

            .history-tasks-scroll::-webkit-scrollbar-thumb:hover {
                background: linear-gradient(135deg, rgba(210, 193, 255, 1), rgba(168, 139, 255, 1)) !important;
            }

            /* 确保历史任务区域可以正常滚动 */
            .history-tasks-scroll {
                scroll-behavior: smooth;
                -webkit-overflow-scrolling: touch;
                /* 移除max-height限制,让flex-1占据所有可用空间 */
            }

            /* 主内容区域滚动条样式 */
            .content-area::-webkit-scrollbar {
                width: 8px;
            }

            .content-area::-webkit-scrollbar-track {
                background: rgba(27, 18, 64, 0.3);
                border-radius: 4px;
            }

            .content-area::-webkit-scrollbar-thumb {
                background: linear-gradient(135deg, rgba(210, 193, 255, 0.8), rgba(168, 139, 255, 0.8));
                border-radius: 4px;
                border: 1px solid rgba(210, 193, 255, 0.3);
            }

            .content-area::-webkit-scrollbar-thumb:hover {
                background: linear-gradient(135deg, rgba(210, 193, 255, 1), rgba(168, 139, 255, 1));
            }

            /* 确保内容可以正常滚动 */
            .content-area {
                scroll-behavior: smooth;
                -webkit-overflow-scrolling: touch;
            }
            .animate-pulse-slow {
                animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 0.5) infinite;
            }
            .animate-float {
                animation: float 6s ease-in-out infinite;
            }
            .animate-laser-glow {
                animation: laserGlow 2s ease-in-out infinite alternate;
            }
            .animate-electric-pulse {
                animation: electricPulse 1.5s ease-in-out infinite;
            }
            .animate-neon-flicker {
                animation: neonFlicker 3s ease-in-out infinite;
            }
            @keyframes float {
                0% { transform: translateY(0px); }
                50% { transform: translateY(-10px); }
                100% { transform: translateY(0px); }
            }
            @keyframes laserGlow {
                0% {
                    box-shadow: 0 0 10px rgba(210, 193, 255, 0.8), 0 0 40px rgba(210, 193, 255, 0.6), 0 0 60px rgba(210, 193, 255, 0.4);
                    filter: brightness(0.8) saturate(0.7);
                }
                100% {
                    box-shadow: 0 0 20px rgba(210, 193, 255, 1), 0 0 60px rgba(210, 193, 255, 0.8), 0 0 90px rgba(210, 193, 255, 0.6);
                    filter: brightness(1) saturate(1);
                }
            }
            @keyframes electricPulse {
                0%, 100% {
                    box-shadow: 0 0 15px rgba(142, 136, 255, 0.8), 0 0 30px rgba(142, 136, 255, 0.6);
                    transform: scale(1);
                }
                50% {
                    box-shadow: 0 0 25px rgba(142, 136, 255, 1), 0 0 50px rgba(142, 136, 255, 0.8), 0 0 75px rgba(142, 136, 255, 0.4);
                    transform: scale(1.02);
                }
            }
            @keyframes neonFlicker {
                0%, 100% {
                    box-shadow: 0 0 20px rgba(183, 139, 255, 0.8), 0 0 40px rgba(183, 139, 255, 0.6);
                    opacity: 1;
                }
                25% {
                    box-shadow: 0 0 15px rgba(183, 139, 255, 0.6), 0 0 30px rgba(183, 139, 255, 0.4);
                    opacity: 0.8;
                }
                75% {
                    box-shadow: 0 0 25px rgba(183, 139, 255, 1), 0 0 50px rgba(183, 139, 255, 0.8);
                    opacity: 1.1;
                }
            }
            .bg-laser-gradient {
                background: linear-gradient(135deg, #d2c1ff 0%, #a88bff 25%, #8e88ff 50%, #d2c1ff 75%, #a88bff 100%);
                background-size: 200% 200%;
                animation: gradientShift 3s ease-in-out infinite;
            }
            @keyframes gradientShift {
                0%, 100% { background-position: 0% 50%; }
                50% { background-position: 100% 50%; }
            }
            .text-laser-glow {
                text-shadow: 0 0 10px rgba(154, 114, 255, 0.8), 0 0 20px rgba(154, 114, 255, 0.6), 0 0 30px rgba(154, 114, 255, 0.4);
            }
            .border-laser {
                border-color: #d2c1ff;
                box-shadow: 0 0 15px rgba(154, 114, 255, 0.6), inset 0 0 15px rgba(154, 114, 255, 0.1);
            }
            .btn-primary{
                padding: 15px 25px;
                border-radius: 14px;
                font-weight: 500;
                font-size: 14px;
                letter-spacing: 0.2px;
                font-family: 'Inter', sans-serif;
                background: linear-gradient(135deg, #d2c1ff, #a88bff, #8e88ff);
                border: 0;
                text-decoration: none;
                box-shadow: 0 10px 30px rgba(140, 110, 255, 0.4);
                transition: transform 0.15s ease, box-shadow 0.15s ease;
            }
            .btn-primary:hover{
                transform: translateY(-1px);
                box-shadow: 0 14px 40px rgba(140, 110, 255, 0.55);
            }

            /* 修复布局问题 */
            .task-type-btn {
                padding: 0.75rem 1rem;
                font-size: 0.875rem;
                font-weight: 500;
                transition-property: color, background-color;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 150ms;
            }

            .task-type-btn:hover {
                background-color: rgba(154, 114, 255, 0.1);
            }

            .model-selection {
                display: flex;
                flex-wrap: wrap;
                gap: 0.5rem;
            }

            .upload-section {
                display: grid;
                grid-template-columns: repeat(1, minmax(0, 1fr));
                gap: 1.5rem;
                margin-bottom: 1.5rem;
            }

            @media (min-width: 768px) {
                .upload-section {
                    grid-template-columns: repeat(2, minmax(0, 1fr));
                }
            }

            .upload-area {
                position: relative;
                border: 2px dashed rgba(154, 114, 255, 0.4);
                border-radius: 0.75rem;
                padding: 1.5rem;
                text-align: center;
                transition-property: all;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 150ms;
                cursor: pointer;
                background-color: rgba(27, 18, 64, 0.1);
                min-height: 250px; /* 确保上传区域有最小高度,防止预览时高度收缩 */
            }

            .upload-area:hover {
                border-color: rgba(154, 114, 255, 0.7);
                box-shadow: 0 0 20px rgba(154, 114, 255, 0.8), 0 0 40px rgba(154, 114, 255, 0.6), 0 0 60px rgba(154, 114, 255, 0.4), 0 0 80px rgba(154, 114, 255, 0.2);
            }

            .upload-icon {
                margin: 0 auto;
                width: 4rem;
                height: 4rem;
                background-color: rgba(154, 114, 255, 0.2);
                border-radius: 9999px;
                display: flex;
                align-items: center;
                justify-content: center;
                margin-bottom: 1rem;
                transition-property: all;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 150ms;
            }

            .upload-area:hover .upload-icon {
                background-color: rgba(154, 114, 255, 0.3);
            }

            /* 图片预览占据整个上传区域 */
            .image-preview {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                overflow: hidden;
                z-index: 10;
                display: flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
            }

            .image-preview img {
                height: 100%;
                width: auto;
                max-width: 100%;
                display: block;
                margin: 0 auto;
                object-fit: contain;
                transition: all 0.3s ease;
            }

            /* 音频预览占据整个上传区域 */
            .audio-preview {
                position: absolute;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                border-radius: 0.75rem;
                overflow: hidden;
                z-index: 10;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: rgba(154, 114, 255, 0.1);
                border: 2px solid rgba(154, 114, 255, 0.3);
                cursor: pointer;
            }

            .audio-preview audio {
                width: 90%;
                height: 60px;
                max-height: 80%;
                border-radius: 0.5rem;
                background-color: rgba(27, 18, 64, 0.3);
                display: block;
            }

            /* 确保音频控件在容器中正确显示 */
            .audio-preview audio::-webkit-media-controls {
                background-color: rgba(27, 18, 64, 0.5);
                border-radius: 0.5rem;
            }

            /* 上传内容样式 */
            .upload-content {
                width: 100%;
                height: 100%;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
            }

            .btn-close {
                position: absolute;
                top: 0.5rem;
                right: 0.5rem;
                background-color: #ef4444;
                color: white;
                border-radius: 9999px;
                width: 1.5rem;
                height: 1.5rem;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 0.75rem;
                cursor: pointer;
                z-index: 20;
                box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
            }

            /* 确保flexbox布局正确 */
            #app {
                display: flex;
                width: 100%;
                height: 100%;
            }

            .bg-linear-dark {
                background-color: linear-gradient(135deg, #0b0a20 0%, #1b1240 50%, #0f0e22 100%);
            }

            aside {
                flex-shrink: 0;
                width: 280px; /* 默认展开宽度 */
                min-width: 3rem; /* 最小宽度 */
                max-width: 500px; /* 最大宽度 */
                background-color: linear-gradient(135deg, #0b0a20 0%, #1b1240 50%, #0f0e22 100%);
                border-right: 1px solid rgba(154, 114, 255, 0.4);
                display: flex;
                flex-direction: column;
                transition-property: all;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 300ms;
                z-index: 10;
                position: relative;
            }

            /* 拖拽调整器 */
            .resize-handle {
                position: absolute;
                top: 0;
                right: 0;
                width: 4px;
                height: 100%;
                background: transparent;
                cursor: col-resize;
                z-index: 20;
                transition: background-color 0.2s ease;
            }

            .resize-handle:hover {
                background: rgba(154, 114, 255, 0.5);
            }

            .resize-handle:active {
                background: rgba(154, 114, 255, 0.8);
            }

            /* 拖拽时的视觉反馈 */
            .resizing {
                user-select: none;
                pointer-events: none;
            }

            .resizing * {
                pointer-events: none;
            }

            main {
                flex: 1;
                display: flex;
                flex-direction: column;
                min-width: 0;
                width: calc(100% - 280px); /* 主内容区域占据剩余宽度,适应展开的侧边栏 */
                height: 100%;
            }

            /* 内容区域全屏显示 */
            .content-area {
                flex: 1;
                overflow-y: auto;
                background-color: #0b0a20;
                padding: 2rem;
                width: 100%;
                min-height: 0; /* 确保flex子元素可以收缩 */
            }

            /* 任务创建面板全屏 */
            #task-creator {
                max-width: none;
                width: 80%;
                padding: 0 1rem;
            }

            /* 任务详情面板全屏 */
            .task-detail-panel {
                max-width: none;
                width: 80%;
                padding: 0 0rem;
            }

            /* 上传区域全屏布局 */
            .upload-section {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
                gap: 2rem;
                margin-bottom: 2rem;
                width: 100%;
            }

            /* 任务类型选择全屏 */
            .task-type-selection {
                width: 100%;
                margin-bottom: 2rem;
            }

            .task-type-buttons {
                display: flex;
                width: 100%;
                border-bottom: 1px solid rgba(154, 114, 255, 0.3);
            }

            .task-type-btn {
                flex: 1;
                padding: 1rem 1.5rem;
                font-size: 1rem;
                font-weight: 500;
                transition-property: color, background-color;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 150ms;
                text-align: center;
            }

            /* 模型选择全屏 */
            .model-selection {
                display: flex;
                flex-wrap: wrap;
                gap: 1rem;
                width: 100%;
                justify-content: flex-start;
            }

            /* 提示词输入全屏 */
            .prompt-input-section {
                width: 100%;
                margin-bottom: 2rem;
            }

            .prompt-textarea {
                width: 100%;
                min-height: 150px;
                resize: vertical;
            }

            /* 侧边栏折叠样式 */
            .sidebar-collapsed {
                width: 3rem !important;
            }

            /* 侧边栏展开样式 */
            aside:not(.sidebar-collapsed) {
                width: 280px !important;
            }

            .sidebar-collapsed .sidebar-content {
                display: none !important;
            }

            .sidebar-collapsed .resize-handle {
                display: none !important;
            }

            .sidebar-collapsed .user-info-section {
                display: none !important;
            }

            .sidebar-collapsed .sidebar-header {
                justify-content: center;
                padding: 1rem 0.5rem;
            }

            .sidebar-collapsed .sidebar-header h1 {
                display: none;
            }

            /* 展开状态下显示所有内容 */
            aside:not(.sidebar-collapsed) .sidebar-content {
                display: flex !important;
            }

            aside:not(.sidebar-collapsed) .resize-handle {
                display: block !important;
            }

            aside:not(.sidebar-collapsed) .sidebar-header {
                justify-content: space-between;
                padding: 1rem;
            }

            aside:not(.sidebar-collapsed) .sidebar-header h1 {
                display: flex;
            }

            aside:not(.sidebar-collapsed) .sidebar-header .toggle-btn {
                display: flex !important;
                align-items: center;
                justify-content: center;
            }

            aside:not(.sidebar-collapsed) .user-info-section {
                display: block !important;
            }

            .sidebar-collapsed .sidebar-header .toggle-btn {
                display: flex !important;
                align-items: center;
                justify-content: center;
                width: 2rem;
                height: 2rem;
                border-radius: 0.375rem;
                background-color: rgba(154, 114, 255, 0.1);
                border: 1px solid rgba(154, 114, 255, 0.3);
                margin: 0 auto;
            }

            /* 当侧边栏折叠时,主内容区域调整 */
            .sidebar-collapsed + main {
                width: calc(100% - 3rem);
            }

            /* 当侧边栏展开时,主内容区域调整 */
            aside:not(.sidebar-collapsed) + main {
                width: calc(100% - 280px);
            }

            /* 响应式设计 */
            @media (max-width: 1200px) {
                aside:not(.sidebar-collapsed) {
                    width: 250px !important;
                }

                .sidebar-collapsed + main {
                    width: calc(100% - 3rem);
                }

                aside:not(.sidebar-collapsed) + main {
                    width: calc(100% - 250px);
                }
            }

            @media (max-width: 768px) {
                aside:not(.sidebar-collapsed) {
                    width: 200px !important;
                }

                .sidebar-collapsed + main {
                    width: calc(100% - 3rem);
                }

                aside:not(.sidebar-collapsed) + main {
                    width: calc(100% - 200px);
                }

                .upload-section {
                    grid-template-columns: 1fr;
                }
            }

            /* 修复任务项样式 */
            .task-item {
                padding: 0.75rem;
                border-radius: 0.5rem;
                cursor: pointer;
                transition-property: all;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 200ms;
            }

            .task-item:hover {
                background-color: rgba(154, 114, 255, 0.15);
                box-shadow: 0 0 20px rgba(154, 114, 255, 0.8), 0 0 40px rgba(154, 114, 255, 0.6), 0 0 60px rgba(154, 114, 255, 0.4), 0 0 80px rgba(154, 114, 255, 0.2);
            }

            /* 修复状态指示器 */
            .status-indicator {
                width: 0.75rem;
                height: 0.75rem;
                border-radius: 9999px;
                box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            }

            /* 修复按钮样式 */
            .btn-primary {
                padding: 12px 22px;
                border-radius: 14px;
                font-weight: 700;
                letter-spacing: 0.2px;
                color: #0c0920;
                background: linear-gradient(135deg, #d2c1ff, #a88bff, #8e88ff);
                border: 0;
                text-decoration: none;
                box-shadow: 0 10px 30px rgba(140, 110, 255, 0.4);
                transition: transform 0.15s ease, box-shadow 0.15s ease;
                cursor: pointer;
                display: inline-block;
            }

            .btn-primary:hover {
                transform: translateY(-1px);
                box-shadow: 0 14px 40px rgba(140, 110, 255, 0.55);
            }

            /* 修复模型按钮样式 */
            .model-btn {
                padding: 0.5rem 1rem;
                border-radius: 0.5rem;
                font-size: 0.875rem;
                transition-property: all;
                transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
                transition-duration: 150ms;
                cursor: pointer;
                border: 1px solid;
            }

            .model-btn.active {
                background-color: rgba(154, 114, 255, 0.2);
                border-color: rgba(154, 114, 255, 0.4);
                box-shadow: 0 0 20px rgba(154, 114, 255, 0.8), 0 0 40px rgba(154, 114, 255, 0.6), 0 0 60px rgba(154, 114, 255, 0.4), 0 0 80px rgba(154, 114, 255, 0.2);
                animation: electricPulse 1.5s ease-in-out infinite;
            }

            /* 确保内容区域正确滚动 */
            .content-scroll {
                flex: 1;
                overflow-y: auto;
            }


            /* 任务进行中面板样式 */
            .task-running-panel .animate-pulse-slow {
                animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 0.5) infinite;
            }

            /* 任务失败面板样式 */
            .task-failed-panel .bg-red-500\/10 {
                background-color: rgba(239, 68, 68, 0.1);
            }


            .task-detail-panel video {
                width: 100%;
                height: 100%;
                object-fit: cover;
            }

            /* 素材预览样式 */
            .material-preview {
                display: flex;
                flex-wrap: wrap;
                gap: 0.75rem;
            }

            .material-preview img {
                border-radius: 0.5rem;
                transition: all 0.2s ease;
            }

            .material-preview img:hover {
                transform: scale(1.05);
                box-shadow: 0 0 20px rgba(154, 114, 255, 0.6);
            }

            /* 任务状态指示器增强 */
            .status-indicator {
                position: relative;
            }

            .status-indicator::after {
                content: '';
                position: absolute;
                top: 50%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 0.25rem;
                height: 0.25rem;
                background-color: currentColor;
                border-radius: 50%;
                opacity: 0.8;
            }

            /* 任务面板切换动画 */
            .task-panel-enter-active,
            .task-panel-leave-active {
                transition: all 0.3s ease;
            }

            .task-panel-enter-from {
                opacity: 0;
                transform: translateY(20px);
            }

            .task-panel-leave-to {
                opacity: 0;
                transform: translateY(-20px);
            }

            /* 响应式任务面板 */
            @media (max-width: 768px) {
                .task-detail-panel {
                    padding: 0 0.5rem;
                }
            }

            /* 提示消息动画 */
            .animate-slide-down {
                animation: slideDown 0.3s ease-out;
            }

            @keyframes slideDown {
                0% {
                    opacity: 0;
                    transform: translate(-50%, -100%);
                }
                100% {
                    opacity: 1;
                    transform: translate(-50%, 0);
                }
            }

            /* 提示消息样式 - 统一浅色透明背景 */
            .alert {
                backdrop-filter: blur(15px);
                background: rgba(255, 255, 255, 0.15);
                border-radius: 0.75rem;
                box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
                color: #333;
            }
        }
    </style>
</head>
<body
    class="bg-dark text-gray-100 font-inter"
>
    <div id="app">
       <!-- 登录页面 -->
       <div v-if="!isLoggedIn" class="login-container">
        <!-- 浮动粒子背景 -->
        <div class="floating-particles">
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
        </div>

        <div class="login-card">
                        <div class="card-body text-center p-5">
                            <!-- Logo和标题 -->
                            <div class="mb-4">
                                <div class="login-logo">
                                    <i class="fas fa-film me-3"></i>
                                    LightX2V
                                </div>
                                <p class="login-subtitle">一个强大的视频生成平台</p>
                            </div>

                            <!-- 登录按钮 -->
                            <button @click="loginWithGitHub" class="btn btn-github btn-lg w-100 mb-4" :disabled="loading">
                                <i class="fab fa-github me-2"></i>
                                {{ loading ? '登录中...' : '使用GitHub登录' }}
                            </button>

                            <!-- 功能特性 -->
                            <div class="login-features">
                                <div class="feature-item">
                                    <div class="feature-icon">🎭</div>
                                    <span>电影级数字人视频</span>
                                </div>
                                <div class="feature-item">
                                    <div class="feature-icon"></div>
                                    <span>20倍生成提速</span>
                                </div>
                                <div class="feature-item">
                                    <div class="feature-icon">💰</div>
                                    <span>超低成本生成</span>
                                </div>
                                <div class="feature-item">
                                    <div class="feature-icon">🎯</div>
                                    <span>精准口型对齐</span>
                                </div>
                                <div class="feature-item">
                                    <div class="feature-icon">📱</div>
                                    <span>分钟级视频时长</span>
                                </div>
                                <div class="feature-item">
                                    <div class="feature-icon">🎨</div>
                                    <span>多场景应用</span>
                                </div>
                            </div>
                        </div>
        </div>
    </div>

    <!-- 主应用页面 -->
    <div v-else class="main-container">
        <!-- 浮动粒子背景 -->
        <div class="floating-particles">
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
            <div class="particle"></div>
        </div>

        <!-- 侧边栏 - 历史任务 -->
        <aside class="w-64 bg-linear-dark border-r border-laser-purple/40 flex flex-col transition-all duration-300 ease-in-out z-10" ref="sidebar" :class="{ 'sidebar-collapsed': sidebarCollapsed }">
            <!-- 拖拽调整器 -->
            <div class="resize-handle" @mousedown="startResize"></div>
            <div class="p-4 border-b border-laser-purple/40 sidebar-header">
                <div class="flex items-center justify-between">
                    <h1 class="text-xl font-bold flex items-center">
                        <i class="fas fa-video text-gradient-icon mr-2"></i>
                        <span>LightX2V</span>
                    </h1>
                    <button
                        @click="toggleSidebar"
                        class="text-gray-400 hover:text-gradient-icon transition-colors flex-shrink-0 toggle-btn"
                        title="展开/折叠侧边栏">
                        <i class="fas fa-bars"></i>
                    </button>
                </div>
            </div>
            <div class="sidebar-content flex flex-col flex-1 min-h-0">
                <div class="p-3 border-b border-laser-purple/40">
                    <button
                        @click="showTaskCreator"
                        class="w-full btn-primary py-2 rounded-lg flex items-center justify-center transition-all duration-200 font-medium text-sm">
                        <i class="fas fa-plus mr-2"></i>
                        新建任务
                    </button>
                <div class="relative mt-3">
                    <input
                        v-model="searchQuery"
                        class="w-full bg-dark-light border border-laser-purple/30 rounded-lg py-2 pl-10 pr-4 text-sm focus:outline-none focus:ring-2 focus:ring-laser-purple/50 transition-all focus:border-laser focus:shadow-laser"
                        placeholder="搜索"
                        type="text"
                    />
                    <i class="fas fa-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400"></i>
                </div>

                <!-- 状态过滤和刷新 -->
                <div class="mt-3">
                    <div class="flex flex-wrap gap-1 justify-between items-center">
                    <div class="flex flex-wrap gap-1">
                        <button
                            @click="statusFilter = 'ALL'"
                            class="px-2 py-1 text-xs rounded transition-all"
                                :class="statusFilter === 'ALL' ? 'bg-dark-light bg-laser-purple/40' : 'bg-dark-light text-gray-400 hover:bg-laser-purple/20'"
                        >
                            全部
                        </button>
                        <button
                            @click="statusFilter = 'SUCCEED'"
                            class="px-2 py-1 text-xs rounded transition-all"
                            :class="statusFilter === 'SUCCEED' ? 'bg-green-500/30 text-green-400' : 'bg-dark-light text-gray-400 hover:bg-green-500/20'"
                        >
                            成功
                        </button>
                        <button
                            @click="statusFilter = 'RUNNING'"
                            class="px-2 py-1 text-xs rounded transition-all"
                            :class="statusFilter === 'RUNNING' ? 'bg-yellow-500/30 text-yellow-400' : 'bg-dark-light text-gray-400 hover:bg-yellow-500/20'"
                        >
                            进行中
                        </button>
                        <button
                            @click="statusFilter = 'FAILED'"
                            class="px-2 py-1 text-xs rounded transition-all"
                            :class="statusFilter === 'FAILED' ? 'bg-red-500/30 text-red-400' : 'bg-dark-light text-gray-400 hover:bg-red-500/20'"
                        >
                            失败
                        </button>
                    </div>
                        <button
                            @click="refreshTasks"
                            class="text-gray-400 hover:text-gradient-icon transition-colors flex-shrink-0"
                            title="刷新任务列表"
                        >
                            <i class="fas fa-sync-alt"></i>
                        </button>
                </div>
            </div>
            </div>
            <div class="flex-1 overflow-y-auto history-tasks-scroll p-2 min-h-0">
                <div class="text-xs uppercase text-gray-400 font-semibold mb-2 px-3">
                    历史任务
                </div>
                <!-- 历史任务列表 -->
                <div class="space-y-1" id="history-tasks">
                    <div v-if="filteredTasks.length === 0" class="flex-col items-center justify-center py-12 text-center">
                        <p class="text-gray-400 text-sm">暂无历史任务</p>
                        <p class="text-gray-500 text-xs mt-1">开始创建你的第一个AI视频吧</p>
                    </div>
                    <!-- 任务项 -->
                    <div
                        v-for="task in filteredTasks"
                        :key="task.task_id"
                        class="task-item p-2 rounded-lg cursor-pointer hover:bg-laser-purple/15 hover:shadow-laser transition-all duration-200"
                        :class="getTaskItemClass(task.status)"
                        @click="viewTaskDetail(task)"
                    >
                        <div class="flex items-start gap-3 mb-2">
                            <div class="w-16 h-12 bg-dark-light rounded overflow-hidden flex-shrink-0">
                                <template v-for="(thumbnailInfo, index) in [getVideoThumbnailInfo(task.task_id, 'output_video')]" :key="index">
                                    <img
                                        v-if="thumbnailInfo.hasThumbnail"
                                        :src="thumbnailInfo.url"
                                        alt="任务预览"
                                        class="w-full h-full object-cover"
                                        @error="handleThumbnailError"
                                    />
                                    <div v-else class="w-full h-full bg-laser-purple/20 flex items-center justify-center">
                                        <i class="fas fa-video text-gradient-icon text-xl"></i>
                                    </div>
                                </template>
                            </div>
                            <div class="flex-1 min-w-0">
                                <div class="flex justify-between items-start mb-1 gap-2">
                                    <h3 class="font-medium text-sm truncate max-w-[calc(100%-2rem)]">{{ task.params.prompt || '无标题任务' }}</h3>
                                    <div
                                        :class="getStatusIndicatorClass(task.status)"
                                        :title="getTaskStatusDisplay(task.status)"
                                        class="flex-shrink-0"
                                    ></div>
                                </div>
                                <p class="text-xs text-gray-400 mb-2 line-clamp-1">
                                     {{ getTaskTypeName(task) }} | {{ getRelativeTime(task.create_t) }}
                                </p>
                                <div class="flex items-center justify-between text-xs gap-2">
                                    <span class="text-gray-500 truncate max-w-[calc(100%-4rem)]">{{ task.model_cls }}</span>
                                    <span :class="getTaskStatusColor(task.status)" class="font-medium flex-shrink-0">
                                        {{ getTaskStatusDisplay(task.status) }}
                                    </span>
                            </div>
                        </div>
                    </div>

                    </div>
                </div>
            </div>
            </div>

            <!-- 用户信息区域 - 任务栏底部分区 -->
            <div class="mt-auto p-3 border-t border-laser-purple/40 user-info-section">
                <div class="flex items-center space-x-3">
                    <!-- 用户头像 -->
                    <div v-if="currentUser.avatar_url" class="w-10 h-10 rounded-full border border-laser-purple/40 overflow-hidden flex-shrink-0">
                        <img
                            :src="currentUser.avatar_url"
                            alt="用户头像"
                            class="w-full h-full object-cover"
                        />
                    </div>
                    <!-- 默认用户图标 -->
                    <div v-else class="w-10 h-10 rounded-full border border-laser-purple/40 bg-laser-purple/20 flex items-center justify-center flex-shrink-0">
                        <i class="fas fa-user text-gradient-icon"></i>
                    </div>

                    <!-- 用户信息 -->
                    <div class="flex-1 min-w-0">
                        <div class="text-sm font-medium text-gray-100 truncate">
                            {{ currentUser.username }}
                        </div>
                        <div class="text-xs text-gray-400 truncate">
                            {{ currentUser.email }}
                        </div>
                    </div>

                    <!-- 退出按钮 -->
                    <button @click="logout" class="text-gray-400 hover:text-gradient-icon transition-colors flex-shrink-0" title="退出登录">
                        <i class="fas fa-sign-out-alt"></i>
                    </button>
                </div>
            </div>

        </aside>

        <!-- 主内容区 -->
        <main class="flex-1 flex flex-col overflow-hidden">

            <!-- 内容区域 -->
            <div class="flex-1 overflow-y-auto bg-dark p-6 content-area">
                <!-- 模板选择浮窗 -->
                 <div v-cloak>
                    <div v-if="showImageTemplates || showAudioTemplates"
                        class="fixed inset-0 bg-black/50 z-50 flex items-center justify-center"
                        @click="showImageTemplates = false; showAudioTemplates = false">
                        <div class="bg-secondary rounded-xl p-6 max-w-4xl w-full mx-4 max-h-[80vh] overflow-hidden"
                            @click.stop>
                            <!-- 浮窗头部 -->
                            <div class="flex items-center justify-between mb-4">
                                <h3 class="text-lg font-medium text-white">
                                    <i v-if="showImageTemplates" class="fas fa-image text-gradient-icon mr-2"></i>
                                    <i v-if="showAudioTemplates" class="fas fa-music text-gradient-icon mr-2"></i>
                                    {{ showImageTemplates ? '选择图片模板' : '选择音频模板' }}
                                </h3>
                                <button @click="showImageTemplates = false; showAudioTemplates = false"
                                        class="text-gray-400 hover:text-white transition-colors">
                                    <i class="fas fa-times text-xl"></i>
                                </button>
                            </div>

                            <!-- 图片模板网格 -->
                            <div v-if="showImageTemplates" class="overflow-y-auto max-h-[50vh]">
                                <div v-if="imageTemplates.length > 0" class="grid grid-cols-4 gap-4">
                                    <div v-for="template in imageTemplates" :key="template.filename"
                                        @click="selectImageTemplate(template)"
                                        class="relative group cursor-pointer rounded-lg overflow-hidden border border-gray-700 hover:border-laser-purple/50 transition-all">
                                        <img :src="template.url" :alt="template.filename"
                                            class="w-full h-32 object-cover">
                                        <div class="absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center">
                                            <i class="fas fa-check text-white text-2xl"></i>
                                        </div>
                                        <div class="absolute bottom-0 left-0 right-0 bg-black/80 text-white text-xs p-2">
                                            <div class="truncate">{{ template.filename }}</div>
                                        </div>
                                    </div>
                                </div>
                                <div v-else class="flex flex-col items-center justify-center py-12 text-center">
                                    <div class="w-16 h-16 bg-laser-purple/20 rounded-full flex items-center justify-center mb-4">
                                        <i class="fas fa-image text-gradient-icon text-2xl"></i>
                                    </div>
                                    <p class="text-gray-400 text-lg mb-2">目前暂无图片模板</p>
                                </div>
                            </div>

                            <!-- 音频模板列表 -->
                            <div v-if="showAudioTemplates" class="overflow-y-auto max-h-[50vh]">
                                <div v-if="audioTemplates.length > 0" class="space-y-3">
                                    <div v-for="template in audioTemplates" :key="template.filename"
                                        @click="selectAudioTemplate(template)"
                                        class="flex items-center gap-4 p-4 rounded-lg border border-gray-700 hover:border-laser-purple/50 transition-all cursor-pointer bg-dark-light/50">
                                        <div class="w-12 h-12 bg-laser-purple/20 rounded-lg flex items-center justify-center">
                                            <i class="fas fa-music text-gradient-icon text-xl"></i>
                                        </div>
                                        <div class="flex-1">
                                            <div class="text-white font-medium">{{ template.filename }}</div>
                                            <div class="text-gray-400 text-sm">音频模板</div>
                                        </div>
                                        <button @click.stop="previewAudioTemplate(template)"
                                                class="px-3 py-2 bg-laser-purple/20 hover:bg-laser-purple/30 text-gradient-icon rounded-lg transition-all">
                                            <i class="fas fa-play mr-2"></i>
                                            试听
                                        </button>
                                    </div>
                                </div>
                                <div v-else class="flex flex-col items-center justify-center py-12 text-center">
                                    <div class="w-16 h-16 bg-laser-purple/20 rounded-full flex items-center justify-center mb-4">
                                        <i class="fas fa-music text-gradient-icon text-2xl"></i>
                                    </div>
                                    <p class="text-gray-400 text-lg mb-2">目前暂无音频模板</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 任务创建面板 -->
                <div v-if="showCreator" class="max-w-4xl mx-auto" id="task-creator">
                    <!-- 任务类型选择 -->
                    <div class="mb-8 task-type-selection">
                        <div class="flex border-b border-laser-purple/30 task-type-buttons">
                            <button
                                v-for="taskType in availableTaskTypes"
                                :key="taskType"
                                @click="selectTask(taskType)"
                                class="task-type-btn"
                                :class="getTaskTypeBtnClass(taskType)"
                            >
                                <i :class="getTaskTypeIcon(taskType)" class="mr-2"></i>
                                {{ getTaskTypeName(taskType) }}
                            </button>
                        </div>
                    </div>

                    <!-- 模型选择 -->
                    <div v-if="selectedTaskId" class="mb-6">
                        <label class="block text-sm text-gray-400 mb-2">选择模型</label>
                        <div class="model-selection">
                            <button
                                v-for="model in availableModelClasses"
                                :key="model"
                                @click="selectModel(model)"
                                class="model-btn px-4 py-2 rounded-lg text-sm transition-all"
                                :class="getModelBtnClass(model)"
                            >
                                <i v-if="model === getCurrentForm().model_cls" class="fas fa-star text-yellow-400 mr-1"></i>
                                {{ model }}
                            </button>
                        </div>
                    </div>

                    <!-- 上传区域 -->
                    <div v-if="selectedTaskId === 'i2v' || selectedTaskId === 'digital_human'" class="upload-section">
                        <!-- 上传图片 -->
                        <div v-if="selectedTaskId === 'i2v' || selectedTaskId === 'digital_human'" class="upload-area" @click="triggerImageUpload">
                            <!-- 默认上传界面 -->
                            <div v-if="!getCurrentImagePreview()" class="upload-content">
                            <div class="upload-icon">
                                <i class="fas fa-image text-gradient-icon text-xl"></i>
                            </div>
                            <p class="text-xs text-gray-400 mb-4">支持JPG、PNG格式,大小不超过10MB</p>
                            <div class="flex gap-2">
                                <button class="btn-primary px-4 py-1.5 rounded-lg transition-all flex-1">上传图片</button>
                                <button @click.stop="showImageTemplates = !showImageTemplates"
                                        class="px-4 py-1.5 rounded-lg bg-laser-purple/20 hover:bg-laser-purple/30 text-gradient-icon border border-laser-purple/40 rounded-lg transition-all">
                                    <i class="fas fa-images mr-1"></i>
                                    模板
                                </button>
                            </div>
                            </div>

                            <!-- 图片预览 -->
                            <div v-if="getCurrentImagePreview()" class="image-preview group">
                                <img :src="getCurrentImagePreview()" alt="预览图片" class="w-full h-full object-cover rounded-lg transition-all duration-300 group-hover:brightness-50">

                                <!-- 悬停时显示的操作按钮,位置在中下方 -->
                                <div class="absolute inset-x-0 bottom-4 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300">
                                    <div class="flex space-x-3">
                                        <button
                                            @click.stop="triggerImageUpload"
                                            class="w-12 h-12 flex items-center justify-center bg-white/15 text-white p-3 rounded-full transition-all duration-200 hover:scale-110 shadow-lg"
                                            title="重新上传">
                                            <i class="fas fa-upload text-lg"></i>
                                        </button>
                                        <button
                                            @click.stop="removeImage"
                                            class="w-12 h-12 flex items-center justify-center bg-white/15 text-white p-3 rounded-full transition-all duration-200 hover:scale-110 shadow-lg"
                                            title="删除图片">
                                            <i class="fas fa-trash text-lg"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>

                            <input
                                type="file"
                                ref="imageInput"
                                @change="handleImageUpload"
                                accept="image/*"
                                style="display: none;">
                        </div>

                        <!-- 上传音频 -->
                        <div v-if="selectedTaskId === 'digital_human'" class="upload-area" @click="triggerAudioUpload">
                            <!-- 默认上传界面 -->
                            <div v-if="!getCurrentAudioPreview()" class="upload-content">
                            <div class="upload-icon">
                                <i class="fas fa-microphone text-gradient-icon text-xl"></i>
                            </div>
                                <p class="text-xs text-gray-400 mb-4">支持MP4、WAV格式,最长支持120s</p>
                            <div class="flex gap-2">
                                <button class="btn-primary px-4 py-1.5 rounded-lg transition-all flex-1">上传音频</button>
                                <button @click.stop="showAudioTemplates = !showAudioTemplates"
                                        class="px-4 py-1.5 rounded-lg bg-laser-purple/20 hover:bg-laser-purple/30 text-gradient-icon border border-laser-purple/40 rounded-lg transition-all">
                                    <i class="fas fa-music mr-1"></i>
                                    模板
                                </button>
                            </div>
                            </div>

                            <!-- 音频预览 -->
                            <div v-if="getCurrentAudioPreview()" class="audio-preview group" @click.stop>
                                <audio controls class="w-full h-full">
                                    <source :src="getCurrentAudioPreview()" :type="getAudioMimeType()">
                                </audio>

                                <!-- 悬停时显示的操作按钮,位置在中下方 -->
                                <div class="absolute inset-x-0 bottom-4 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-black/20">
                                    <div class="flex space-x-3">
                                        <button
                                            @click.stop="triggerAudioUpload"
                                            class="w-12 h-12 flex items-center justify-center bg-white/15 text-white p-3 rounded-full transition-all duration-200 hover:scale-110 shadow-lg"
                                            title="重新上传">
                                            <i class="fas fa-upload text-lg"></i>
                                        </button>
                                        <button
                                            @click.stop="removeAudio"
                                            class="w-12 h-12 flex items-center justify-center bg-white/15 text-white p-3 rounded-full transition-all duration-200 hover:scale-110 shadow-lg"
                                            title="删除音频">
                                            <i class="fas fa-trash text-lg"></i>
                                        </button>
                                    </div>
                                </div>
                            </div>

                            <input
                                type="file"
                                ref="audioInput"
                                @change="handleAudioUpload"
                                accept="audio/*"
                                style="display: none;">
                        </div>
                    </div>

                    <!-- 提示词输入 -->
                    <div class="mb-6 prompt-input-section">
                        <div class="flex justify-between items-center mb-2">
                            <label class="block text-sm text-gray-400">提示词</label>
                            <div class="flex space-x-2">
                                <button @click="showPromptTemplates" class="text-xs text-gray-400 hover:text-gradient-icon transition-colors hover:text-gradient-icon" title="提示词模板">
                                    <i class="fas fa-magic"></i>
                                </button>
                                <button @click="showPromptHistory" class="text-xs text-gray-400 hover:text-gradient-icon transition-colors hover:text-gradient-icon" title="历史记录">
                                    <i class="fas fa-history"></i>
                                </button>
                            </div>
                        </div>

                        <!-- 提示词模板选择 -->
                        <div v-if="showTemplates" class="mb-4 p-4 bg-linear-dark/30 rounded-lg">
                            <h4 class="text-sm font-medium mb-3 text-gradient-icon">选择提示词模板</h4>
                            <div class="grid grid-cols-1 md:grid-cols-2 gap-3">
                                <button
                                    v-for="template in getPromptTemplates(selectedTaskId)"
                                    :key="template.id"
                                    @click="selectPromptTemplate(template)"
                                    class="p-3 text-left bg-dark-light rounded-lg hover:bg-laser-purple/20 transition-all border border-transparent hover:border-laser-purple/40"
                                >
                                    <div class="font-medium text-sm mb-1">{{ template.title }}</div>
                                    <div class="text-xs text-gray-400 line-clamp-2">{{ template.prompt }}</div>
                                </button>
                            </div>
                            <button @click="showTemplates = false" class="mt-3 text-xs text-gray-400 hover:text-gradient-icon">
                                <i class="fas fa-times mr-1"></i>关闭模板
                            </button>
                        </div>

                        <!-- 提示词历史记录 -->
                        <div v-if="showHistory" class="mb-4 p-4 bg-secondary/30 rounded-lg">
                            <div class="flex justify-between items-center mb-3">
                                <h4 class="text-sm font-medium text-gradient-icon">提示词历史记录</h4>
                                <button @click="clearPromptHistory" class="text-xs text-red-400 hover:text-red-300 transition-colors" title="清空历史记录">
                                    <i class="fas fa-trash"></i>
                                </button>
                            </div>
                            <div v-if="getPromptHistory().length === 0" class="text-center py-4 text-gray-400 text-sm">
                                暂无历史记录
                            </div>
                            <div v-else class="space-y-2 max-h-40 overflow-y-auto">
                                <button
                                    v-for="(history, index) in getPromptHistory()"
                                    :key="index"
                                    @click="selectPromptHistory(history)"
                                    class="w-full p-3 text-left bg-dark-light rounded-lg hover:bg-laser-purple/20 transition-all border border-transparent hover:border-laser-purple/40"
                                >
                                    <div class="text-xs text-gray-300 line-clamp-2">{{ history }}</div>
                                </button>
                            </div>
                            <button @click="showHistory = false" class="mt-3 text-xs text-gray-400 hover:text-gradient-icon">
                                <i class="fas fa-times mr-1"></i>关闭历史
                            </button>
                        </div>

                        <div class="relative">
                            <textarea
                                v-model="getCurrentForm().prompt"
                                class="w-full bg-dark-light border border-laser-purple/40 rounded-lg p-4 pr-16 text-sm min-h-[120px] focus:outline-none focus:ring-2 focus:ring-laser-purple/60 transition-all resize-none scrollbar-thin focus:border-laser focus:shadow-laser prompt-textarea"
                                :placeholder="getPromptPlaceholder()"
                                rows="3"
                                required
                            ></textarea>
                        </div>

                        <!-- 高级配置选项 -->
                        <!-- <div class="mt-4 grid grid-cols-1 md:grid-cols-2 gap-4">
                            <div>
                                <label class="block text-sm text-gray-400 mb-2">种子值</label>
                                <input
                                    v-model="getCurrentForm().seed"
                                    type="number"
                                    class="w-full bg-dark-light border border-laser-purple/40 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-laser-purple/60 transition-all"
                                    placeholder="随机种子值"
                                />
                            </div> -->
                            <!-- <div>
                                <label class="block text-sm text-gray-400 mb-2">推理阶段</label>
                                <select
                                    v-model="getCurrentForm().stage"
                                    class="w-full bg-dark-light border border-laser-purple/40 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-laser-purple/60 transition-all"
                                >
                                    <option value="single_stage">单阶段</option>
                                    <option value="multi_stage">多阶段</option>
                                    <option value="original">原始阶段</option>
                                </select>
                            </div> -->
                        </div>

                        <div class="flex justify-between items-center mt-4">
                            <p class="text-xs text-gray-500">最多支持500个字符</p>
                            <div class="flex space-x-2">
                                <button @click="clearPrompt" class="text-xs px-3 py-1 rounded transition-all">
                                    <i class="fas fa-sync-alt mr-1"></i>
                                    清空
                                </button>
                                <button @click="submitTask" :disabled="submitting" class="btn-primary px-4 py-1 rounded transition-all">
                                    <i class="fas fa-play mr-1"></i>
                                    {{ submitting ? '生成中...' : '生成视频' }}
                                </button>
                        </div>
                    </div>
                </div>


                <!-- 任务详情显示面板 -->
                <div v-if="selectedTask && !showCreator" class="max-w-4xl mx-auto task-detail-panel">
                    <div class="mb-6">

                        <!-- 输出视频 -->
                        <div v-if="selectedTask.status === 'SUCCEED' && selectedTask.outputs && Object.keys(selectedTask.outputs).length > 0" class="bg-secondary/30 rounded-xl p-4 mb-6 task-completed-panel">
                            <h4 class="text-sm font-medium mb-3 flex items-center">
                                <i class="fas fa-video text-gradient-icon mr-2"></i>
                                输出结果
                            </h4>
                            <div class="space-y-3">
                                <div v-for="(output, key) in selectedTask.outputs" :key="key" class="flex items-center justify-between bg-dark-light rounded-lg p-3">
                                    <div class="flex items-center">
                                        <i class="fas fa-file-video text-gradient-icon mr-2"></i>
                                        <span class="text-sm">{{ output }}</span>
                                        <span v-if="selectedTaskFiles.outputs[key] && selectedTaskFiles.outputs[key].error"
                                              class="ml-2 text-xs text-red-400">
                                            <i class="fas fa-exclamation-triangle"></i> 加载失败
                                        </span>
                                    </div>
                                    <div class="flex space-x-2">
                                        <button v-if="selectedTaskFiles.outputs[key] && selectedTaskFiles.outputs[key].url"
                                                @click="downloadFile(selectedTaskFiles.outputs[key])"
                                                class="text-xs btn-primary px-2 py-1 rounded">
                                            <i class="fas fa-download mr-1"></i>下载
                                        </button>
                                        <div v-else-if="!selectedTaskFiles.outputs[key]"
                                             class="text-xs text-gray-400 px-2 py-1">
                                            <i class="fas fa-spinner fa-spin mr-1"></i>加载中
                                        </div>
                                    </div>
                                </div>
                            </div>
<!-- 视频预览 -->
<div class="w-full">
    <div class="relative w-full h-[400px] flex items-center justify-center rounded-xl bg-black border border-laser-purple/50 overflow-hidden">
        <div data-test-id="dragable-content" data-is-dragging="false" draggable="true" class="w-full h-full flex items-center justify-center">
            <div class="w-full flexitems-center justify-center">
                <video
                    v-if="selectedTaskFiles.outputs.output_video && selectedTaskFiles.outputs.output_video.url"
                    class="object-contain bg-black"
                    style="object-fit: contain; height: 400px; visibility: visible;"
                    controls
                    preload="metadata"
                    :src="selectedTaskFiles.outputs.output_video.url">
                    您的浏览器不支持视频播放。
                </video>

                <div v-else-if="selectedTaskFiles.outputs.output_video && selectedTaskFiles.outputs.output_video.error"
                    class="w-full h-full flex items-center justify-center bg-red-900/20">
                    <div class="text-center">
                        <i class="fas fa-exclamation-triangle text-red-400 text-2xl mb-2"></i>
                        <p class="text-red-400 text-sm">视频加载失败</p>
                    </div>
                </div>

                <div v-else
                    class="w-full h-full flex items-center justify-center bg-gray-700">
                    <div class="text-center">
                        <i class="fas fa-spinner fa-spin text-gray-400 text-2xl mb-2"></i>
                        <p class="text-gray-400 text-sm">加载视频中...</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

                        </div>


                        <!-- 任务进行中信息 -->
                        <div v-if="['CREATED', 'PENDING', 'RUNNING'].includes(selectedTask.status) && !showCreator" class="max-w-4xl mx-auto task-running-panel">
                            <div class="text-center py-8">
                                <div class="w-24 h-24 mx-auto bg-laser-purple/20 rounded-full flex items-center justify-center mb-6 animate-pulse-slow">
                                    <i class="fas fa-spinner fa-spin text-gradient-icon text-3xl"></i>
                                </div>
                                <h3 class="text-xl font-medium mb-2">视频生成中</h3>
                                <p class="text-gray-400 mb-6">AI正在努力生成您的视频,请稍候...</p>
                            </div>

                        </div>

                        <!-- 任务失败信息 -->
                        <div v-if="selectedTask && selectedTask.status === 'FAILED' && !showCreator" class="max-w-4xl mx-auto task-failed-panel">
                            <div class="text-center py-8">
                                <div class="w-24 h-24 mx-auto bg-red-500/10 rounded-full flex items-center justify-center mb-6">
                                    <i class="fas fa-exclamation-triangle text-red-500 text-3xl"></i>
                                </div>
                                <h3 class="text-xl font-medium mb-2">视频生成失败</h3>
                                <p class="text-gray-400 mb-4 max-w-md mx-auto">
                                    很抱歉,您的视频生成任务未能完成。这可能是由于资源限制或参数设置问题导致的。
                                </p>
                            </div>
                        </div>

                        <!-- 任务取消信息 -->
                        <div v-if="selectedTask && selectedTask.status === 'CANCEL' && !showCreator" class="max-w-4xl mx-auto task-cancelled-panel">
                            <div class="text-center py-8">
                                <div class="w-24 h-24 mx-auto bg-yellow-500/10 rounded-full flex items-center justify-center mb-6">
                                    <i class="fas fa-ban text-yellow-500 text-3xl"></i>
                                </div>
                                <h3 class="text-xl font-medium mb-2">任务已取消</h3>
                                <p class="text-gray-400 mb-4 max-w-md mx-auto">
                                    此任务已被取消,您可以重新生成或查看之前上传的素材。
                                </p>
                            </div>

                        </div>

                        <!-- 任务操作 -->
                        <div class="flex justify-center space-x-3 p-4">
                            <button v-if="['CREATED', 'PENDING', 'RUNNING'].includes(selectedTask.status)"
                                    @click="cancelTask(selectedTask.task_id)"
                                    class="px-4 py-2 btn-primary rounded-lg text-sm transition-all">
                                <i class="fas fa-times mr-2"></i>
                                取消任务
                            </button>
                            <button v-if="['SUCCEED', 'FAILED', 'CANCEL'].includes(selectedTask.status)"
                                    @click="resumeTask(selectedTask.task_id)"
                                    class="px-4 py-2 btn-primary rounded-lg text-sm transition-all">
                                <i class="fas fa-redo mr-2"></i>
                                重新生成
                            </button>
                        </div>
                        <!-- 任务状态显示 -->
                        <div class="bg-secondary/30 rounded-xl p-6 mb-6">
                            <h4 class="text-sm font-medium mb-3 flex items-center">
                                <i class="fas fa-info-circle text-gradient-icon mr-2"></i>
                                任务信息
                            </h4>
                            <ul class="space-y-2 text-sm">
                                <li class="flex justify-between">
                                    <span class="text-gray-400">任务ID</span>
                                    <span>{{ selectedTask.task_id }}</span>
                                </li>
                                <li class="flex justify-between">
                                    <span class="text-gray-400">任务类型</span>
                                    <span>{{ selectedTask.task_type }}</span>
                                </li>
                                <li class="flex justify-between">
                                    <span class="text-gray-400">模型名称</span>
                                    <span class="text-gradient-icon">{{ selectedTask.model_cls }}</span>
                                </li>
                                <li class="flex justify-between">
                                    <span class="text-gray-400">创建时间</span>
                                    <span>{{ formatTime(selectedTask.create_t) }}</span>
                                </li>
                                <li class="flex justify-between">
                                    <span class="text-gray-400">状态</span>
                                    <span :class="getStatusTextClass(selectedTask.status)">{{ selectedTask.status }}</span>
                                </li>
                            </ul>
                        </div>

                        <!-- 提示词 -->
                        <div class="bg-secondary/30 rounded-xl p-4 mb-6">
                            <h4 class="text-sm font-medium mb-3 flex items-center">
                                <i class="fas fa-file-alt text-gradient-icon mr-2"></i>
                                提示词
                            </h4>
                            <div class="bg-dark-light rounded-lg p-4 text-sm text-gray-300">
                                <p>{{ selectedTask.params.prompt || '无提示词' }}</p>
                            </div>
                        </div>

                        <div v-if="selectedTask.inputs && Object.keys(selectedTask.inputs).length" class="bg-secondary/30 rounded-xl p-4 mb-6">
                            <h4 class="text-sm font-medium mb-3 flex items-center">
                                <i class="fas fa-upload text-gradient-icon mr-2"></i>
                                上传素材
                                <span v-if="loadingTaskFiles" class="ml-2 text-xs text-gray-400">(加载中...)</span>
                            </h4>
                            <div class="space-y-3">
                                <template v-for="(input, key) in selectedTask.inputs" :key="key">
                                    <div class="flex items-center gap-3">
                                        <template v-if="key.includes('image')">
                                            <i class="fas fa-image text-gradient-icon text-xl"></i>
                                            <div class="flex items-center gap-2">
                                                <span v-if="!selectedTaskFiles.inputs[key] || !selectedTaskFiles.inputs[key].url"
                                                      class="text-gray-400 text-sm">{{ typeof input === 'string' ? input : '图片' }}</span>
                                                <div class="flex items-center gap-2 relative group">
                                                    <img v-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].url"
                                                         :src="selectedTaskFiles.inputs[key].url"
                                                         :alt="input"
                                                         class="w-20 h-20 object-cover rounded bg-dark-light border border-gray-700">
                                                    <div v-else-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].error"
                                                         class="w-20 h-20 rounded bg-red-900/20 border border-red-500/30 flex items-center justify-center">
                                                        <i class="fas fa-exclamation-triangle text-red-400"></i>
                                                    </div>
                                                    <div v-else
                                                         class="w-20 h-20 rounded bg-gray-700 border border-gray-600 flex items-center justify-center">
                                                        <i class="fas fa-spinner fa-spin text-gray-400"></i>
                                                    </div>
                                                    <button v-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].url"
                                                            @click="downloadFile(selectedTaskFiles.inputs[key])"
                                                            class="text-xs px-2 py-1 rounded">
                                                        <i class="fas fa-download mr-1 text-white opacity-30 hover:opacity-100 transition-opacity"></i>
                                                    </button>
                                                </div>
                                            </div>
                                        </template>
                                        <template v-else-if="key.includes('audio')">
                                            <i class="fas fa-microphone text-gradient-icon text-xl"></i>
                                            <div class="flex items-center gap-2">
                                                <span v-if="!selectedTaskFiles.inputs[key] || !selectedTaskFiles.inputs[key].url"
                                                      class="text-gray-400 text-sm">{{ typeof input === 'string' ? input : '音频文件' }}</span>
                                                <div class="flex items-center gap-2">
                                                    <audio v-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].url"
                                                           :src="selectedTaskFiles.inputs[key].url"
                                                           controls
                                                           class="h-8 text-gradient-icon">
                                                        您的浏览器不支持音频播放
                                                    </audio>
                                                    <div v-else-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].error"
                                                         class="h-8 px-3 rounded bg-red-900/20 border border-red-500/30 flex items-center">
                                                        <i class="fas fa-exclamation-triangle text-red-400 text-xs"></i>
                                                    </div>
                                                    <div v-else
                                                         class="h-8 px-3 rounded bg-gray-700 border border-gray-600 flex items-center">
                                                        <i class="fas fa-spinner fa-spin text-gray-400 text-xs"></i>
                                                    </div>
                                                    <button v-if="selectedTaskFiles.inputs[key] && selectedTaskFiles.inputs[key].url"
                                                            @click="downloadFile(selectedTaskFiles.inputs[key])"
                                                            class="text-xs px-2 py-1 rounded">
                                                        <i class="fas fa-download mr-1 text-white opacity-30 hover:opacity-100 transition-opacity"></i>
                                                    </button>
                                                </div>
                                            </div>
                        </div>
                                        </template>
                            </div>
                                </template>
                            </div>
                        </div>

                        </div>
                    </div>
                </div>


        <!-- 加载指示器 -->
        <div v-if="loading" class="loading position-fixed top-50 start-50 translate-middle show">
            <div class="spinner-border text-gradient-icon" role="status">
                <span class="visually-hidden">加载中...</span>
            </div>
        </div>

        <!-- 增强的提示消息系统 -->
        <div v-cloak>
            <div v-if="alert.show"
                class="fixed top-3 left-1/2 transform -translate-x-1/2 z-50 max-w-[16rem] w-full px-1"
                :class="getAlertClass(alert.type)">
                <div class="alert flex items-center p-2 rounded-md shadow-md border-l-4 transition-all duration-300 ease-out"
                    :class="getAlertBorderClass(alert.type)">
                    <div class="flex-shrink-0 mr-1">
                        <i :class="getAlertIcon(alert.type)" class="text-base"></i>
                    </div>
                    <div class="flex-1">
                        <p class="text-xs font-medium" :class="getAlertTextClass(alert.type)">
                            {{ alert.message }}
                        </p>
                    </div>
                    <div class="flex-shrink-0 ml-1">
                        <button @click="alert.show = false"
                                class="text-gray-400 hover:text-gray-600 transition-colors">
                            <i class="fas fa-times text-xs"></i>
                        </button>
                    </div>
                </div>
            </div>
    </div>
    </div>


    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>

    <script>
        // 检测Font Awesome图标是否加载成功
        function checkFontAwesome() {
            const testIcon = document.createElement('i');
            testIcon.className = 'fas fa-check';
            testIcon.style.position = 'absolute';
            testIcon.style.left = '-9999px';
            document.body.appendChild(testIcon);

            const computedStyle = window.getComputedStyle(testIcon, ':before');
            const content = computedStyle.getPropertyValue('content');

            document.body.removeChild(testIcon);

            // 如果图标没有正确显示,使用备用方案
            if (!content || content === 'none' || content === 'normal') {
                console.warn('Font Awesome 图标加载失败,使用备用方案');
                replaceIconsWithFallback();
            }
        }

        // 使用备用图标替换失败的图标
        function replaceIconsWithFallback() {
            const iconMap = {
                'fas fa-video': '🎥',
                'fas fa-plus': '',
                'fas fa-search': '🔍',
                'fas fa-clock': '',
                'fas fa-bars': '',
                'fas fa-sign-out-alt': '🚪',
                'fas fa-star': '',
                'fas fa-cloud-upload-alt': '☁️',
                'fas fa-microphone': '🎤',
                'fas fa-magic': '',
                'fas fa-history': '📚',
                'fas fa-times': '✖️',
                'fas fa-trash': '🗑️',
                'fas fa-sync-alt': '🔄',
                'fas fa-play': '▶️',
                'fas fa-share-alt': '📤',
                'fas fa-download': '⬇️',
                'fas fa-info-circle': 'ℹ️',
                'fas fa-file-alt': '📄',
                'fas fa-file-video': '🎬',
                'fas fa-eye': '👁️',
                'fas fa-exclamation-triangle': '⚠️',
                'fas fa-lightbulb': '💡',
                'fas fa-check': '',
                'fas fa-user': '👤',
                'fas fa-image': '🖼️',
                'fas fa-font': '🔤',
                'fas fa-spinner': '🌀',
                'fas fa-check-circle': '',
                'fas fa-hourglass-half': '',
                'fas fa-ban': '🚫',
                'fas fa-question-circle': '',
                'fas fa-times-circle': '',
                'fas fa-music': '🎵',
                'fas fa-tags': '🏷️',
                'fas fa-chart-bar': '📊',
                'fas fa-redo': '🔄',
                'fas fa-pause': '⏸️'
            };

            // 替换所有图标
            Object.keys(iconMap).forEach(iconClass => {
                const icons = document.querySelectorAll(`.${iconClass.replace(/\s+/g, '.')}`);
                icons.forEach(icon => {
                    icon.innerHTML = iconMap[iconClass];
                    icon.className = icon.className.replace(/fas fa-[a-z-]+/g, '');
                });
            });
        }

        // 页面加载完成后检查图标
        document.addEventListener('DOMContentLoaded', function() {
            setTimeout(checkFontAwesome, 1000); // 延迟1秒检查,确保CDN加载完成
        });
    </script>

    <script>
        const { createApp, ref, computed, onMounted, watch } = Vue;

        createApp({
            setup() {
                // 响应式数据
                const loading = ref(false);
                const alert = ref({ show: false, message: '', type: 'info' });
                const submitting = ref(false);
                const showCreator = ref(true);
                const searchQuery = ref('');
                const generatingThumbnails = ref(false);
                const sidebarCollapsed = ref(false);

                const thumbnailCache = ref(new Map());
                const thumbnailCacheLoaded = ref(false);

                const imageTemplates = ref([]);
                const audioTemplates = ref([]);
                const showImageTemplates = ref(false);
                const showAudioTemplates = ref(false);
                const currentUser = ref({});
                const models = ref([]);
                const tasks = ref([]);
                const isLoggedIn = ref(false);

                const selectedTaskId = ref(null);
                const selectedTask = ref(null);
                const selectedTaskFiles = ref({ inputs: {}, outputs: {} }); // 存储任务的输入输出文件
                const loadingTaskFiles = ref(false); // 加载任务文件的状态
                const statusFilter = ref('ALL');
                const pagination = ref(null);
                const currentPage = ref(1);
                const pageSize = ref(10);

                // 为三个任务类型分别创建独立的表单
                const t2vForm = ref({
                    task: 't2v',
                    model_cls: '',
                    stage: 'single_stage',
                    prompt: '',
                    seed: 42
                });

                const i2vForm = ref({
                    task: 'i2v',
                    model_cls: '',
                    stage: 'multi_stage',
                    imageFile: null,
                    prompt: '',
                    seed: 42
                });

                const digitalHumanForm = ref({
                    task: 'digital_human',
                    model_cls: '',
                    stage: 'single_stage',
                    imageFile: null,
                    audioFile: null,
                    prompt: '',
                    seed: 42
                });

                // 根据当前选择的任务类型获取对应的表单
                const getCurrentForm = () => {
                    switch (selectedTaskId.value) {
                        case 't2v':
                            return t2vForm.value;
                        case 'i2v':
                            return i2vForm.value;
                        case 'digital_human':
                            return digitalHumanForm.value;
                        default:
                            return t2vForm.value;
                    }
                };

                // 为每个任务类型创建独立的预览变量
                const i2vImagePreview = ref(null);
                const digitalHumanImagePreview = ref(null);
                const digitalHumanAudioPreview = ref(null);

                // 根据当前任务类型获取对应的预览变量
                const getCurrentImagePreview = () => {
                    switch (selectedTaskId.value) {
                        case 't2v':
                            return null;
                        case 'i2v':
                            return i2vImagePreview.value;
                        case 'digital_human':
                            return digitalHumanImagePreview.value;
                        default:
                            return null;
                    }
                };

                const getCurrentAudioPreview = () => {
                    switch (selectedTaskId.value) {
                        case 't2v':
                            return null
                        case 'i2v':
                            return null
                        case 'digital_human':
                            return digitalHumanAudioPreview.value;
                        default:
                            return null;
                    }
                };

                const setCurrentImagePreview = (value) => {
                    switch (selectedTaskId.value) {
                        case 't2v':
                            break;
                        case 'i2v':
                            i2vImagePreview.value = value;
                            break;
                        case 'digital_human':
                            digitalHumanImagePreview.value = value;
                            break;
                    }
                };

                const setCurrentAudioPreview = (value) => {
                    switch (selectedTaskId.value) {
                        case 't2v':
                            break;
                        case 'i2v':
                            break;
                        case 'digital_human':
                            digitalHumanAudioPreview.value = value;
                            break;
                    }
                };

                // 提示词模板相关
                const showTemplates = ref(false);
                const showHistory = ref(false);

                // 计算属性
                const availableTaskTypes = computed(() => {
                    const types = [...new Set(models.value.map(m => m.task))];
                    // 重新排序,确保数字人在最左边
                    const orderedTypes = [];

                    // 检查是否有包含audio或seko的i2v模型,如果有则添加digital_human类型
                    const hasDigitalHumanModels = models.value.some(m =>
                        m.task === 'i2v' && (m.model_cls.toLowerCase().includes('audio') || m.model_cls.toLowerCase().includes('seko'))
                    );

                    // 优先添加数字人(如果存在相关模型)
                    if (hasDigitalHumanModels) {
                        orderedTypes.push('digital_human');
                    }

                    // 然后添加其他类型
                    types.forEach(type => {
                        if (type !== 'digital_human') {
                            orderedTypes.push(type);
                        }
                    });

                    return orderedTypes;
                });

                const availableModelClasses = computed(() => {
                    if (!selectedTaskId.value) return [];

                    // 如果是数字人任务类型,显示包含audio或seko的i2v模型
                    if (selectedTaskId.value === 'digital_human') {
                        return [...new Set(models.value
                            .filter(m => m.task === 'i2v' && (m.model_cls.toLowerCase().includes('audio') || m.model_cls.toLowerCase().includes('seko')))
                            .map(m => m.model_cls))];
                    }

                    // 如果是i2v任务类型,剔除包含audio或seko的模型
                    if (selectedTaskId.value === 'i2v') {
                        return [...new Set(models.value
                            .filter(m => m.task === 'i2v' && !m.model_cls.toLowerCase().includes('audio') && !m.model_cls.toLowerCase().includes('seko'))
                            .map(m => m.model_cls))];
                    }

                    // 其他任务类型正常处理
                    return [...new Set(models.value
                        .filter(m => m.task === selectedTaskId.value)
                        .map(m => m.model_cls))];
                });

                const filteredTasks = computed(() => {
                    let filtered = tasks.value;

                    // 状态过滤
                    if (statusFilter.value !== 'ALL') {
                        filtered = filtered.filter(task => task.status === statusFilter.value);
                    }

                    // 搜索过滤
                    if (searchQuery.value) {
                        filtered = filtered.filter(task =>
                        task.params.prompt?.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
                        task.task_id.toLowerCase().includes(searchQuery.value.toLowerCase()) ||
                        task.task_type.toLowerCase().includes(searchQuery.value.toLowerCase())
                    );
                    }

                    // 按时间排序,最新的任务在前面
                    filtered = filtered.sort((a, b) => {
                        const timeA = parseInt(a.create_t) || 0;
                        const timeB = parseInt(b.create_t) || 0;
                        return timeB - timeA; // 降序排列,最新的在前
                    });

                    return filtered;
                });

                // 方法
                const showAlert = (message, type = 'info') => {
                    alert.value = { show: true, message, type };
                    setTimeout(() => {
                        alert.value.show = false;
                    }, 5000);
                };

                const setLoading = (value) => {
                    loading.value = value;
                };

                const apiCall = async (endpoint, options = {}) => {
                    const url = `${endpoint}`;
                    const headers = {
                        'Content-Type': 'application/json',
                        ...options.headers
                    };

                    if (localStorage.getItem('accessToken')) {
                        headers['Authorization'] = `Bearer ${localStorage.getItem('accessToken')}`;
                    }

                    const response = await fetch(url, {
                        ...options,
                        headers
                    });

                    if (response.status === 401) {
                        logout();
                        throw new Error('认证失败,请重新登录'); }
                    if (response.status === 400) {
                        const error = await response.json();
                        showAlert(error.message, 'danger');
                        throw new Error(error.message);
                    }

                    // 添加50ms延迟,防止触发服务端频率限制
                    await new Promise(resolve => setTimeout(resolve, 50));

                    return response;
                };

                const loginWithGitHub = async () => {
                    try {
                        setLoading(true);
                        const response = await fetch('./auth/login/github');
                        const data = await response.json();
                        window.location.href = data.auth_url;
                    } catch (error) {
                        showAlert('获取GitHub认证URL失败', 'danger');
                    } finally {
                        setLoading(false);
                    }
                };

                const handleGitHubCallback = async (code) => {
                    try {
                        setLoading(true);
                        const response = await fetch(`./auth/callback/github?code=${code}`);
                        if (response.ok) {
                            const data = await response.json();
                            console.log(data);
                            localStorage.setItem('accessToken', data.access_token);
                            localStorage.setItem('currentUser', JSON.stringify(data.user_info));
                            currentUser.value = data.user_info;
                            isLoggedIn.value = true;
                        } else {
                            const error = await response.json();
                            showAlert(`登录失败: ${error.detail}`, 'danger');
                        }
                        window.location.href = '/';
                    } catch (error) {
                        showAlert('登录过程中发生错误', 'danger');
                        console.error(error);
                    } finally {
                        setLoading(false);
                    }
                };



                const logout = () => {
                    localStorage.removeItem('accessToken');
                    localStorage.removeItem('currentUser');
                    currentUser.value = {};
                    isLoggedIn.value = false;
                    models.value = [];
                    tasks.value = [];
                    showAlert('已退出登录', 'info');
                };

                const loadModels = async () => {
                    try {
                        console.log('开始加载模型列表...');
                        const response = await apiRequest('./api/v1/model/list');
                        if (response && response.ok) {
                            const data = await response.json();
                            console.log('模型列表数据:', data);
                            models.value = data.models || [];
                            console.log('设置后的models.value:', models.value);
                        } else if (response) {
                            console.error('模型列表API响应失败:', response);
                            showAlert('加载模型列表失败', 'danger');
                        }
                        // 如果response为null,说明是认证错误,apiRequest已经处理了
                    } catch (error) {
                        console.error('加载模型失败:', error);
                        showAlert(`加载模型失败: ${error.message}`, 'danger');
                    }
                };

                // 加载模板文件
                const loadTemplates = async () => {
                    try {
                        const response = await apiCall('./api/v1/template/list');
                        if (response.ok) {
                            const data = await response.json();
                            imageTemplates.value = data.templates.images || [];
                            audioTemplates.value = data.templates.audios || [];
                        } else {
                            console.warn('加载模板失败');
                        }
                    } catch (error) {
                        console.warn('加载模板失败:', error);
                    }
                };

                // 选择图片模板
                const selectImageTemplate = async (template) => {
                    try {
                        const response = await fetch(template.url);
                        if (response.ok) {
                            const blob = await response.blob();
                            const file = new File([blob], template.filename, { type: blob.type });

                            if (selectedTaskId.value === 'i2v') {
                                i2vForm.value.imageFile = file;
                            } else if (selectedTaskId.value === 'digital_human') {
                                digitalHumanForm.value.imageFile = file;
                            }

                            // 创建预览
                            const reader = new FileReader();
                            reader.onload = (e) => {
                                setCurrentImagePreview(e.target.result);
                            };
                            reader.readAsDataURL(file);

                            showImageTemplates.value = false;
                            showAlert('图片模板已选择', 'success');
                        } else {
                            showAlert('加载图片模板失败', 'danger');
                        }
                    } catch (error) {
                        showAlert(`加载图片模板失败: ${error.message}`, 'danger');
                    }
                };

                // 选择音频模板
                const selectAudioTemplate = async (template) => {
                    try {
                        const response = await fetch(template.url);
                        if (response.ok) {
                            const blob = await response.blob();
                            const file = new File([blob], template.filename, { type: blob.type });

                            digitalHumanForm.value.audioFile = file;

                            // 创建预览
                            const reader = new FileReader();
                            reader.onload = (e) => {
                                setCurrentAudioPreview(e.target.result);
                            };
                            reader.readAsDataURL(file);

                            showAudioTemplates.value = false;
                            showAlert('音频模板已选择', 'success');
                        } else {
                            showAlert('加载音频模板失败', 'danger');
                        }
                    } catch (error) {
                        showAlert(`加载音频模板失败: ${error.message}`, 'danger');
                    }
                };

                // 预览音频模板
                const previewAudioTemplate = (template) => {
                    const audio = new Audio(template.url);
                    audio.play().catch(error => {
                        console.error('音频播放失败:', error);
                        showAlert('音频播放失败', 'danger');
                    });
                };

                const handleImageUpload = (event) => {
                    const file = event.target.files[0];
                    if (file) {
                        if (selectedTaskId.value === 'i2v') {
                            i2vForm.value.imageFile = file;
                        } else if (selectedTaskId.value === 'digital_human') {
                            digitalHumanForm.value.imageFile = file;
                        }
                        const reader = new FileReader();
                        reader.onload = (e) => {
                            setCurrentImagePreview(e.target.result);
                        };
                        reader.readAsDataURL(file);
                    } else {
                        // 用户取消了选择,保持原有图片不变
                        // 不做任何操作
                    }
                };

                const selectTask = (taskType) => {
                    selectedTaskId.value = taskType;

                    // 根据任务类型恢复对应的预览
                    if (taskType === 'i2v' && i2vForm.value.imageFile) {
                        // 恢复图片预览
                        const reader = new FileReader();
                        reader.onload = (e) => {
                            setCurrentImagePreview(e.target.result);
                        };
                        reader.readAsDataURL(i2vForm.value.imageFile);
                    } else if (taskType === 'digital_human') {
                        // 恢复数字人任务的图片和音频预览
                        if (digitalHumanForm.value.imageFile) {
                            const reader = new FileReader();
                            reader.onload = (e) => {
                                setCurrentImagePreview(e.target.result);
                            };
                            reader.readAsDataURL(digitalHumanForm.value.imageFile);
                        }
                        if (digitalHumanForm.value.audioFile) {
                            const reader = new FileReader();
                            reader.onload = (e) => {
                                setCurrentAudioPreview(e.target.result);
                            };
                            reader.readAsDataURL(digitalHumanForm.value.audioFile);
                        }
                    }

                    // 如果当前表单没有选择模型,自动选择第一个可用的模型
                    const currentForm = getCurrentForm();
                    if (!currentForm.model_cls) {
                    const availableModels = models.value.filter(m => m.task === taskType);
                    if (availableModels.length > 0) {
                        const firstModel = availableModels[0];
                            currentForm.model_cls = firstModel.model_cls;
                            currentForm.stage = firstModel.stage;
                        }
                    }
                };

                const selectModel = (model) => {
                    getCurrentForm().model_cls = model;
                };

                const triggerImageUpload = () => {
                    document.querySelector('input[type="file"][accept="image/*"]').click();
                };

                const triggerAudioUpload = () => {
                    document.querySelector('input[type="file"][accept="audio/*"]').click();
                };

                const removeImage = () => {
                    setCurrentImagePreview(null);
                    if (selectedTaskId.value === 'i2v') {
                        i2vForm.value.imageFile = null;
                    } else if (selectedTaskId.value === 'digital_human') {
                        digitalHumanForm.value.imageFile = null;
                    }
                    // 重置文件输入框,确保可以重新选择相同文件
                    const imageInput = document.querySelector('input[type="file"][accept="image/*"]');
                    if (imageInput) {
                        imageInput.value = '';
                    }
                };

                const removeAudio = () => {
                    setCurrentAudioPreview(null);
                    digitalHumanForm.value.audioFile = null;
                    console.log('音频已移除');
                    // 重置音频文件输入框,确保可以重新选择相同文件
                    const audioInput = document.querySelector('input[type="file"][accept="audio/*"]');
                    if (audioInput) {
                        audioInput.value = '';
                    }
                };

                const getAudioMimeType = () => {
                    if (digitalHumanForm.value.audioFile) {
                        console.log('音频文件类型:', digitalHumanForm.value.audioFile.type);
                        return digitalHumanForm.value.audioFile.type;
                    }
                    console.log('使用默认音频类型: audio/mpeg');
                    return 'audio/mpeg'; // 默认类型
                };

                const handleAudioUpload = (event) => {
                    const file = event.target.files[0];

                    if (file) {
                        digitalHumanForm.value.audioFile = file;
                        const reader = new FileReader();
                        reader.onload = (e) => {
                            setCurrentAudioPreview(e.target.result);
                            console.log('音频预览已设置:', e.target.result);
                        };
                        reader.readAsDataURL(file);
                    } else {
                        setCurrentAudioPreview(null);
                    }
                };

                const submitTask = async () => {
                    try {
                        const currentForm = getCurrentForm();

                        // 表单验证
                        if (!selectedTaskId.value) {
                            showAlert('请选择任务类型', 'warning');
                            return;
                        }

                        if (!currentForm.model_cls) {
                            showAlert('请选择模型', 'warning');
                            return;
                        }

                        if (!currentForm.prompt || currentForm.prompt.trim().length === 0) {
                            showAlert('请输入提示词', 'warning');
                            return;
                        }

                        if (currentForm.prompt.length > 500) {
                            showAlert('提示词长度不能超过500个字符', 'warning');
                            return;
                        }

                        if (selectedTaskId.value === 'i2v' && !currentForm.imageFile) {
                            showAlert('图生视频任务需要上传参考图片', 'warning');
                            return;
                        }

                        if (selectedTaskId.value === 'digital_human' && !currentForm.imageFile) {
                            showAlert('数字人任务需要上传参考图片', 'warning');
                            return;
                        }

                        if (selectedTaskId.value === 'digital_human' && !currentForm.audioFile) {
                            showAlert('数字人任务需要上传音频文件', 'warning');
                            return;
                        }

                        setLoading(true);
                        submitting.value = true;

                        // 确定实际提交的任务类型
                        let actualTaskType = selectedTaskId.value;
                        if (selectedTaskId.value === 'digital_human') {
                            actualTaskType = 'i2v'; // 数字人任务实际提交为i2v
                        }

                        var formData = {
                            task: actualTaskType,
                            model_cls: currentForm.model_cls,
                            stage: currentForm.stage,
                            prompt: currentForm.prompt.trim(),
                            seed: currentForm.seed || Math.floor(Math.random() * 1000000)
                        };

                        if (currentForm.model_cls.startsWith('wan2.1')) {
                            formData.negative_prompt = "镜头晃动,色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
                        }

                        if (selectedTaskId.value === 'i2v' && currentForm.imageFile) {
                            const base64 = await fileToBase64(currentForm.imageFile);
                            formData.input_image = {
                                type: 'base64',
                                data: base64
                            };
                        }

                        if (selectedTaskId.value === 'digital_human') {
                            if (currentForm.imageFile) {
                                const base64 = await fileToBase64(currentForm.imageFile);
                                formData.input_image = {
                                    type: 'base64',
                                    data: base64
                                };
                            }
                            if (currentForm.audioFile) {
                                const base64 = await fileToBase64(currentForm.audioFile);
                                formData.input_audio = {
                                    type: 'base64',
                                    data: base64
                                };
                                formData.negative_prompt = "色调艳丽,过曝,静态,细节模糊不清,字幕,风格,作品,画作,画面,静止,整体发灰,最差质量,低质量,JPEG压缩残留,丑陋的,残缺的,多余的手指,画得不好的手部,画得不好的脸部,畸形的,毁容的,形态畸形的肢体,手指融合,静止不动的画面,杂乱的背景,三条腿,背景人很多,倒着走"
                            }
                        }

                        const response = await apiRequest('./api/v1/task/submit', {
                            method: 'POST',
                            body: JSON.stringify(formData)
                        });

                        if (response && response.ok) {
                            const result = await response.json();
                            showAlert(`任务提交成功!任务ID: ${result.task_id}`, 'success');

                            // 保存提示词到历史记录
                            addPromptToHistory(currentForm.prompt);

                            await refreshTasks();
                            showCreator.value = true;

                            // 重新选择数字人任务(如果可用)
                            if (availableTaskTypes.value.includes('digital_human')) {
                                selectTask('digital_human');
                            }

                            // 重置所有表单
                            t2vForm.value = {
                                task: 't2v',
                                model_cls: '',
                                stage: 'single_stage',
                                prompt: '',
                                seed: Math.floor(Math.random() * 1000000)
                            };
                            i2vForm.value = {
                                task: 'i2v',
                                model_cls: '',
                                stage: 'multi_stage',
                                imageFile: null,
                                prompt: '',
                                seed: 42
                            };
                            digitalHumanForm.value = {
                                task: 'digital_human',
                                model_cls: '',
                                stage: 'single_stage',
                                imageFile: null,
                                audioFile: null,
                                prompt: '',
                                seed: Math.floor(Math.random() * 1000000)
                            };
                            // 重置所有预览
                            i2vImagePreview.value = null;
                            digitalHumanImagePreview.value = null;
                            digitalHumanAudioPreview.value = null;
                        } else {
                            const error = await response.json();
                            showAlert(`任务提交失败: ${error.message},${error.detail}`, 'danger');
                        }
                    } catch (error) {
                        showAlert(`提交任务失败: ${error.message}`, 'danger');
                    } finally {
                        submitting.value = false;
                        setLoading(false);
                    }
                };

                const fileToBase64 = (file) => {
                    return new Promise((resolve, reject) => {
                        const reader = new FileReader();
                        reader.readAsDataURL(file);
                        reader.onload = () => {
                            const base64 = reader.result.split(',')[1];
                            resolve(base64);
                        };
                        reader.onerror = error => reject(error);
                    });
                };

                const formatTime = (timestamp) => {
                    if (!timestamp) return '';
                    const date = new Date(timestamp * 1000);
                    return date.toLocaleString('zh-CN');
                };

                const preloadInputImages = async (tasks) => {
                    // 为所有任务预加载输入图片
                    for (const task of tasks) {
                        if (task.inputs) {
                            // 查找输入中的图片文件
                            const imageInputs = Object.keys(task.inputs).filter(key =>
                                key.includes('image') ||
                                task.inputs[key].toString().toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)
                            );

                            // 预加载第一个输入图片
                            if (imageInputs.length > 0) {
                                const firstImageKey = imageInputs[0];
                                try {
                                    const imageUrl = getTaskInputUrl(task.task_id, firstImageKey);
                                    // 创建Image对象预加载输入图片
                                    const img = new Image();
                                    img.src = imageUrl;

                                    // 监听加载完成事件
                                    img.onload = () => {
                                        console.log(`Input image preloaded for task ${task.task_id}: ${firstImageKey}`);
                                    };

                                    img.onerror = () => {
                                        console.warn(`Failed to preload input image for task ${task.task_id}: ${firstImageKey}`);
                                    };
                                } catch (error) {
                                    console.warn(`Failed to preload input image for task ${task.task_id}:`, error);
                                }
                            }
                        }
                    }
                };

                const preloadThumbnailCache = async (tasks) => {
                    setTimeout(async () => {
                        try {
                            const response = await apiRequest('./api/v1/task/thumbnails');
                            if (response && response.ok) {
                                const data = await response.json();
                                const thumbnails = data.thumbnails || {};

                                for (const [taskId, thumbnailUrl] of Object.entries(thumbnails)) {
                                    thumbnailCache.value.set(taskId, thumbnailUrl);
                                }

                                thumbnailCacheLoaded.value = true;
                                console.log(`缩略图一次性加载完成,共缓存${Object.keys(thumbnails).length}个任务`);
                            } else {
                                // 如果API调用失败,回退到原来的逐个加载方式
                                await preloadThumbnailsIndividually(tasks.slice(0, 30));
                            }
                        } catch (error) {
                            // 如果API调用异常,回退到原来的逐个加载方式
                            await preloadThumbnailsIndividually(tasks.slice(0, 30));
                        }
                    }, 100); // 延迟100ms开始,让页面先渲染
                };

                const preloadThumbnailsIndividually = async (tasksToCache) => {
                    // 使用串行加载避免过快访问
                    for (let i = 0; i < tasksToCache.length; i++) {
                        const task = tasksToCache[i];

                        if (task.inputs) {
                            // 查找输入中的图片文件
                            const imageInputs = Object.keys(task.inputs).filter(key =>
                                key.includes('image') ||
                                task.inputs[key].toString().toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)
                            );

                            if (imageInputs.length > 0) {
                                const firstImageKey = imageInputs[0];
                                try {
                                    const imageUrl = getTaskInputUrl(task.task_id, firstImageKey);

                                    // 使用重试机制加载图片
                                    const success = await loadImageWithRetry(task.task_id, imageUrl, 3);
                                    if (success) {
                                        thumbnailCache.value.set(task.task_id, imageUrl);
                                    }
                                } catch (error) {
                                    console.warn(`缩略图缓存错误 ${task.task_id}:`, error);
                                }
                            }
                        }

                        // 添加延迟避免过快访问
                        if (i < tasksToCache.length - 1) {
                            await new Promise(resolve => setTimeout(resolve, 200)); // 200ms延迟
                        }
                    }
                    thumbnailCacheLoaded.value = true;
                };

                const loadImageWithRetry = async (taskId, imageUrl, maxRetries = 3) => {
                    for (let attempt = 1; attempt <= maxRetries; attempt++) {
                        try {
                            const success = await new Promise((resolve) => {
                                const img = new Image();
                                img.onload = () => resolve(true);
                                img.onerror = () => resolve(false);

                                // 设置超时
                                const timeout = setTimeout(() => {
                                    resolve(false);
                                }, 10000); // 10秒超时

                                img.onload = () => {
                                    clearTimeout(timeout);
                                    resolve(true);
                                };

                                img.onerror = () => {
                                    clearTimeout(timeout);
                                    resolve(false);
                                };

                                img.src = imageUrl;
                            });

                            if (success) {
                                return true;
                            } else if (attempt < maxRetries) {
                                await new Promise(resolve => setTimeout(resolve, 3000 * attempt));
                            }
                        } catch (error) {
                            if (attempt < maxRetries) {
                                await new Promise(resolve => setTimeout(resolve, 3000 * attempt));
                            }
                        }
                    }
                    return false;
                };

                const refreshTasks = async () => {
                    try {
                        const params = new URLSearchParams({
                            page: currentPage.value.toString(),
                            page_size: pageSize.value.toString()
                        });

                        if (statusFilter.value !== 'ALL') {
                            params.append('status', statusFilter.value);
                        }

                        const response = await apiRequest(`./api/v1/task/list?${params.toString()}`);
                        if (response && response.ok) {
                            const data = await response.json();
                            tasks.value = data.tasks || [];
                            pagination.value = data.pagination || null;

                            if (!thumbnailCacheLoaded.value) {
                                await preloadThumbnailCache(tasks.value);
                            } else {
                                await preloadInputImages(tasks.value);
                            }
                        } else if (response) {
                            showAlert('刷新任务列表失败', 'danger');
                        }
                        // 如果response为null,说明是认证错误,apiRequest已经处理了
                    } catch (error) {
                        showAlert(`刷新任务列表失败: ${error.message}`, 'danger');
                    }
                };

                const getStatusBadgeClass = (status) => {
                    const statusMap = {
                        'SUCCEED': 'bg-success',
                        'FAILED': 'bg-danger',
                        'RUNNING': 'bg-warning',
                        'PENDING': 'bg-secondary',
                        'CREATED': 'bg-secondary'
                    };
                    return statusMap[status] || 'bg-secondary';
                };

                const downloadSingleResult = async (taskId, key, outputPath) => {
                    try {
                        setLoading(true);
                        const response = await apiCall(`./api/v1/task/result?task_id=${taskId}&name=${key}`);
                        if (response.ok) {
                            const blob = await response.blob();
                            const url = window.URL.createObjectURL(blob);
                            const a = document.createElement('a');
                            a.href = url;
                            // 使用原始文件名,如果没有则使用outputPath
                            const filename = key || outputPath || `result_${taskId}`;
                            a.download = filename;
                            document.body.appendChild(a);
                            a.click();
                            document.body.removeChild(a);
                            window.URL.revokeObjectURL(url);
                            showAlert('文件下载成功', 'success');
                        } else {
                            showAlert('获取结果失败', 'danger');
                        }
                    } catch (error) {
                        showAlert(`下载结果失败: ${error.message}`, 'danger');
                    } finally {
                        setLoading(false);
                    }
                };

                const viewSingleResult = async (taskId, key) => {
                    try {
                        setLoading(true);
                        const response = await apiCall(`./api/v1/task/result?task_id=${taskId}&name=${key}`);
                        if (response.ok) {
                            const blob = await response.blob();
                            const videoBlob = new Blob([blob], { type: 'video/mp4' });
                            const url = window.URL.createObjectURL(videoBlob);
                            window.open(url, '_blank');
                        } else {
                            showAlert('获取结果失败', 'danger');
                        }
                    } catch (error) {
                        showAlert(`查看结果失败: ${error.message}`, 'danger');
                    } finally {
                        setLoading(false);
                    }
                };

                const getVideoUrl = (taskId, key) => {
                    const token = localStorage.getItem('accessToken');
                    if (token) {
                        return `./api/v1/task/result?task_id=${taskId}&name=${key}&token=${encodeURIComponent(token)}`;
                    }
                    return `./api/v1/task/result?task_id=${taskId}&name=${key}`;
                };

                const cancelTask = async (taskId) => {
                    try {
                        const response = await apiRequest(`./api/v1/task/cancel?task_id=${taskId}`);
                        if (response && response.ok) {
                            showAlert('任务取消成功', 'success');
                            await refreshTasks();
                        } else if (response) {
                            const error = await response.json();
                            showAlert(`取消任务失败: ${error.message}`, 'danger');
                        }
                        // 如果response为null,说明是认证错误,apiRequest已经处理了
                    } catch (error) {
                        showAlert(`取消任务失败: ${error.message}`, 'danger');
                    }
                };

                const resumeTask = async (taskId) => {
                    try {
                        const response = await apiRequest(`./api/v1/task/resume?task_id=${taskId}`);
                        if (response && response.ok) {
                            showAlert('任务重试成功', 'success');
                            await refreshTasks();
                        } else if (response) {
                            const error = await response.json();
                            showAlert(`重试任务失败: ${error.message}`, 'danger');
                        }
                        // 如果response为null,说明是认证错误,apiRequest已经处理了
                    } catch (error) {
                        showAlert(`重试任务失败: ${error.message}`, 'danger');
                    }
                };



                const loadTaskFiles = async (taskId) => {
                    try {
                        loadingTaskFiles.value = true;

                        // 通过API获取任务详情
                        const response = await apiRequest(`./api/v1/task/query?task_id=${taskId}`);
                        if (!response || !response.ok) {
                            showAlert('获取任务详情失败', 'danger');
                            return;
                        }

                        const task = await response.json();
                        if (!task) {
                            showAlert('任务不存在', 'danger');
                            return;
                        }

                        const files = { inputs: {}, outputs: {} };

                        // 获取输入文件(所有状态的任务都需要)
                        if (task.inputs) {
                            for (const [key, inputPath] of Object.entries(task.inputs)) {
                                try {
                                    const response = await apiRequest(`./api/v1/task/input?task_id=${taskId}&name=${key}`);
                                    if (response && response.ok) {
                                        const blob = await response.blob();
                                        files.inputs[key] = {
                                            name: inputPath, // 使用原始文件名而不是key
                                            path: inputPath,
                                            blob: blob,
                                            url: URL.createObjectURL(blob)
                                        };
                                    }
                                } catch (error) {
                                    console.error(`Failed to load input ${key}:`, error);
                                    files.inputs[key] = {
                                        name: inputPath, // 使用原始文件名而不是key
                                        path: inputPath,
                                        error: true
                                    };
                                }
                            }
                        }

                        // 只对成功完成的任务获取输出文件
                        if (task.status === 'SUCCEED' && task.outputs) {
                            for (const [key, outputPath] of Object.entries(task.outputs)) {
                                try {
                                    const response = await apiRequest(`./api/v1/task/result?task_id=${taskId}&name=${key}`);
                                    if (response && response.ok) {
                                        const blob = await response.blob();
                                        files.outputs[key] = {
                                            name: outputPath, // 使用原始文件名而不是key
                                            path: outputPath,
                                            blob: blob,
                                            url: URL.createObjectURL(blob)
                                        };
                                    }
                                } catch (error) {
                                    console.error(`Failed to load output ${key}:`, error);
                                    files.outputs[key] = {
                                        name: outputPath, // 使用原始文件名而不是key
                                        path: outputPath,
                                        error: true
                                    };
                                }
                            }
                        }

                        selectedTaskFiles.value = files;

                    } catch (error) {
                        console.error('Failed to load task files:', error);
                        showAlert('加载任务文件失败', 'danger');
                    } finally {
                        loadingTaskFiles.value = false;
                    }
                };

                const viewTaskDetail = async (task) => {
                    // 清理之前的文件缓存
                    clearTaskFiles();

                    selectedTask.value = task;
                    selectedTaskId.value = task.task_type;
                    showCreator.value = false;

                    // 一次性加载所有任务文件
                    await loadTaskFiles(task.task_id);
                };

                const downloadFile = (fileInfo) => {
                    if (!fileInfo || !fileInfo.blob) {
                        showAlert('文件不可用', 'danger');
                        return;
                    }

                    try {
                        const url = URL.createObjectURL(fileInfo.blob);
                        const a = document.createElement('a');
                        a.href = url;
                        a.download = fileInfo.name || 'download';
                        document.body.appendChild(a);
                        a.click();
                        document.body.removeChild(a);
                        URL.revokeObjectURL(url);
                    } catch (error) {
                        console.error('Download failed:', error);
                        showAlert('下载失败', 'danger');
                    }
                };

                const viewFile = (fileInfo) => {
                    if (!fileInfo || !fileInfo.url) {
                        showAlert('文件不可用', 'danger');
                        return;
                    }

                    // 在新窗口中打开文件
                    window.open(fileInfo.url, '_blank');
                };

                const clearTaskFiles = () => {
                    // 清理 URL 对象,释放内存
                    Object.values(selectedTaskFiles.value.inputs).forEach(file => {
                        if (file.url) {
                            URL.revokeObjectURL(file.url);
                        }
                    });
                    Object.values(selectedTaskFiles.value.outputs).forEach(file => {
                        if (file.url) {
                            URL.revokeObjectURL(file.url);
                        }
                    });
                    selectedTaskFiles.value = { inputs: {}, outputs: {} };
                };

                const showTaskCreator = () => {
                    showCreator.value = true;
                    selectedTask.value = null;
                    // clearTaskFiles(); // 清空文件缓存
                    selectedTaskId.value = 'digital_human'; // 默认选择数字人任务
                };

                const toggleSidebar = () => {
                    sidebarCollapsed.value = !sidebarCollapsed.value;
                };

                const clearPrompt = () => {
                    getCurrentForm().prompt = '';
                };

                const getTaskItemClass = (status) => {
                    if (status === 'SUCCEED') return 'bg-laser-purple/15 border border-laser-purple/30';
                    if (status === 'RUNNING') return 'bg-laser-purple/15 border border-laser-purple/30';
                    if (status === 'FAILED') return 'bg-red-500/15 border border-red-500/30';
                    return 'bg-dark-light border border-gray-700';
                };

                const getStatusIndicatorClass = (status) => {
                const base = 'inline-block w-2 aspect-square rounded-full shrink-0 align-middle';
                    if (status === 'SUCCEED')
                        return `${base} bg-gradient-to-r from-emerald-200 to-green-300 shadow-md shadow-emerald-300/30`;
                    if (status === 'RUNNING')
                        return `${base} bg-gradient-to-r from-amber-200 to-yellow-300 shadow-md shadow-amber-300/30 animate-pulse`;
                    if (status === 'FAILED')
                        return `${base} bg-gradient-to-r from-red-200 to-pink-300 shadow-md shadow-red-300/30`;
                    return `${base} bg-gradient-to-r from-gray-200 to-gray-300 shadow-md shadow-gray-300/30`;
                    };


                const getTaskTypeBtnClass = (taskType) => {
                    if (selectedTaskId.value === taskType) {
                        return 'text-gradient-icon border-b-2 border-laser-purple';
                    }
                    return 'text-gray-400 hover:text-gradient-icon';
                };

                const getModelBtnClass = (model) => {
                    if (getCurrentForm().model_cls === model) {
                        return 'bg-laser-purple/20 border border-laser-purple/40 active shadow-laser animate-electric-pulse';
                    }
                    return 'bg-dark-light border border-gray-700 hover:bg-laser-purple/15 hover:border-laser-purple/40 transition-all hover:shadow-laser';
                };

                const getTaskTypeIcon = (taskType) => {
                    const iconMap = {
                        't2v': 'fas fa-font',
                        'i2v': 'fas fa-image',
                        'digital_human': 'fas fa-user'
                    };
                    return iconMap[taskType] || 'fas fa-video';
                };

                const getTaskTypeName = (task) => {
                    // 如果传入的是字符串,直接返回映射
                    if (typeof task === 'string') {
                        const nameMap = {
                            't2v': '文生视频',
                            'i2v': '图生视频',
                            'digital_human': '数字人'
                        };
                        return nameMap[task] || task;
                    }

                    // 如果传入的是任务对象,根据模型类型判断
                    if (task && task.model_cls) {
                        const modelCls = task.model_cls.toLowerCase();

                        // 检查是否是数字人模型(包含audio或seko)
                        if (modelCls.includes('audio') || modelCls.includes('seko')) {
                            return '数字人';
                        }

                        // 根据task_type判断
                        const nameMap = {
                            't2v': '文生视频',
                            'i2v': '图生视频',
                            'digital_human': '数字人'
                        };
                        return nameMap[task.task_type] || task.task_type;
                    }

                    // 默认返回task_type
                    return task.task_type || '未知';
                };

                const getPromptPlaceholder = () => {
                    if (selectedTaskId.value === 't2v') {
                        return '请输入视频生成提示词,描述视频内容、风格、场景等...';
                    } else if (selectedTaskId.value === 'i2v') {
                        return '请输入视频生成提示词,描述基于图片的视频内容、动作要求等...';
                    } else if (selectedTaskId.value === 'digital_human') {
                        return '请输入视频生成提示词,描述数字人形象、背景风格、动作要求等...';
                    }
                    return '请输入视频生成提示词...';
                };

                const getStatusTextClass = (status) => {
                    if (status === 'SUCCEED') return 'text-emerald-400';
                    if (status === 'RUNNING') return 'text-amber-400';
                    if (status === 'FAILED') return 'text-red-400';
                    return 'text-gray-400';
                };



                const getImagePreview = (base64Data) => {
                    if (!base64Data) return '';
                    return `data:image/jpeg;base64,${base64Data}`;
                };

                const getTaskInputUrl = (taskId, key) => {
                    const token = localStorage.getItem('accessToken');
                    if (token) {
                        return `./api/v1/task/input?task_id=${taskId}&name=${key}&token=${encodeURIComponent(token)}`;
                    }
                    return `./api/v1/task/input?task_id=${taskId}&name=${key}`;
                };

                const getTaskInputImage = (task) => {
                    if (!task || !task.inputs) return null;
                    const imageInputs = Object.keys(task.inputs).filter(key =>
                        key.includes('image') ||
                        task.inputs[key].toString().toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)
                    );

                    if (imageInputs.length > 0) {
                        const firstImageKey = imageInputs[0];
                        return getTaskInputUrl(task.task_id, firstImageKey);
                    }

                    return null;
                };

                const getVideoThumbnail = (taskId, name) => {
                    if (thumbnailCache.value.has(taskId)) {
                        return thumbnailCache.value.get(taskId);
                    }

                    const task = tasks.value.find(t => t.task_id === taskId);
                    if (task) {
                        const inputImageUrl = getTaskInputImage(task);
                        if (inputImageUrl) {
                            return inputImageUrl;
                        } else {
                            console.log(`任务 ${taskId} 没有输入图片`);
                        }
                    } else {
                        console.log(`未找到任务: ${taskId}`);
                    }

                    // 如果没有输入图片,返回空字符串,让handleThumbnailError处理
                    return '';
                };

                const getVideoThumbnailInfo = (taskId, name) => {
                    // 首先检查缓存
                    if (thumbnailCache.value.has(taskId)) {
                        return {
                            url: thumbnailCache.value.get(taskId),
                            hasThumbnail: true
                        };
                    }

                    // 如果缓存中没有,异步加载并更新缓存
                    loadThumbnailAsync(taskId, name);

                    // 返回空,让模板显示默认图标
                    return {
                        url: '',
                        hasThumbnail: false
                    };
                };

                const loadThumbnailAsync = async (taskId, name) => {
                    const task = tasks.value.find(t => t.task_id === taskId);
                    if (!task || !task.inputs) return;

                    // 查找输入中的图片文件
                    const imageInputs = Object.keys(task.inputs).filter(key =>
                        key.includes('image') ||
                        task.inputs[key].toString().toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)
                    );

                    if (imageInputs.length > 0) {
                        const firstImageKey = imageInputs[0];
                        try {
                            const imageUrl = getTaskInputUrl(taskId, firstImageKey);

                            // 使用重试机制加载图片
                            const success = await loadImageWithRetry(taskId, imageUrl, 3);
                            if (success) {
                                thumbnailCache.value.set(taskId, imageUrl);
                            }
                        } catch (error) {
                            console.warn(`缩略图异步加载错误 ${taskId}:`, error);
                        }
                    }
                };

                const handleThumbnailError = (event) => {
                    // 当输入图片加载失败时,显示默认图标
                    const img = event.target;
                    const parent = img.parentElement;
                    parent.innerHTML = '<div class="w-full h-full bg-laser-purple/20 flex items-center justify-center"><i class="fas fa-video text-gradient-icon text-xl"></i></div>';
                };

                const handleImageError = (event) => {
                    // 当图片加载失败时,隐藏图片,显示文件名
                    const img = event.target;
                    img.style.display = 'none';
                    // 文件名已经显示,不需要额外处理
                };

                const handleImageLoad = (event) => {
                    // 当图片加载成功时,显示图片和下载按钮,隐藏文件名
                    const img = event.target;
                    img.style.display = 'block';
                    // 显示下载按钮
                    const downloadBtn = img.parentElement.querySelector('button');
                    if (downloadBtn) {
                        downloadBtn.style.display = 'block';
                    }
                    // 隐藏文件名span
                    const span = img.parentElement.parentElement.querySelector('span');
                    if (span) {
                        span.style.display = 'none';
                    }
                };

                const handleAudioError = (event) => {
                    // 当音频加载失败时,隐藏音频控件和下载按钮,显示文件名
                    const audio = event.target;
                    audio.style.display = 'none';
                    // 隐藏下载按钮
                    const downloadBtn = audio.parentElement.querySelector('button');
                    if (downloadBtn) {
                        downloadBtn.style.display = 'none';
                    }
                    // 文件名已经显示,不需要额外处理
                };

                const handleAudioLoad = (event) => {
                    // 当音频加载成功时,显示音频控件和下载按钮,隐藏文件名
                    const audio = event.target;
                    audio.style.display = 'block';
                    // 显示下载按钮
                    const downloadBtn = audio.parentElement.querySelector('button');
                    if (downloadBtn) {
                        downloadBtn.style.display = 'block';
                    }
                    // 隐藏文件名span
                    const span = audio.parentElement.parentElement.querySelector('span');
                    if (span) {
                        span.style.display = 'none';
                    }
                };


                const downloadTaskInput = async (taskId, inputName, fileName) => {
                    try {
                        const url = getTaskInputUrl(taskId, inputName);
                        const response = await apiRequest(url);

                        if (!response || !response.ok) {
                            throw new Error(`下载失败: ${response ? response.status : '认证失败'}`);
                        }

                        const blob = await response.blob();
                        const downloadUrl = window.URL.createObjectURL(blob);

                        // 创建下载链接
                        const link = document.createElement('a');
                        link.href = downloadUrl;
                        // 使用原始文件名,如果没有则使用inputName
                        const filename = inputName || fileName || `input_${taskId}`;
                        link.download = filename;
                        document.body.appendChild(link);
                        link.click();

                        // 清理
                        document.body.removeChild(link);
                        window.URL.revokeObjectURL(downloadUrl);

                        showAlert('文件下载成功', 'success');
                    } catch (error) {
                        console.error('下载失败:', error);
                        showAlert(`下载失败: ${error.message}`, 'danger');
                    }
                };

                const initModelAndTasks = async () => {
                    await loadModels();
                    await refreshTasks();
                };

                // 任务状态管理
                const getTaskStatusDisplay = (status) => {
                    const statusMap = {
                        'CREATED': '创建',
                        'PENDING': '等待',
                        'RUNNING': '进行',
                        'SUCCEED': '完成',
                        'FAILED': '失败',
                        'CANCEL': '取消'
                    };
                    return statusMap[status] || status;
                };

                const getTaskStatusColor = (status) => {
                    const colorMap = {
                        'CREATED': 'text-blue-400',
                        'PENDING': 'text-yellow-400',
                        'RUNNING': 'text-amber-400',
                        'SUCCEED': 'text-emerald-400',
                        'FAILED': 'text-red-400',
                        'CANCEL': 'text-gray-400'
                    };
                    return colorMap[status] || 'text-gray-400';
                };

                const getTaskStatusIcon = (status) => {
                    const iconMap = {
                        'CREATED': 'fas fa-clock',
                        'PENDING': 'fas fa-hourglass-half',
                        'RUNNING': 'fas fa-spinner fa-spin',
                        'SUCCEED': 'fas fa-check-circle',
                        'FAILED': 'fas fa-exclamation-triangle',
                        'CANCEL': 'fas fa-ban'
                    };
                    return iconMap[status] || 'fas fa-question-circle';
                };


                // 任务时间格式化
                const getTaskDuration = (startTime, endTime) => {
                    if (!startTime || !endTime) return '未知';
                    const start = new Date(startTime * 1000);
                    const end = new Date(endTime * 1000);
                    const diff = end - start;
                    const minutes = Math.floor(diff / 60000);
                    const seconds = Math.floor((diff % 60000) / 1000);
                    return `${minutes}${seconds}秒`;
                };

                // 相对时间格式化
                const getRelativeTime = (timestamp) => {
                    if (!timestamp) return '未知';
                    const now = new Date();
                    const time = new Date(timestamp * 1000);
                    const diff = now - time;

                    const minutes = Math.floor(diff / 60000);
                    const hours = Math.floor(diff / 3600000);
                    const days = Math.floor(diff / 86400000);
                    const months = Math.floor(diff / 2592000000); // 30天
                    const years = Math.floor(diff / 31536000000);

                    if (years > 0) {
                        return years === 1 ? '一年前' : `${years}年前`;
                    } else if (months > 0) {
                        return months === 1 ? '一个月前' : `${months}个月前`;
                    } else if (days > 0) {
                        return days === 1 ? '一天前' : `${days}天前`;
                    } else if (hours > 0) {
                        return hours === 1 ? '一小时前' : `${hours}小时前`;
                    } else if (minutes > 0) {
                        return minutes === 1 ? '一分钟前' : `${minutes}分钟前`;
                    } else {
                        return '刚刚';
                    }
                };

                // 任务历史记录管理
                const getTaskHistory = () => {
                    return tasks.value.filter(task =>
                        ['SUCCEED', 'FAILED', 'CANCEL'].includes(task.status)
                    );
                };

                const getActiveTasks = () => {
                    return tasks.value.filter(task =>
                        ['CREATED', 'PENDING', 'RUNNING'].includes(task.status)
                    );
                };

                // 任务搜索和过滤增强
                const searchTasks = (query) => {
                    if (!query) return tasks.value;
                    return tasks.value.filter(task => {
                        const searchText = [
                            task.task_id,
                            task.task_type,
                            task.model_cls,
                            task.params?.prompt || '',
                            getTaskStatusDisplay(task.status)
                        ].join(' ').toLowerCase();
                        return searchText.includes(query.toLowerCase());
                    });
                };

                const filterTasksByStatus = (status) => {
                    if (status === 'ALL') return tasks.value;
                    return tasks.value.filter(task => task.status === status);
                };

                const filterTasksByType = (type) => {
                    if (!type) return tasks.value;
                    return tasks.value.filter(task => task.task_type === type);
                };

                // 提示消息样式管理
                const getAlertClass = (type) => {
                    const classMap = {
                        'success': 'animate-slide-down',
                        'warning': 'animate-slide-down',
                        'danger': 'animate-slide-down',
                        'info': 'animate-slide-down'
                    };
                    return classMap[type] || 'animate-slide-down';
                };

                const getAlertBorderClass = (type) => {
                    const borderMap = {
                        'success': 'border-green-500',
                        'warning': 'border-yellow-500',
                        'danger': 'border-red-500',
                        'info': 'border-blue-500'
                    };
                    return borderMap[type] || 'border-gray-500';
                };

                const getAlertTextClass = (type) => {
                    // 字体为灰色偏白色
                    const textMap = {
                        'success': 'text-gray-100 bg-white-500',
                        'warning': 'text-gray-100 bg-white-500',
                        'danger': 'text-gray-100 bg-white-500',
                        'info': 'text-gray-100 bg-white-500'
                    };
                    return textMap[type] || 'text-gray-100 bg-white-500';
                };

                const getAlertIcon = (type) => {
                    const iconMap = {
                        'success': 'fas fa-check-circle text-green-400',
                        'warning': 'fas fa-exclamation-triangle text-yellow-400',
                        'danger': 'fas fa-times-circle text-red-400',
                        'info': 'fas fa-info-circle text-blue-400'
                    };
                    return iconMap[type] || 'fas fa-info-circle text-gray-400';
                };

                // 监听器 - 监听任务类型变化
                watch(() => selectedTaskId.value, () => {
                    const currentForm = getCurrentForm();

                    // 只有当当前表单没有选择模型时,才自动选择第一个可用的模型
                    if (!currentForm.model_cls) {
                        let availableModels;

                        // 如果是数字人任务,从i2v模型中筛选包含audio或seko的模型
                        if (selectedTaskId.value === 'digital_human') {
                            availableModels = models.value.filter(m =>
                                m.task === 'i2v' && (m.model_cls.toLowerCase().includes('audio') || m.model_cls.toLowerCase().includes('seko'))
                            );
                        } else if (selectedTaskId.value === 'i2v') {
                            // 如果是i2v任务,排除包含audio或seko的模型
                            availableModels = models.value.filter(m =>
                                m.task === 'i2v' && !m.model_cls.toLowerCase().includes('audio') && !m.model_cls.toLowerCase().includes('seko')
                            );
                        } else {
                            availableModels = models.value.filter(m => m.task === selectedTaskId.value);
                        }

                        if (availableModels.length > 0) {
                            const firstModel = availableModels[0];
                            currentForm.model_cls = firstModel.model_cls;
                            currentForm.stage = firstModel.stage;
                        }
                    }

                    // 注意:这里不需要重置预览,因为我们要保持每个任务的独立性
                    // 预览会在 selectTask 函数中根据文件状态恢复
                });

                watch(() => getCurrentForm().model_cls, () => {
                    const currentForm = getCurrentForm();

                    // 只有当当前表单没有选择阶段时,才自动选择第一个可用的阶段
                    if (!currentForm.stage) {
                        let availableStages;

                        // 如果是数字人任务,从i2v模型中筛选
                        if (selectedTaskId.value === 'digital_human') {
                            availableStages = models.value
                                .filter(m => m.task === 'i2v' && m.model_cls === currentForm.model_cls)
                                .map(m => m.stage);
                        } else if (selectedTaskId.value === 'i2v') {
                            // 如果是i2v任务,排除包含audio或seko的模型
                            availableStages = models.value
                                .filter(m => m.task === 'i2v' && m.model_cls === currentForm.model_cls && !m.model_cls.toLowerCase().includes('audio') && !m.model_cls.toLowerCase().includes('seko'))
                                .map(m => m.stage);
                        } else {
                            availableStages = models.value
                                .filter(m => m.task === selectedTaskId.value && m.model_cls === currentForm.model_cls)
                                .map(m => m.stage);
                        }

                        if (availableStages.length > 0) {
                            currentForm.stage = availableStages[0];
                        }
                    }
                });

                // 生命周期
                onMounted(async () => {

                    // 检查是否已登录
                    const savedToken = localStorage.getItem('accessToken');
                    const savedUser = localStorage.getItem('currentUser');

                    if (savedToken && savedUser) {
                        // 验证token是否仍然有效
                        const isValid = await validateToken(savedToken);
                        if (isValid) {
                            currentUser.value = JSON.parse(savedUser);
                            isLoggedIn.value = true;
                        } else {
                            // Token无效,清除本地存储
                            logout();
                            showAlert('登录已过期,请重新登录', 'warning');
                        }
                    } else {
                        // 检查是否是GitHub回调
                        const urlParams = new URLSearchParams(window.location.search);
                        const code = urlParams.get('code');
                        if (code) {
                            handleGitHubCallback(code);
                        }
                    }

                    // 无论是否登录都要加载模型数据
                    await initModelAndTasks();
                    loadPromptHistory();
                    loadTemplates();

                    // 等待模型数据加载完成后再检查任务类型
                    if (availableTaskTypes.value.includes('digital_human')) {
                        selectTask('digital_human');
                    }
                    console.log('当前用户:', currentUser.value);
                    console.log('可用模型:', models.value);
                    console.log('任务列表:', tasks.value);
                });

                // 提示词模板管理
                const promptTemplates = {
                    'digital_human': [
                        {
                            id: 'dh_1',
                            title: '商务演讲',
                            prompt: '数字人进行商务演讲,表情自然,手势得体,背景为现代化的会议室,整体风格专业商务。'
                        },
                        {
                            id: 'dh_2',
                            title: '产品介绍',
                            prompt: '数字人介绍产品特点,语气亲切,动作自然,背景为产品展示区,突出产品的科技感和实用性。'
                        }
                    ],
                    't2v': [
                        {
                            id: 't2v_1',
                            title: '自然风景',
                            prompt: '一个宁静的山谷,阳光透过云层洒在绿色的草地上,远处有雪山,近处有清澈的溪流,画面温暖自然,充满生机。'
                        },
                        {
                            id: 't2v_2',
                            title: '城市夜景',
                            prompt: '繁华的城市夜景,霓虹灯闪烁,高楼大厦林立,车流如织,天空中有星星点缀,营造出都市的繁华氛围。'
                        },
                        {
                            id: 't2v_3',
                            title: '科技未来',
                            prompt: '未来科技城市,飞行汽车穿梭,全息投影随处可见,建筑具有流线型设计,充满科技感和未来感。'
                        }
                    ],
                    'i2v': [
                        {
                            id: 'i2v_1',
                            title: '人物动作',
                            prompt: '基于参考图片,让角色做出自然的行走动作,保持原有的服装和风格,背景可以适当变化。'
                        },
                        {
                            id: 'i2v_2',
                            title: '场景转换',
                            prompt: '保持参考图片中的人物形象,将背景转换为不同的季节或环境,如从室内到户外,从白天到夜晚。'
                        }
                    ]
                };

                const getPromptTemplates = (taskType) => {
                    return promptTemplates[taskType] || [];
                };

                const showPromptTemplates = () => {
                    if (!selectedTaskId.value) {
                        showAlert('请先选择任务类型', 'warning');
                        return;
                    }
                    showTemplates.value = !showTemplates.value;
                };

                const showPromptHistory = () => {
                    showHistory.value = !showHistory.value;
                };

                const selectPromptTemplate = (template) => {
                    getCurrentForm().prompt = template.prompt;
                    showTemplates.value = false;
                    showAlert(`已应用模板: ${template.title}`, 'success');
                };

                // 提示词历史记录管理
                const promptHistory = ref([]);

                const getPromptHistory = () => {
                    return promptHistory.value.slice(-10); // 只显示最近10条
                };

                const addPromptToHistory = (prompt) => {
                    if (!prompt || prompt.trim().length === 0) return;

                    // 避免重复添加
                    const trimmedPrompt = prompt.trim();
                    if (promptHistory.value.includes(trimmedPrompt)) {
                        // 将已存在的提示词移到最前面
                        promptHistory.value = promptHistory.value.filter(p => p !== trimmedPrompt);
                    }

                    promptHistory.value.push(trimmedPrompt);

                    // 限制历史记录数量
                    if (promptHistory.value.length > 50) {
                        promptHistory.value = promptHistory.value.slice(-50);
                    }

                    // 保存到本地存储
                    localStorage.setItem('promptHistory', JSON.stringify(promptHistory.value));
                };

                const selectPromptHistory = (prompt) => {
                    getCurrentForm().prompt = prompt;
                    showHistory.value = false;
                    showAlert('已应用历史提示词', 'success');
                };

                const clearPromptHistory = () => {
                    promptHistory.value = [];
                    localStorage.removeItem('promptHistory');
                    showAlert('提示词历史已清空', 'info');
                };

                // 加载提示词历史记录
                const loadPromptHistory = () => {
                    try {
                        const saved = localStorage.getItem('promptHistory');
                        if (saved) {
                            promptHistory.value = JSON.parse(saved);
                        }
                    } catch (error) {
                        console.warn('加载提示词历史记录失败:', error);
                    }
                };

                const getAuthHeaders = () => {
                    const headers = {
                        'Content-Type': 'application/json'
                    };

                    const token = localStorage.getItem('accessToken');
                    if (token) {
                        headers['Authorization'] = `Bearer ${token}`;
                        console.log('使用Token进行认证:', token.substring(0, 20) + '...');
                    } else {
                        console.warn('没有找到accessToken');
                    }
                    return headers;
                };

                // 验证token是否有效
                const validateToken = async (token) => {
                    try {
                        const response = await fetch('./api/v1/model/list', {
                            method: 'GET',
                            headers: {
                                'Authorization': `Bearer ${token}`,
                                'Content-Type': 'application/json'
                            }
                        });
                        return response.ok;
                    } catch (error) {
                        console.error('Token validation failed:', error);
                        return false;
                    }
                };

                // 增强的API请求函数,自动处理认证错误
                const apiRequest = async (url, options = {}) => {
                    const headers = getAuthHeaders();

                    try {
                        const response = await fetch(url, {
                            ...options,
                            headers: {
                                ...headers,
                                ...options.headers
                            }
                        });

                        // 检查是否是认证错误
                        if (response.status === 401 || response.status === 403) {
                            // Token无效,清除本地存储并跳转到登录页
                            logout();
                            showAlert('登录已过期,请重新登录', 'warning');
                            return null;
                        }

                        return response;
                    } catch (error) {
                        console.error('API request failed:', error);
                        showAlert('网络请求失败', 'danger');
                        return null;
                    }
                };

                // 侧边栏拖拽调整功能
                const sidebar = ref(null);
                let isResizing = false;
                let startX = 0;
                let startWidth = 0;

                const startResize = (e) => {
                    e.preventDefault();

                    // 在小屏幕时禁用拖拽调整
                    const windowWidth = window.innerWidth;
                    if (windowWidth <= 1200) {
                        return;
                    }

                    isResizing = true;
                    startX = e.clientX;
                    startWidth = sidebar.value.offsetWidth;

                    document.body.classList.add('resizing');
                    document.addEventListener('mousemove', handleResize);
                    document.addEventListener('mouseup', stopResize);
                };

                const handleResize = (e) => {
                    if (!isResizing) return;

                    // 在小屏幕时停止拖拽调整
                    const windowWidth = window.innerWidth;
                    if (windowWidth <= 1200) {
                        stopResize();
                        return;
                    }

                    const deltaX = e.clientX - startX;
                    const newWidth = startWidth + deltaX;
                    const minWidth = 200;
                    const maxWidth = 500;

                    if (newWidth >= minWidth && newWidth <= maxWidth) {
                        sidebar.value.style.width = newWidth + 'px';
                        // 同时调整主内容区域宽度
                        const mainContent = document.querySelector('main');
                        if (mainContent) {
                            mainContent.style.width = `calc(100% - ${newWidth}px)`;
                        }
                    }
                };

                const stopResize = () => {
                    isResizing = false;
                    document.body.classList.remove('resizing');
                    document.removeEventListener('mousemove', handleResize);
                    document.removeEventListener('mouseup', stopResize);

                    // 保存当前宽度到localStorage
                    if (sidebar.value) {
                        localStorage.setItem('sidebarWidth', sidebar.value.offsetWidth);
                    }
                };

                // 应用响应式侧边栏宽度
                const applyResponsiveWidth = () => {
                    if (!sidebar.value) return;

                    const windowWidth = window.innerWidth;
                    let sidebarWidth;

                    if (windowWidth <= 768) {
                        sidebarWidth = '200px';
                    } else if (windowWidth <= 1200) {
                        sidebarWidth = '250px';
                    } else {
                        // 大屏幕时使用保存的宽度或默认宽度
                        const savedWidth = localStorage.getItem('sidebarWidth');
                        if (savedWidth) {
                            const width = parseInt(savedWidth);
                            if (width >= 200 && width <= 500) {
                                sidebarWidth = width + 'px';
                            } else {
                                sidebarWidth = '256px'; // 默认 w-64
                            }
                        } else {
                            sidebarWidth = '256px'; // 默认 w-64
                        }
                    }

                    sidebar.value.style.width = sidebarWidth;
                    const mainContent = document.querySelector('main');
                    if (mainContent) {
                        mainContent.style.width = `calc(100% - ${sidebarWidth})`;
                    }
                };

                // 恢复保存的侧边栏宽度
                onMounted(() => {
                    applyResponsiveWidth();

                    // 监听窗口大小变化
                    window.addEventListener('resize', applyResponsiveWidth);
                });

                return {
                    isLoggedIn,
                    loading,
                    loginWithGitHub,
                    submitting,
                    showCreator,
                    searchQuery,
                    currentUser,
                    models,
                    tasks,
                    alert,
                    t2vForm,
                    i2vForm,
                    digitalHumanForm,
                    getCurrentForm,
                    i2vImagePreview,
                    digitalHumanImagePreview,
                    digitalHumanAudioPreview,
                    getCurrentImagePreview,
                    getCurrentAudioPreview,
                    availableTaskTypes,
                    availableModelClasses,
                    filteredTasks,
                    selectedTaskId,
                    selectedTask,
                    selectedTaskFiles,
                    loadingTaskFiles,
                    statusFilter,
                    pagination,
                    currentPage,
                    pageSize,
                    showAlert,
                    setLoading,
                    apiCall,
                    logout,
                    loadModels,
                    generatingThumbnails,
                    sidebarCollapsed,
                    thumbnailCache,
                    thumbnailCacheLoaded,
                    loadTaskFiles,
                    downloadFile,
                    viewFile,
                    handleImageUpload,
                    selectTask,
                    selectModel,
                    triggerImageUpload,
                    triggerAudioUpload,
                    removeImage,
                    removeAudio,
                    handleAudioUpload,
                    loadTemplates,
                    selectImageTemplate,
                    selectAudioTemplate,
                    previewAudioTemplate,
                    imageTemplates,
                    audioTemplates,
                    showImageTemplates,
                    showAudioTemplates,
                    showTemplates,
                    showHistory,
                    submitTask,
                    fileToBase64,
                    formatTime,
                    refreshTasks,
                    preloadThumbnailCache,
                    preloadThumbnailsIndividually,
                    loadImageWithRetry,
                    getStatusBadgeClass,
                    downloadSingleResult,
                    viewSingleResult,
                    cancelTask,
                    resumeTask,
                    viewTaskDetail,
                    showTaskCreator,
                    toggleSidebar,
                    clearPrompt,
                    getTaskItemClass,
                    getStatusIndicatorClass,
                    getTaskTypeBtnClass,
                    getModelBtnClass,
                    getTaskTypeIcon,
                    getTaskTypeName,
                    getPromptPlaceholder,
                    getStatusTextClass,
                    getImagePreview,
                    getTaskInputUrl,
                    getVideoThumbnail,
                    getVideoThumbnailInfo,
                    loadThumbnailAsync,
                    handleThumbnailError,
                    handleImageError,
                    handleImageLoad,
                    handleAudioError,
                    handleAudioLoad,
                    downloadTaskInput,
                    getVideoUrl,
                    getTaskStatusDisplay,
                    getTaskStatusColor,
                    getTaskStatusIcon,
                    getTaskDuration,
                    getRelativeTime,
                    getTaskHistory,
                    getActiveTasks,
                    searchTasks,
                    filterTasksByStatus,
                    filterTasksByType,
                    getAlertClass,
                    getAlertBorderClass,
                    getAlertTextClass,
                    getAlertIcon,
                    getPromptTemplates,
                    showPromptTemplates,
                    showPromptHistory,
                    selectPromptTemplate,
                    promptHistory,
                    getPromptHistory,
                    addPromptToHistory,
                    selectPromptHistory,
                    clearPromptHistory,
                    loadPromptHistory,
                    getAudioMimeType,
                    getAuthHeaders,
                    sidebar,
                    startResize
                };
            }
        }).mount('#app');
    </script>
</body>
</html>