Welcome.vue
163 KB
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
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
<template>
<div class="welcome-page">
<!-- 烟花特效 -->
<Fireworks v-if="route.name === 'Welcome'" ref="fireworksRef" />
<!-- 注册成功卡片 -->
<RegisterSuccessCard
:visible="showSuccessCard"
:showReward="showReward"
@close="handleSuccessCardClose"
@later="handleRegisterSuccessLater"
@verify="handleRegisterSuccessVerify"
/>
<!-- 欢迎界面 - 当没有开始聊天时显示 -->
<div class="welcome-interface">
<!-- 左侧边栏 -->
<div class="welcome-sidebar" :class="{ collapsed: isSidebarCollapsed }">
<!-- 侧边栏头部 -->
<div class="sidebar-header">
<!-- Tab切换器 -->
<div class="sidebar-tab-switcher" v-show="!isSidebarCollapsed">
<div
class="sidebar-tab-btn"
:class="{ active: currentSidebarTab === 'recent' }"
@click="switchSidebarTab('recent')"
:title="t('welcomeSidebar.recentAccess')"
>
<i class="fas fa-history"></i>
</div>
<!-- DeerFlow模式下显示高级配置 -->
<div
v-if="aiMode === 'deerflow'"
class="sidebar-tab-btn"
:class="{ active: currentSidebarTab === 'advanced' }"
@click="switchSidebarTab('advanced')"
:title="t('welcomeSidebar.advancedConfig')"
>
<i class="fas fa-cog"></i>
</div>
</div>
<!-- 折叠状态下的 Tab 切换器 -->
<div class="collapsed-tab-switcher" v-if="isSidebarCollapsed">
<div
class="sidebar-tab-btn"
:class="{ active: currentSidebarTab === 'recent' }"
@click="switchSidebarTab('recent')"
:title="t('welcomeSidebar.recentAccess')"
>
<i class="fas fa-history"></i>
</div>
<!-- DeerFlow模式下显示高级配置 -->
<div
v-if="aiMode === 'deerflow'"
class="sidebar-tab-btn"
:class="{ active: currentSidebarTab === 'advanced' }"
@click="switchSidebarTab('advanced')"
:title="t('welcomeSidebar.advancedConfig')"
>
<i class="fas fa-cog"></i>
</div>
</div>
<!-- 分割线 (仅在折叠时显示) -->
<div class="collapsed-divider" v-if="isSidebarCollapsed"></div>
<!-- 折叠/展开按钮 -->
<div class="sidebar-toggle" @click="toggleSidebarCollapse">
<img
:src="isSidebarCollapsed ? '/zhankai.svg' : '/shouqi.svg'"
alt="Toggle"
class="icon-svg-shouqi"
:title="
isSidebarCollapsed
? t('welcomeSidebar.expandPanel')
: t('welcomeSidebar.collapsePanel')
"
/>
</div>
</div>
<!-- 侧边栏内容 -->
<div class="sidebar-content-inner" v-show="!isSidebarCollapsed">
<div
v-show="currentSidebarTab === 'recent'"
class="sidebar-tab-content"
>
<div class="sidebar-section">
<div class="menu-items">
<!-- 新任务 -->
<div class="menu-item" @click="handleNewChat">
<i class="fas fa-edit"></i>
<span>{{ t("welcomeSidebar.newChat") }}</span>
</div>
<!-- 最近文档 -->
<div class="menu-item history-item" @click="toggleHistory">
<i class="fas fa-file-alt"></i>
<span>{{ t("welcomeSidebar.recentDocuments") }}</span>
<i
class="toggle-icon fas"
:class="
isHistoryExpanded ? 'fa-chevron-down' : 'fa-chevron-right'
"
></i>
</div>
<!-- 最近文档内容 -->
<div v-show="isHistoryExpanded" class="history-content">
<div
v-if="recentDocuments.length === 0"
class="empty-history"
>
<span class="empty-text">{{
t("welcomeSidebar.noAccessHistory")
}}</span>
</div>
<div v-else class="history-list">
<div
v-for="doc in recentDocuments"
:key="doc.fileId"
class="history-item-row"
@click.stop="handleDocumentClick(doc)"
>
<img
:src="getFileIcon(doc.extension)"
class="file-icon-small"
:alt="doc.extension || 'file'"
/>
<div class="file-info-compact">
<div class="file-name-compact">
{{ doc.displayName }}
</div>
<div class="file-date-compact">
{{ formatDate(doc.lastAccessedAt) }}
</div>
</div>
<img
src="/shanchu1.svg"
class="delete-icon-small"
@click.stop="deleteHistoryItem(doc.fileId)"
:title="t('welcomeSidebar.deleteRecord')"
alt="delete"
/>
</div>
</div>
</div>
<!-- 历史任务 -->
<div class="menu-item history-item">
<div class="history-item-left" @click="toggleChatHistory">
<i class="fas fa-comments"></i>
<span>{{ t("welcomeSidebar.chatHistory") }}</span>
</div>
<div class="history-item-actions">
<span
class="view-all-btn"
@click.stop="showChatHistoryPanel"
>
{{ t("welcomeSidebar.viewAll") }}
</span>
<i
class="toggle-icon fas"
:class="
isChatHistoryExpanded
? 'fa-chevron-down'
: 'fa-chevron-right'
"
@click="toggleChatHistory"
></i>
</div>
</div>
<!-- 历史任务列表 -->
<div v-show="isChatHistoryExpanded" class="history-content">
<div
v-if="displayChatSessions.length === 0"
class="empty-history"
>
<span class="empty-text">{{
t("welcomeSidebar.noChatHistory")
}}</span>
</div>
<div v-else class="history-list">
<div
v-for="chat in displayChatSessions"
:key="chat.id"
class="history-item-row"
:class="{
'running-task': isRunningTask(chat),
selected: selectedChatId === chat.id,
disabled: selectedChatId === chat.id,
}"
@click.stop="handleChatClick(chat)"
>
<!-- 正在执行的任务显示转圈图标 -->
<i
v-if="isRunningTask(chat)"
class="fas fa-spinner fa-spin chat-type-icon running-icon"
></i>
<!-- 深度检索任务显示状态图标 -->
<img
v-else-if="chat.type === 'deep'"
src="/jiansuo.svg"
class="chat-type-icon status-icon"
:title="
chat.isFinished === true ? '任务已完成' : '任务未完成'
"
alt="status"
/>
<!-- 其他任务显示类型图标 -->
<i
v-else
:class="getChatTypeIcon(chat.type)"
class="chat-type-icon"
></i>
<div class="file-info-compact">
<div class="file-name-compact">
{{
chat.type === "deep" && chat.question
? chat.question
: chat.title
}}
</div>
<div class="file-date-compact">
{{ formatChatDate(chat.createdAt) }}
</div>
</div>
<img
src="/shanchu1.svg"
class="delete-icon-small"
@click.stop="deleteChatSession(chat.id)"
:title="t('welcomeSidebar.deleteChat')"
alt="delete"
/>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 深度检索-面板 -->
<div
v-show="currentSidebarTab === 'advanced'"
class="sidebar-tab-content"
>
<div class="sidebar-section">
<div class="menu-items">
<!-- 检索模式 -->
<div
class="menu-item history-item"
@click="toggleLiteratureSearch"
>
<img src="/shaixuan.svg" class="menu-icon" alt="筛选" />
<span>检索模式</span>
<i
class="toggle-icon fas"
:class="
isLiteratureSearchExpanded
? 'fa-chevron-down'
: 'fa-chevron-right'
"
></i>
</div>
<!-- 文献筛选内容 -->
<div
v-show="isLiteratureSearchExpanded"
class="history-content"
>
<div class="literature-config-content">
<div v-show="false" class="config-group">
<div class="button-group">
<span
class="zone-btn"
:class="{ active: literatureQuickTime === 'week' }"
@click="selectQuickTime('week')"
></span>
<el-date-picker
v-model="literatureDateRange"
type="daterange"
@change="handleDateRangeChange"
/>
</div>
</div>
<!-- 文档类型、数据源、研究类型、影响因子范围、中科院分区、JCR分区 -->
<div
v-for="filterGroup in literatureFilters"
:key="filterGroup.key"
class="config-group"
>
<template v-if="filterGroup.key === 'dataSource'">
<div class="config-group-title">检索速度</div>
<div class="search-mode-select-wrap">
<el-select
v-model="deepSearchMode"
class="search-mode-select"
@change="handleDeepSearchModeChange"
>
<el-option label="快速" value="quick" />
<el-option label="标准" value="standard" />
<el-option label="深度" value="deep" />
</el-select>
</div>
</template>
<div class="config-group-title">
{{
filterGroup.titleKey ? t(filterGroup.titleKey) : ""
}}
</div>
<div class="button-group">
<span
v-for="option in filterGroup.options"
:key="option.id"
class="zone-btn"
:class="{
disabled: filterGroup.key === 'dataSource',
active: isLiteratureFilterOptionSelected(
filterGroup.key,
option.id,
),
}"
@click="
filterGroup.key !== 'dataSource' &&
toggleLiteratureFilterOption(
filterGroup.key,
option.id,
)
"
>
{{
option.translationKey
? t(option.translationKey)
: option.labelText
}}
</span>
</div>
<div
v-if="filterGroup.key === 'dataSource'"
class="data-source-note"
>
<p>
备注:{{ currentDeepSearchModeNote }}
</p>
</div>
</div>
<!-- Dig Paper 知识库 -->
<div class="config-group kb-section">
<div class="config-group-title">Dig Paper 知识库</div>
<div class="kb-selector" @click="openKnowledgeBaseDialog">
<i class="fas fa-folder kb-icon-left"></i>
<span v-if="!settingsStore.selectedKnowledgeBaseDirectory"
>选择目录</span
>
<span
v-else
:title="settingsStore.selectedKnowledgeBaseDirectoryName || undefined"
>{{ settingsStore.selectedKnowledgeBaseDirectoryName }}</span
>
<i class="fas fa-chevron-down kb-icon-right"></i>
</div>
<div
v-if="settingsStore.selectedKnowledgeBaseDirectory"
class="kb-path-display"
>
{{ settingsStore.selectedKnowledgeBaseDirectoryName }}
</div>
<div class="kb-note">
备注:Dig
Paper深度解读目录中所有相关文件(包括.docx、.PDF、.PPTX和.MD),总数不超过100个或者1000页。
</div>
<!-- 已选文件列表 -->
<div
v-if="completedKnowledgeBaseFiles.length > 0"
class="kb-file-list"
>
<div
v-for="file in completedKnowledgeBaseFiles"
:key="file.id"
class="kb-file-item"
>
<img :src="getKBFileIcon(file.name)" class="kb-file-icon" />
<span class="kb-file-name">{{ file.name }}</span>
<i
class="fas fa-times remove-icon"
@click="removeKBFile(file.id?.toString())"
></i>
</div>
</div>
</div>
</div>
</div>
<!-- 定时任务 -->
<div v-show="false">
<div
class="menu-item history-item"
@click="toggleFunctionConfig"
>
<span>{{ t("welcomeSidebar.functionConfig") }}</span>
</div>
<div v-show="isFunctionConfigExpanded" class="history-content">
<div class="config-content">
<div class="config-item">
<el-input-number
v-model="maxStepNum"
:min="1"
:max="6"
@change="handlConfigChange('maxStepNum')"
/>
</div>
<div class="config-item">
<el-input-number
v-model="maxSearchResults"
:min="1"
:max="20"
@change="handlConfigChange('maxSearchResults')"
/>
</div>
</div>
</div>
</div>
<!-- <div
class="menu-item history-item"
@click="toggleScheduledTaskSection"
>
<div class="menu-item-left">
<i class="fas fa-clock"></i>
<span>{{ t("welcomeSidebar.scheduledTask") }}</span>
</div>
<i
class="toggle-icon fas"
:class="
isScheduledTaskExpanded
? 'fa-chevron-down'
: 'fa-chevron-right'
"
></i>
</div> -->
<!-- 定时任务内容 -->
<div
v-show="isScheduledTaskExpanded"
class="history-content scheduled-task-content"
>
<div class="scheduled-task-actions">
<!-- 开始 -->
<div class="form-item">
<span class="form-label">{{
t("welcomeSidebar.start")
}}</span>
<div class="form-content">
<div class="start-time-wrapper">
<el-date-picker
v-model="startTime"
type="datetime"
:placeholder="t('welcomeSidebar.start')"
format="YYYY/MM/DD HH:mm:ss"
@visible-change="handleStartTimePickerVisible"
/>
</div>
</div>
</div>
<!-- 提醒 -->
<div class="form-item">
<span class="form-label">{{
t("welcomeSidebar.reminder")
}}</span>
<div class="form-content">
<el-select
v-model="notifyType"
:placeholder="t('welcomeSidebar.reminder')"
class="form-select"
>
<el-option
v-for="option in reminderOptions"
:key="option.value"
:label="option.label"
:value="option.value"
:disabled="option.disabled"
/>
</el-select>
</div>
</div>
<!-- 重复 -->
<div class="form-item">
<span class="form-label">{{
t("welcomeSidebar.repeat")
}}</span>
<div class="form-content">
<div class="repeat-wrapper">
<el-select
v-model="repeatType"
:placeholder="t('welcomeSidebar.repeat')"
class="form-select repeat-select"
@change="handleRepeatChange"
>
<el-option
v-for="option in repeatOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</div>
</div>
</div>
<!-- 结束于(当选择重复时显示) -->
<div class="form-item" v-if="showEndsOn">
<span class="form-label">{{
t("welcomeSidebar.endsOn")
}}</span>
<div class="form-content">
<div class="start-time-wrapper">
<el-date-picker
v-model="repeatEndTime"
type="date"
:placeholder="t('welcomeSidebar.endsOn')"
format="YYYY年M月D日"
value-format="YYYY-MM-DD"
class="ends-on-picker"
/>
</div>
</div>
</div>
<!-- 启动定时任务 -->
<div class="form-item">
<span class="config-label">{{
t("welcomeSidebar.startTask")
}}</span>
<el-switch
v-model="startTask"
@change="handleStartTaskChange"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 历史任务面板 -->
<ChatHistoryPanel
ref="chatHistoryPanelRef"
v-if="isChatHistoryPanelVisible"
@close="closeChatHistoryPanel"
@chat-select="handlePanelChatClick"
@deleted="handleChatDeleted"
/>
<!-- 定时任务会话列表 -->
<ScheduledTaskSessionList
v-else-if="showScheduledTaskSessionList"
:schedule-id="currentScheduleId"
:task-title="currentTaskTitle"
:enabled="currentTaskEnabled"
:end-time="currentTaskEndTime"
:recurrence-expr="currentTaskRecurrenceExpr"
:next-run-at="currentTaskNextRunAt"
:recurrence-type="currentTaskRecurrenceType"
:literature-filters="currentTaskLiteratureFilters"
:literature-date-range="currentTaskLiteratureDateRange"
@session-click="handleSessionClick"
@task-status-changed="handleTaskStatusChanged"
@open-advanced-filter="handleOpenAdvancedFilter"
/>
<!-- 聊天界面 - 当开始聊天后显示 -->
<div v-else-if="chatStarted" class="chat-interface">
<!-- DeerFlow 聊天界面 -->
<DeerFlowChat
v-if="aiMode === 'deerflow'"
:initial-message="initialMessage"
:is-history-mode="isHistoryDeerFlow"
:history-task-id="currentDeepSearchTaskId"
:show-back-button="fromScheduledTaskList"
:literature-filters="deerFlowLiteratureFilters"
:literature-date-range="deerFlowLiteratureDateRange"
@back="handleBackToScheduledTaskList"
@open-advanced-filter="handleOpenAdvancedFilter"
/>
<!-- LinkMed 聊天界面 - 豆包模型-->
<LinkMedChat
v-else-if="aiMode === 'linkmed' && selectedModel === 'doubao'"
:current-session="currentSession"
:initial-message="initialMessage"
@session-created="handleSessionCreated"
@message-sent="handleMessageSent"
/>
<!-- LinkMed 聊天界面 - 百川模型-->
<BaichuanChat
v-else-if="aiMode === 'linkmed' && selectedModel === 'baichuan'"
:current-session="currentSession"
:initial-message="initialMessage"
@session-created="handleSessionCreated"
@message-sent="handleMessageSent"
@answer-completed="handleAnswerCompleted"
/>
</div>
<!-- 欢迎主页内容 - 默认显示 -->
<WelcomeMainContent
v-else
:ai-mode="aiMode"
:service-price="servicePrice"
:loading="isSubmitting"
@mode-change="setAiMode"
@submit="handleInputSubmit"
@stop="handleStop"
@tab-change="handleTabChange"
@tool-click="handleToolClick"
@open-advanced-filter="handleOpenAdvancedFilter"
/>
</div>
<!-- 定时任务弹窗 -->
<ScheduledTaskDialog
v-model="scheduledTaskDialogVisible"
@cancel="handleScheduledTaskCancel"
@created="handleScheduledTaskCreated"
/>
<!-- 定时任务列表弹窗 -->
<ScheduledTaskListDialog
v-model="scheduledTaskListDialogVisible"
:reload-key="scheduledTaskListReloadKey"
@close="handleScheduledTaskListClose"
@add-task="handleAddTaskFromList"
@manage-task="handleManageTaskFromList"
/>
<!-- 自定义重复弹窗 -->
<CustomRepeatDialog
v-model="customRepeatDialogVisible"
:repeat-end-time="repeatEndTime"
@confirm="handleCustomRepeatConfirm"
@update:repeat-end-time="(value) => (repeatEndTime = value)"
/>
<!-- 反馈问题弹窗 -->
<FeedbackDialog
v-model="feedbackDialogVisible"
@close="handleCloseFeedback"
@skip="handleSkipFeedback"
@go-to-feedback="handleGoToFeedback"
/>
<!-- 会员失效提示弹窗 -->
<MemberExpireDialog
v-model="memberExpireDialogVisible"
:title="memberExpireDialogTitle"
:description="memberExpireDialogDescription"
@cancel="handleMemberExpireCancel"
@recharge="handleMemberExpireRecharge"
/>
<!-- 领医豆余额提醒弹窗 -->
<BeansBalanceDialog
v-model="beansBalanceDialogVisible"
:balance="beansBalance"
@cancel="handleBeansBalanceCancel"
@recharge="handleBeansBalanceRecharge"
/>
<!-- 知识库选择弹窗 -->
<el-dialog
v-model="knowledgeBaseDialogVisible"
title="选择知识库目录"
width="700px"
append-to-body
destroy-on-close
class="kb-folder-dialog"
>
<div class="kb-dialog-body">
<div class="kb-dialog-layout">
<!-- 左侧树 -->
<div class="kb-tree-side">
<el-tree
ref="knowledgeBaseTreeRef"
:data="knowledgeBaseTreeData"
node-key="id"
:props="{ label: 'label', children: 'children', isLeaf: 'isLeaf' }"
:default-expanded-keys="knowledgeBaseExpandedKeys"
:highlight-current="true"
:expand-on-click-node="false"
lazy
:load="handleKnowledgeBaseLazyLoad"
@node-click="handleKnowledgeBaseFolderClick"
>
<template #default="{ data }">
<span class="custom-tree-node">
<i class="fas fa-folder"></i>
<span>{{ data.label || data.name }}</span>
</span>
</template>
</el-tree>
</div>
<!-- 右侧文件预览 -->
<div class="kb-files-side">
<div class="side-header">
当前目录:{{ knowledgeBaseCurrentFolderName || "请选择" }}
<span class="file-count"
>({{ knowledgeBaseFileList.length }}个文件)</span
>
</div>
<div class="kb-file-preview-list">
<div
v-for="file in knowledgeBaseFileList"
:key="file.id"
class="preview-item"
:class="{ 'is-processing': file.knowledgeStatus === 'processing' }"
>
<img v-if="file.knowledgeStatus !== 'processing'" :src="getKBFileIcon(file.name)" class="file-icon" />
<el-icon v-else class="file-icon is-loading"><Loading /></el-icon>
<span class="file-name" :title="file.name">{{
file.name
}}</span>
<el-tag
v-if="file.knowledgeStatus"
:type="getStatusTagType(file.knowledgeStatus)"
size="small"
class="status-tag"
>
{{ getStatusLabel(file.knowledgeStatus) }}
</el-tag>
</div>
<div
v-if="knowledgeBaseFileList.length === 0"
class="empty-tip"
>
该目录下没有文件
</div>
</div>
</div>
</div>
</div>
<template #footer>
<div class="dialog-footer">
<el-button @click="knowledgeBaseDialogVisible = false"
>取消</el-button
>
<el-button type="primary" @click="confirmKnowledgeBaseSelection"
>确认选择该目录</el-button
>
</div>
</template>
</el-dialog>
<!-- 强制绑定手机号弹窗 -->
<el-dialog
v-model="bindPhoneDialogVisible"
:title="$t('settings.profile.bindPhone')"
width="500px"
:close-on-click-modal="false"
:close-on-press-escape="false"
:show-close="false"
>
<el-form :model="bindPhoneForm" label-width="100px">
<el-form-item :label="$t('settings.profile.phone')">
<el-input
v-model="bindPhoneForm.phoneNumber"
:placeholder="$t('settings.profile.phonePlaceholder')"
maxlength="11"
@input="
bindPhoneForm.phoneNumber = bindPhoneForm.phoneNumber.replace(
/\D/g,
'',
)
"
/>
</el-form-item>
<el-form-item :label="$t('settings.profile.smsCode')">
<div style="display: flex; gap: 10px">
<el-input
v-model="bindPhoneForm.smsCode"
:placeholder="$t('settings.profile.smsCodePlaceholder')"
maxlength="6"
@input="
bindPhoneForm.smsCode = bindPhoneForm.smsCode.replace(/\D/g, '')
"
/>
<el-button
@click="sendBindSmsCode"
:disabled="smsCodeCountdown > 0 || bindPhoneLoading"
:loading="bindPhoneLoading"
>
{{
smsCodeCountdown > 0
? `${smsCodeCountdown}秒后重试`
: $t("settings.profile.sendSmsCode")
}}
</el-button>
</div>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button
type="primary"
@click="submitBindPhone"
:loading="bindPhoneLoading"
>
{{ $t("common.confirm") }}
</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
<script setup lang="ts">
import {
ref,
onMounted,
onUnmounted,
watch,
nextTick,
computed,
defineAsyncComponent,
} from "vue";
import { ElMessage } from "element-plus";
import { useRouter, useRoute } from "vue-router";
import { useI18n } from "vue-i18n";
import { Loading } from "@element-plus/icons-vue";
import { useDeerFlowStore } from "@/stores/deerflow";
import { useChatApiStore } from "@/stores/chatApi";
import { useSettingsStore } from "@/stores/settings";
import { useSchedulesStore } from "@/stores/schedules";
import { usePayStore } from "@/stores/pay";
import { useAppStore } from "@/stores/app";
import fileHistoryApi from "@/api/fileHistory";
import { listChats, deleteChat } from "@/api/chat";
import {
getDeepSearchHistory,
getChatStatus,
getDeepSearchDetail,
} from "@/api/deerflow";
import { getScheduleList, deleteSchedule } from "@/api/schedules";
import {
apiBindPhone,
apiSendBindSms,
getUserProfile,
apiGetCertificationStatus,
} from "@/api/user";
import {
getFolders,
getFiles,
} from "@/api/files";
import {
getServicePrice,
getCurrentUserMemberExpireTime,
getCurrentUserMemberType,
} from "@/api/pay";
import WelcomeMainContent from "@/components/WorkspaceWelcome/WelcomeMainContent.vue";
const DeerFlowChat = defineAsyncComponent(
() => import("@/components/Chat/DeerFlowChat.vue"),
);
const LinkMedChat = defineAsyncComponent(
() => import("@/components/Chat/LinkMedChat.vue"),
);
const BaichuanChat = defineAsyncComponent(
() => import("@/components/Chat/BaichuanChat.vue"),
);
const ChatHistoryPanel = defineAsyncComponent(
() => import("@/components/Chat/ChatHistoryPanel.vue"),
);
const ScheduledTaskDialog = defineAsyncComponent(
() => import("@/components/WorkspaceWelcome/ScheduledTaskDialog.vue"),
);
const ScheduledTaskListDialog = defineAsyncComponent(
() => import("@/components/WorkspaceWelcome/ScheduledTaskListDialog.vue"),
);
const CustomRepeatDialog = defineAsyncComponent(
() => import("@/components/WorkspaceWelcome/CustomRepeatDialog.vue"),
);
const ScheduledTaskSessionList = defineAsyncComponent(
() => import("@/components/WorkspaceWelcome/ScheduledTaskSessionList.vue"),
);
const Fireworks = defineAsyncComponent(
() => import("@/components/common/Fireworks.vue"),
);
const RegisterSuccessCard = defineAsyncComponent(
() => import("@/components/common/RegisterSuccessCard.vue"),
);
const FeedbackDialog = defineAsyncComponent(
() => import("@/components/common/FeedbackDialog.vue"),
);
const MemberExpireDialog = defineAsyncComponent(
() => import("@/components/common/MemberExpireDialog.vue"),
);
const BeansBalanceDialog = defineAsyncComponent(
() => import("@/components/common/BeansBalanceDialog.vue"),
);
import type { CustomRepeatData } from "@/components/WorkspaceWelcome/CustomRepeatDialog.vue";
const router = useRouter();
const route = useRoute();
const { t } = useI18n();
const deerflowStore = useDeerFlowStore();
const chatApiStore = useChatApiStore();
const settingsStore = useSettingsStore();
const schedulesStore = useSchedulesStore();
const payStore = usePayStore();
const appStore = useAppStore();
// 烟花和成功卡片相关
const fireworksRef = ref<InstanceType<typeof Fireworks> | null>(null);
const showSuccessCard = ref(false);
const isVerifying = ref(false); // 标记是否正在执行认证跳转
// 是否显示奖励文本(注册时显示,登录时不显示)
const showReward = computed(() => route.query.showReward === "true");
// 双向绑定 startTask
const startTask = computed({
get: () => schedulesStore.startTask,
set: (value: boolean) => {
schedulesStore.startTask = value;
},
});
// 过滤出解析完成的知识库文件
const completedKnowledgeBaseFiles = computed(() => {
return (settingsStore.knowledgeBaseFiles || []).filter(
(file) => file.knowledgeStatus === "completed",
);
});
// 最近访问文档数据接口
interface RecentDocument {
fileId: string;
displayName: string;
extension: string;
lastAccessedAt: string;
folderId?: string;
folderPath?: string;
}
// 历史对话接口
interface ChatSession {
id: number;
title: string;
createdAt: string;
deleted: boolean;
provider?: string; // 添加提供商字段,用于区分不同来源(doubao/baichuan/deerflow)
type?: "quick" | "deep"; // 添加类型字段,quick: 快问快答/普通对话,deep: 深度检索
question?: string; // 深度检索的问题
data?: any; // 深度检索的数据
statusIcon?: string | null; // 任务状态图标路径
isFinished?: boolean | null; // 任务完成状态
hasData?: boolean; // 深度检索任务是否有数据
threadId?: string; // 深度检索任务的线程ID
recurrenceType?: string; // 定时任务的重复类型
enabled?: boolean; // 定时任务是否启用
paramsJson?: string; // 任务的参数JSON字符串
}
const deepChatCache = new Map<
number,
{
messages: any[];
question: string;
threadId?: string;
createdAt?: string;
updatedAt: number;
}
>();
// 数据
const selectedModel = ref<string>("baichuan"); // 模型设置
const chatStarted = ref(false);
const aiMode = ref<"deerflow" | "linkmed">("linkmed");
const isSubmitting = ref(false); // 提交状态锁,防止重复点击
const currentSession = ref<any>(null);
const initialMessage = ref<string>("");
const isHistoryDeerFlow = ref(false); // 是否为历史深度检索对话模式
const currentDeepSearchTaskId = ref<number | null>(null); // 当前深度检索任务ID,用于触发Tab重置
const servicePrice = ref<number | null>(null); // 服务价格
// 左侧边栏状态
const isSidebarCollapsed = ref(false);
const currentSidebarTab = ref<"recent" | "advanced" | "settings">("recent");
const isHistoryExpanded = ref(false); // 最近文档展开/收起状态
const recentDocuments = ref<RecentDocument[]>([]); // 最近访问的文档列表
const isChatHistoryExpanded = ref(true); // 历史对话展开/收起状态(默认展开)
const historyChatSessions = ref<ChatSession[]>([]); // 历史对话列表
const isLiteratureSearchExpanded = ref(true); // 文献搜索展开/收起状态(默认展开)
const isFunctionConfigExpanded = ref(true); // 功能配置展开/收起状态(默认展开)
const isScheduledTaskExpanded = ref(false); // 定时任务展开/收起状态
const isModelSettingsExpanded = ref(false); // 模型设置展开/收起状态
const isChatHistoryPanelVisible = ref(false); // 历史对话面板显示状态
const showScheduledTaskSessionList = ref(false); // 定时任务会话列表显示状态
const fromScheduledTaskList = ref(false); // 是否从定时任务会话列表进入
const currentScheduleId = ref<number | undefined>(undefined); // 当前定时任务ID
const currentTaskTitle = ref<string | undefined>(""); // 当前任务标题
const currentTaskEnabled = ref<boolean | undefined>(undefined); // 当前任务启用状态
const currentTaskEndTime = ref<string | undefined>(undefined); // 当前任务重复结束时间
const currentTaskRecurrenceExpr = ref<string | undefined>(undefined); // 当前任务重复表达式
const currentTaskNextRunAt = ref<string | undefined>(undefined); // 当前任务下一次执行时间
const currentTaskRecurrenceType = ref<string | undefined>(undefined); // 当前任务重复类型
const currentTaskLiteratureFilters = ref<any[] | undefined>(undefined); // 当前任务的文献筛选器
const currentTaskLiteratureDateRange = ref<string[] | undefined>(undefined); // 当前任务的文献日期范围
// const currentTaskLiteratureQuickTime = ref<string | undefined>(undefined); // 当前任务的文献快捷时间
const deerFlowLiteratureFilters = ref<any[] | undefined>(undefined); // DeerFlow 聊天界面的文献筛选器
const deerFlowLiteratureDateRange = ref<string[] | undefined>(undefined); // DeerFlow 聊天界面的文献日期范围
// const chatHistoryPanelRef = ref<any>(null); // 历史对话面板引用
const selectedChatId = ref<number | null>(null); // 当前选中的任务ID,用于高亮显示
const selectedItemId = ref<number | null>(null); // 当前选中的对话ID,用于高亮显示
const maxPlanIterations = ref(settingsStore.maxPlanIterations); // 最大计划迭代次数
const maxStepNum = ref(settingsStore.maxStepNum); // 最大步骤数
const maxSearchResults = ref(settingsStore.maxSearchResults); // 最大搜索结果数
const startTime = ref<Date | null>(null); // 定时任务开始时间
const notifyType = ref<string>("email"); // 定时任务提醒类型
const repeatType = ref<string | undefined>("noRepeat"); // 定时任务重复类型
const repeatEndTime = ref<string | undefined>(undefined); // 定时任务重复结束时间
const customRepeatDialogVisible = ref(false); // 自定义重复弹窗显示状态
const customRepeatData = ref<CustomRepeatData | undefined>(undefined); // 自定义重复数据
// 反馈问题弹窗相关
const feedbackDialogVisible = ref(false); // 反馈问题弹窗显示状态
// 会员失效提示弹窗相关
const memberExpireDialogVisible = ref(false);
const memberExpireDialogTitle = ref("");
const memberExpireDialogDescription = ref("");
// 领医豆余额提醒弹窗相关
const beansBalanceDialogVisible = ref(false);
const beansBalance = ref(0);
// 强制绑定手机号弹窗相关
const bindPhoneDialogVisible = ref(false); // 绑定手机号弹窗显示状态
// 监听所有可能影响新手引导的全局弹窗状态
watch(
[
showSuccessCard,
feedbackDialogVisible,
memberExpireDialogVisible,
beansBalanceDialogVisible,
bindPhoneDialogVisible,
],
([
success,
feedback,
expire,
beans,
bindPhone,
]) => {
const isAnyVisible = success || feedback || expire || beans || bindPhone;
appStore.setGlobalModalVisible(isAnyVisible);
},
{ immediate: true }
);
const bindPhoneForm = ref({
phoneNumber: "",
smsCode: "",
});
const smsCodeCountdown = ref(0); // 验证码倒计时
const smsCodeTimer = ref<number | null>(null); // 验证码倒计时定时器
const bindPhoneLoading = ref(false); // 绑定手机号加载状态
const userId = ref<number | null>(null); // 用户ID
// 文献筛选配置数据
interface LiteratureFilterOption {
id: string;
translationKey?: string; // 如果使用翻译key,则使用这个
labelText?: string; // 如果直接使用文本,则使用这个
}
interface LiteratureFilterGroup {
key: string;
titleKey: string; // 翻译key
options: LiteratureFilterOption[];
selected: string[]; // 支持多选,存储选中的id数组
}
// 提醒选项
const reminderOptions = computed(() => [
{
label: t("welcomeSidebar.reminderEmail"),
value: "email",
disabled: false,
},
// {
// label: t("welcomeSidebar.reminderSMS"),
// value: "sms",
// disabled: true,
// },
// {
// label: t("welcomeSidebar.reminderWeChat"),
// value: "wechat",
// disabled: true,
// },
]);
// 基础重复选项
const baseRepeatOptions = computed(() => [
{
label: t("welcomeSidebar.noRepeat"),
value: "noRepeat",
},
{
label: t("welcomeSidebar.repeatDaily"),
value: "daily",
},
{
label: t("welcomeSidebar.repeatEveryWorkday"),
value: "workday",
},
{
label: t("welcomeSidebar.repeatWeekly"),
value: "weekly",
},
{
label: t("welcomeSidebar.repeatBiweekly"),
value: "biweekly",
},
{
label: t("welcomeSidebar.repeatMonthly"),
value: "monthly",
},
{
label: t("welcomeSidebar.custom"),
value: "custom",
},
]);
// 自定义重复选项列表
const customRepeatOptionsList = ref<
Array<{ label: string; value: string; customData?: any }>
>([]);
// 重复选项(包含基础选项和自定义选项)
const repeatOptions = computed(() => {
return [...baseRepeatOptions.value, ...customRepeatOptionsList.value];
});
// 计算是否显示结束日期
const showEndsOn = computed(() => {
return repeatType.value !== "noRepeat";
});
// 创建默认的文献筛选配置
const createDefaultLiteratureFilters = (): LiteratureFilterGroup[] => [
// 数据源
{
key: "dataSource",
titleKey: "welcomeSidebar.dataSource",
options: [
{
id: "pubmed",
translationKey: "welcomeSidebar.dataSourcePubMed",
},
{
id: "clinicalTrials",
translationKey: "welcomeSidebar.dataSourceClinicalTrials",
},
{
id: "wos",
translationKey: "welcomeSidebar.dataSourceWos",
},
],
selected: ["pubmed"], // 默认选中第一项
},
];
// 处理重复选项变化
const handleRepeatChange = (value: string) => {
if (value === "custom") {
repeatType.value = "custom";
// 打开自定义重复弹窗
customRepeatDialogVisible.value = true;
} else if (value === "noRepeat") {
repeatEndTime.value = undefined;
customRepeatData.value = undefined;
repeatType.value = "noRepeat";
} else {
// 如果选择其他重复选项,清除 customRepeatData,但保留 endsOn(用户需要设置)
customRepeatData.value = undefined;
repeatType.value = value;
}
};
// 转换函数:将 customRepeatData 转换为 Cron 表达式
const convertToCron = (
data: CustomRepeatData,
startTimeStr: string,
): string => {
// 先根据开始时间设置 时、分、秒
// Cron 采用 6 位格式:秒 分 时 日 月 周
let second = "0";
let minute = "0";
let hour = "0";
if (startTimeStr) {
const [hStr, mStr] = startTimeStr.split(":");
const hNum = Number(hStr);
const mNum = Number(mStr);
if (!Number.isNaN(hNum) && hNum >= 0 && hNum <= 23) {
hour = hNum.toString();
}
if (!Number.isNaN(mNum) && mNum >= 0 && mNum <= 59) {
minute = mNum.toString();
}
}
// 初始化 日 / 月 / 周 字段,默认值为 * 或 ?
let dayOfDay: number | string | null = null;
let dayOfMonth = "*";
let dayOfWeek = "?";
// 根据 frequency 类型处理(结合 interval)
switch (data.frequency) {
// // 日
// case "days":
// dayOfDay = data.interval > 1 ? `*/${data.interval}` : "*"; // 每N天
// dayOfMonth = "*";
// dayOfWeek = "?";
// break;
// 月
case "monthly":
const cronMonthDays = data.selectedMonthDays.map((day) => {
return day;
});
if (cronMonthDays.length > 0) {
dayOfDay = cronMonthDays.join(",");
} else {
dayOfDay = "*";
}
dayOfMonth = "*";
dayOfWeek = "?"; // 周字段置空(与日互斥)
break;
// 周
case "weekly":
const cronWeekDays = data.selectedDays.map((day) => {
return day;
});
if (cronWeekDays.length > 0) {
dayOfWeek = cronWeekDays.join(",");
} else {
dayOfWeek = "*";
}
dayOfDay = "?"; // 日字段置空(与周互斥)
dayOfMonth = "*"; // 所有月
break;
}
// 组合 Cron 表达式(秒 分 时 日 月 周)
// return `${second} ${minute} ${hour} ${dayOfDay} ${dayOfMonth} ${dayOfWeek}`;
if (data.frequency === "days") {
return data.interval.toString();
} else {
// 组合 Cron 表达式(秒 分 时 日 月 周)
return `${second} ${minute} ${hour} ${dayOfDay} ${dayOfMonth} ${dayOfWeek}`;
}
};
// 星期数组
const weekdays = computed<Record<number, string>>(() => ({
0: t("welcomeSidebar.sunday"),
1: t("welcomeSidebar.monday"),
2: t("welcomeSidebar.tuesday"),
3: t("welcomeSidebar.wednesday"),
4: t("welcomeSidebar.thursday"),
5: t("welcomeSidebar.friday"),
6: t("welcomeSidebar.saturday"),
}));
// 生成自定义重复选项的显示文本
const generateCustomRepeatLabel = (data: CustomRepeatData) => {
const { frequency, interval, selectedDays, selectedMonthDays } = data;
if (frequency === "days") {
return t("welcomeSidebar.customRepeatEveryNDays", {
interval: interval.toString(),
});
} else if (frequency === "weekly") {
if (selectedDays.length === 0) {
return "";
}
// 排序选中的星期
const sortedDays = [...selectedDays].sort((a, b) => a - b);
const dayNames = sortedDays.map((day) => weekdays.value[day] || "");
const daysText = dayNames.join("、");
// 如果超过一定长度,截断并添加省略号
const maxLength = 15;
const displayDays =
daysText.length > maxLength
? daysText.substring(0, maxLength) + "..."
: daysText;
// 如果间隔为1,使用"每周的",否则使用"每X周的"
if (interval === 1) {
return t("welcomeSidebar.customRepeatWeeklyOnDays", {
days: displayDays,
});
} else {
return t("welcomeSidebar.customRepeatEveryNWeeksOnDays", {
interval: interval.toString(),
days: displayDays,
});
}
} else if (frequency === "monthly") {
if (selectedMonthDays.length === 0) {
return "";
}
// 排序选中的日期
const sortedDays = [...selectedMonthDays].sort((a, b) => a - b);
const daysText = sortedDays.join("、");
// 如果超过一定长度,截断并添加省略号
const maxLength = 15;
const displayDays =
daysText.length > maxLength
? daysText.substring(0, maxLength) + "..."
: daysText;
// 如果间隔为1,使用"每月的",否则使用"每X月的"
if (interval === 1) {
return t("welcomeSidebar.customRepeatMonthlyOnDays", {
days: displayDays,
});
} else {
return t("welcomeSidebar.customRepeatEveryNMonthsOnDays", {
interval: interval.toString(),
days: displayDays,
});
}
}
return "";
};
// 处理自定义重复确认
const handleCustomRepeatConfirm = (
data: CustomRepeatData,
endsOn: string | undefined,
) => {
// 保存自定义重复数据
customRepeatData.value = data;
repeatEndTime.value = endsOn;
// 生成自定义重复选项的显示文本
const customLabel = generateCustomRepeatLabel(data);
if (!customLabel) {
ElMessage.warning("请完整配置自定义重复规则");
return;
}
// 生成唯一的自定义值,确保下次选择"自定义"时能重新触发 @change 事件
const customValue = `custom_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
// 创建自定义选项
const customOption = {
label: customLabel,
value: customValue,
customData: {
...data,
},
};
// 添加到自定义选项列表
customRepeatOptionsList.value.push(customOption);
// 设置当前选择的值为新创建的自定义选项
repeatType.value = customValue;
ElMessage.success(t("common.success"));
};
// 监听自定义重复弹窗关闭,如果用户取消则重置 repeatType
watch(customRepeatDialogVisible, (newVal, oldVal) => {
// 当弹窗从打开变为关闭,且没有自定义数据时,说明用户取消了
if (
oldVal &&
!newVal &&
(repeatType.value === "custom" ||
repeatType.value?.startsWith("custom_")) &&
!customRepeatData.value
) {
repeatType.value = "noRepeat";
}
});
// 当用户打开开始时间选择器时,如果还没有设置时间,则使用当前时间
const handleStartTimePickerVisible = (visible: boolean) => {
if (visible && !startTime.value) {
startTime.value = new Date();
}
};
// 处理定时任务开关变化
const handleStartTaskChange = async () => {
// 若手动关闭开关,直接同步 store 状态
if (!startTask.value) {
schedulesStore.startTask = false;
return;
}
// 验证开始时间
if (!startTime.value) {
ElMessage.warning(t("welcomeSidebar.pleaseSelectStartTime"));
startTask.value = false;
return;
}
// 解析开始时间
let startDate: Date;
try {
startDate =
startTime.value instanceof Date
? startTime.value
: new Date(startTime.value);
if (isNaN(startDate.getTime())) {
throw new Error("invalid date");
}
} catch (error) {
ElMessage.error("开始时间格式错误");
startTask.value = false;
return;
}
if (repeatType.value === "noRepeat") {
const currentDateTime = new Date();
if (startDate <= currentDateTime) {
ElMessage.error(t("welcomeSidebar.pleaseCheckStartTime"));
startTask.value = false;
return;
}
}
if (repeatType.value !== "noRepeat" && !repeatEndTime.value) {
ElMessage.warning(t("welcomeSidebar.pleaseSelectEndTime"));
startTask.value = false;
return;
}
// 验证结束时间:不能是今天之前,也不能是今天,只能选择今天之后
if (repeatType.value !== "noRepeat" && repeatEndTime.value) {
try {
const endDate = new Date(repeatEndTime.value);
if (isNaN(endDate.getTime())) {
throw new Error("invalid date");
}
// 获取今天的日期(只比较日期部分,不考虑时间)
const today = new Date();
today.setHours(0, 0, 0, 0);
const endDateOnly = new Date(endDate);
endDateOnly.setHours(0, 0, 0, 0);
// 结束时间必须在今天之后
if (endDateOnly <= today) {
ElMessage.error(t("welcomeSidebar.endTimeMustBeAfterToday"));
startTask.value = false;
return;
}
} catch (error) {
ElMessage.error(t("welcomeSidebar.endTimeFormatError"));
startTask.value = false;
return;
}
}
let repeatExpr: string | undefined;
let finalRepeatType = repeatType.value;
// 检查是否是自定义重复(包括 "custom" 和 "custom_xxx" 格式)
if (
repeatType.value === "custom" ||
repeatType.value?.startsWith("custom_")
) {
if (!customRepeatData.value) {
ElMessage.warning("请先配置自定义重复规则");
startTask.value = false;
return;
}
const timeStr = `${startDate
.getHours()
.toString()
.padStart(2, "0")}:${startDate.getMinutes().toString().padStart(2, "0")}`;
repeatExpr = convertToCron(customRepeatData.value, timeStr);
finalRepeatType = "custom";
}
let formattedRepeatEndTime: string | undefined;
if (repeatEndTime.value) {
formattedRepeatEndTime = `${repeatEndTime.value}T23:59:59`;
}
const pad = (num: number) => String(num).padStart(2, "0");
const formatDateTime = (date: Date) =>
`${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}T${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())}`;
schedulesStore.setScheduleInfo({
startTime: formatDateTime(startDate),
notifyType: notifyType.value,
repeatType:
customRepeatData.value?.frequency === "days" ? "days" : finalRepeatType,
repeatExpr: repeatExpr,
repeatEndTime: formattedRepeatEndTime,
});
schedulesStore.startTask = true;
};
// 验证定时任务规则(用于监听器,不显示错误消息)
const validateTaskRules = (): boolean => {
// 验证开始时间
if (!startTime.value) {
return false;
}
// 解析开始时间
let startDate: Date;
try {
startDate =
startTime.value instanceof Date
? startTime.value
: new Date(startTime.value);
if (isNaN(startDate.getTime())) {
return false;
}
} catch (error) {
return false;
}
// 验证单次任务:开始时间必须在当前时间之后
if (repeatType.value === "noRepeat") {
const currentDateTime = new Date();
if (startDate <= currentDateTime) {
return false;
}
}
// 验证重复任务:必须选择结束时间
if (repeatType.value !== "noRepeat" && !repeatEndTime.value) {
return false;
}
// 验证结束时间:不能是今天之前,也不能是今天,只能选择今天之后
if (repeatType.value !== "noRepeat" && repeatEndTime.value) {
try {
const endDate = new Date(repeatEndTime.value);
if (isNaN(endDate.getTime())) {
return false;
}
// 获取今天的日期(只比较日期部分,不考虑时间)
const today = new Date();
today.setHours(0, 0, 0, 0);
const endDateOnly = new Date(endDate);
endDateOnly.setHours(0, 0, 0, 0);
// 结束时间必须在今天之后
if (endDateOnly <= today) {
return false;
}
} catch (error) {
return false;
}
}
return true;
};
// 监听 startTime、repeatEndTime 和 repeatType 的变化
watch(
[() => startTime.value, () => repeatEndTime.value, () => repeatType.value],
() => {
// 只有当 startTask 为 true 时才进行验证
if (startTask.value) {
if (!validateTaskRules()) {
// 验证失败,关闭定时任务(computed 会自动更新 store)
startTask.value = false;
}
}
},
{ deep: true },
);
// 快捷时间
const literatureQuickTime = ref<string | null>(
settingsStore.getLiteratureQuickTime(),
);
// 日期范围
const literatureDateRange = ref<[string, string] | null>(
settingsStore.getLiteratureDateRange(),
);
const normalizeDeepSearchMode = (mode: unknown): "quick" | "standard" | "deep" => {
if (mode === "standard" || mode === "deep") return mode;
// 兼容后端可能返回的 fast 枚举
if (mode === "fast" || mode === "quick") return "quick";
return "quick";
};
const deepSearchMode = ref<"quick" | "standard" | "deep">(
normalizeDeepSearchMode(settingsStore.getDeepSearchMode()),
);
const deepSearchModeDataSourceMap: Record<"quick" | "standard" | "deep", string[]> =
{
quick: ["pubmed"],
standard: ["pubmed", "wos"],
deep: ["pubmed", "clinicalTrials", "wos"],
};
const deepSearchModeNoteMap: Record<"quick" | "standard" | "deep", string> = {
quick:
"【快速】(3~6 分钟,≈3 篇)优先返回高相关性结果,耗时更短,适合快速获取核心文献。",
standard:
"【标准】(10~20 分钟,≈15 篇)平衡检索速度与结果全面性,覆盖更多相关文献,适合日常科研检索。",
deep:
"【深度】(30~100 分钟,≈28~40 篇)深度遍历数据源,返回最完整的结果集,耗时较长,适合需要全面文献覆盖的严谨研究。",
};
const currentDeepSearchModeNote = computed(
() => deepSearchModeNoteMap[deepSearchMode.value],
);
const getDataSourcesByDeepSearchMode = (
mode: "quick" | "standard" | "deep",
): string[] => deepSearchModeDataSourceMap[mode] || ["pubmed"];
const syncDataSourceByDeepSearchMode = async (shouldSave = true) => {
const dataSourceGroup = literatureFilters.value.find(
(group) => group.key === "dataSource",
);
if (!dataSourceGroup) return;
const selectedByMode = getDataSourcesByDeepSearchMode(deepSearchMode.value);
const validOptionIds = dataSourceGroup.options.map((opt) => opt.id);
dataSourceGroup.selected = selectedByMode.filter((id) =>
validOptionIds.includes(id),
);
// 数据源与知识库互斥:按速度模式选择数据源时清空知识库
if (dataSourceGroup.selected.length > 0) {
settingsStore.setKnowledgeBaseDirectory(null, null);
settingsStore.setKnowledgeBaseFiles([]);
}
settingsStore.setLiteratureFilters(literatureFilters.value);
if (shouldSave) {
await settingsStore.saveCurrentSearchSettings();
}
};
// 验证并过滤 selected 值,只保留在 options 中存在的选项
const validateAndFilterSelected = (
filterGroup: LiteratureFilterGroup,
savedSelected: string[] = [],
): string[] => {
if (!savedSelected || savedSelected.length === 0) {
return filterGroup.selected || [];
}
// 获取所有有效的 option id
const validOptionIds = filterGroup.options.map((opt) => opt.id);
// 过滤掉不在 options 中的 selected 值
const filteredSelected = savedSelected.filter((id) =>
validOptionIds.includes(id),
);
// 如果过滤后为空,使用默认值
return filteredSelected.length > 0
? filteredSelected
: filterGroup.selected || [];
};
// 筛选配置 - 使用默认配置作为基础,只从保存的数据中获取 selected 值
const savedFilters = settingsStore.getLiteratureFilters();
const defaultFilters = createDefaultLiteratureFilters();
// 知识库相关逻辑
const knowledgeBaseDialogVisible = ref(false);
const knowledgeBaseTreeData = ref<any[]>([]);
const knowledgeBaseExpandedKeys = ref<any[]>([]);
const knowledgeBaseCurrentFolderId = ref<string | number | null>(null);
const knowledgeBaseFileList = ref<any[]>([]); // 弹窗中预览的文件列表
const knowledgeBaseCurrentFolderName = ref<string>("");
// 转换知识库文件夹树
const transformKnowledgeBaseFolderTree = (nodes: any): any => {
if (Array.isArray(nodes)) {
return nodes.map(transformKnowledgeBaseFolderTree);
} else if (nodes && typeof nodes === "object") {
return {
...nodes,
id: (nodes.id === 0 || nodes.id === "0") ? -1 : nodes.id,
label: nodes.name || nodes.folderName || (nodes.id === 0 || nodes.id === "root" || nodes.id === -1 ? "我的文档" : ""),
isLeaf: false, // 统一标记为非叶子节点以支持懒加载
children: nodes.children
? transformKnowledgeBaseFolderTree(nodes.children)
: [],
};
}
return nodes;
};
// 知识库树懒加载处理
const handleKnowledgeBaseLazyLoad = async (node: any, resolve: Function) => {
try {
// 根节点加载
if (node.level === 0) {
const response = await getFolders();
if (response.data) {
const rootNode = transformKnowledgeBaseFolderTree(response.data);
resolve([rootNode]);
// 初始展开并选中根节点
nextTick(() => {
knowledgeBaseExpandedKeys.value = [rootNode.id];
handleKnowledgeBaseFolderClick(rootNode);
});
} else {
resolve([]);
}
return;
}
// 子节点加载
const folderId = node.data.id === -1 ? undefined : node.data.id;
const response = await getFiles(folderId);
if (response.data) {
const items = Array.isArray(response.data)
? response.data
: response.data.files || response.data.items || [];
const folders = items
.filter((item: any) => !!(item.isFolder || item.folder || item.type === "folder"))
.map((item: any) => transformKnowledgeBaseFolderTree(item));
resolve(folders);
} else {
resolve([]);
}
} catch (error) {
console.error("懒加载知识库目录失败:", error);
resolve([]);
}
};
// 加载知识库文件夹树
const loadKnowledgeBaseFolders = async () => {
// 开启懒加载模式后,由 handleKnowledgeBaseLazyLoad 处理初始加载
// 这里可以执行一些重置逻辑
knowledgeBaseFileList.value = [];
knowledgeBaseCurrentFolderId.value = null;
knowledgeBaseCurrentFolderName.value = "";
};
// 获取文件图标
const getKBFileIcon = (fileName: string) => {
if (!fileName) return "/wenjian.svg";
const ext = fileName.split(".").pop()?.toLowerCase();
switch (ext) {
case "pdf":
return "/pdf_icon.svg";
case "doc":
case "docx":
return "/word_icon.svg";
case "ppt":
case "pptx":
return "/PPT_icon.svg";
case "md":
return "/md_icon.svg";
default:
return "/wenjian.svg";
}
};
// 获取知识库状态显示文本
const getStatusLabel = (status?: string): string => {
const statusMap: Record<string, string> = {
not_supported: t("KnowledgeBase.statusNotSupported") || "不支持",
not_processed: t("KnowledgeBase.statusNotProcessed") || "未处理",
processing: t("KnowledgeBase.statusProcessing") || "处理中",
completed: t("KnowledgeBase.statusCompleted") || "已完成",
failed: t("KnowledgeBase.statusFailed") || "失败",
};
return statusMap[status || ""] || status || "未处理";
};
// 获取状态标签类型
const getStatusTagType = (status?: string): "success" | "primary" | "danger" | "info" => {
switch (status) {
case "completed":
return "success";
case "processing":
return "primary";
case "failed":
return "danger";
case "not_processed":
case "not_supported":
return "info";
default:
return "info";
}
};
// 打开知识库选择弹窗
const openKnowledgeBaseDialog = () => {
knowledgeBaseDialogVisible.value = true;
loadKnowledgeBaseFolders();
};
// 处理文件夹点击(仅预览)
const handleKnowledgeBaseFolderClick = async (data: any) => {
knowledgeBaseCurrentFolderId.value = data.id;
knowledgeBaseCurrentFolderName.value = data.label;
try {
const response = await getFiles(data.id);
if (response.data) {
let files = Array.isArray(response.data)
? response.data
: response.data.files || [];
// 过滤掉文件夹
knowledgeBaseFileList.value = files.filter(
(item: any) => !item.isFolder && !item.folder && item.type !== "folder",
);
}
} catch (error) {
console.error("加载知识库文件失败:", error);
ElMessage.error("加载知识库文件失败");
}
};
// 确认选择目录
async function confirmKnowledgeBaseSelection() {
if (!knowledgeBaseCurrentFolderId.value) {
ElMessage.warning("请先选择一个目录");
return;
}
if (knowledgeBaseFileList.value.length > 100) {
ElMessage.warning("目录中的文件数量不能超过100个");
return;
}
settingsStore.setKnowledgeBaseDirectory(
knowledgeBaseCurrentFolderId.value.toString(),
knowledgeBaseCurrentFolderName.value,
);
// 过滤出解析完成的文件再存入 store,确保发送给后端的是有效文件
const completedFiles = knowledgeBaseFileList.value.filter(
(file: any) => file.knowledgeStatus === "completed"
);
settingsStore.setKnowledgeBaseFiles(completedFiles);
// 清除数据源选择(互斥)
const dataSourceGroup = literatureFilters.value.find(
(g) => g.key === "dataSource",
);
if (dataSourceGroup) {
dataSourceGroup.selected = [];
settingsStore.setLiteratureFilters(literatureFilters.value);
}
// 清除时效性要求(互斥)
literatureDateRange.value = null;
literatureQuickTime.value = null;
settingsStore.setLiteratureDateRange(null);
settingsStore.setLiteratureQuickTime(null);
// 保存到后端
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索设置失败:", error);
}
knowledgeBaseDialogVisible.value = false;
}
// 移除知识库文件
const removeKBFile = (fileId: string) => {
settingsStore.removeKnowledgeBaseFile(fileId);
};
const literatureFilters = ref<LiteratureFilterGroup[]>(
savedFilters.length > 0
? defaultFilters.map((defaultFilter) => {
const savedFilter = savedFilters.find(
(f) => f.key === defaultFilter.key,
);
return {
...defaultFilter,
selected: validateAndFilterSelected(
defaultFilter,
savedFilter?.selected,
),
};
})
: defaultFilters,
);
const handlConfigChange = async (configKey: string) => {
// 更新 store 中的值
switch (configKey) {
case "maxPlanIterations":
settingsStore.maxPlanIterations = maxPlanIterations.value;
break;
case "maxStepNum":
settingsStore.maxStepNum = maxStepNum.value;
break;
case "maxSearchResults":
settingsStore.maxSearchResults = maxSearchResults.value;
break;
default:
return;
}
// 统一调用保存方法
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存配置失败:", error);
ElMessage.error("保存配置失败");
}
};
// 检索速度变更
const handleDeepSearchModeChange = async (mode: "quick" | "standard" | "deep") => {
settingsStore.setDeepSearchMode(mode);
try {
await syncDataSourceByDeepSearchMode(false);
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索速度失败:", error);
ElMessage.error("保存检索速度失败");
}
};
// 1.快捷时间
const selectQuickTime = async (type: string) => {
literatureQuickTime.value = type;
const today = new Date();
let startDate: Date;
switch (type) {
case "week":
startDate = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000);
break;
case "month":
startDate = new Date(today.getTime() - 30 * 24 * 60 * 60 * 1000);
break;
case "6months":
startDate = new Date(today.getTime() - 6 * 30 * 24 * 60 * 60 * 1000);
break;
case "year":
startDate = new Date(today.getTime() - 365 * 24 * 60 * 60 * 1000);
break;
default:
return;
}
// 格式化日期为 YYYY-MM-DD
const formatDate = (date: Date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
};
literatureDateRange.value = [formatDate(startDate), formatDate(today)];
// 同步到 store
settingsStore.setLiteratureQuickTime(type);
settingsStore.setLiteratureDateRange(literatureDateRange.value);
// 如果选择了时效性,清除知识库目录选择(互斥)
if (settingsStore.selectedKnowledgeBaseDirectory) {
settingsStore.setKnowledgeBaseDirectory(null, null);
settingsStore.setKnowledgeBaseFiles([]);
}
// 保存到后端
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索设置失败:", error);
}
};
// 2.日期范围 - 检查是否与快捷时间匹配
const handleDateRangeChange = async (value: [string, string] | null) => {
if (!value) {
literatureQuickTime.value = null;
// 同步到 store
settingsStore.setLiteratureDateRange(null);
settingsStore.setLiteratureQuickTime(null);
// 保存到后端
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索设置失败:", error);
}
return;
}
// 检查当前日期范围是否匹配任一快捷时间选项
const today = new Date();
const formatDate = (date: Date) => {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
};
const checkMatch = (days: number) => {
const startDate = new Date(today.getTime() - days * 24 * 60 * 60 * 1000);
const expectedRange: [string, string] = [
formatDate(startDate),
formatDate(today),
];
return value[0] === expectedRange[0] && value[1] === expectedRange[1];
};
// 检查是否匹配任一快捷选项
if (checkMatch(7)) {
literatureQuickTime.value = "week";
} else if (checkMatch(30)) {
literatureQuickTime.value = "month";
} else if (checkMatch(180)) {
literatureQuickTime.value = "6months";
} else if (checkMatch(365)) {
literatureQuickTime.value = "year";
} else {
// 如果不是快捷选择,清除快捷状态
literatureQuickTime.value = null;
}
// 同步到 store
settingsStore.setLiteratureDateRange(value);
settingsStore.setLiteratureQuickTime(literatureQuickTime.value);
// 如果选择了日期范围,清除知识库目录选择(互斥)
if (value && settingsStore.selectedKnowledgeBaseDirectory) {
settingsStore.setKnowledgeBaseDirectory(null, null);
settingsStore.setKnowledgeBaseFiles([]);
}
// 保存到后端
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索设置失败:", error);
}
};
// 3.筛选选项
// shouldSave 用于控制是否立刻持久化到后端:
// - 用户交互(点击筛选项)时使用默认值 true -> 需要保存
// - 组件初始化时调用时传入 false -> 只同步本地和 store,不触发保存
const toggleLiteratureFilterOption = async (
groupKey: string,
optionId: string,
shouldSave = true,
) => {
if (groupKey === "dataSource") {
return;
}
const group = literatureFilters.value.find((g) => g.key === groupKey);
if (!group) return;
const index = group.selected.indexOf(optionId);
if (index > -1) {
// 如果已选中,取消选中(允许全部取消)
group.selected.splice(index, 1);
} else {
// 如果未选中,添加到选中列表
group.selected.push(optionId);
// 如果选择了数据源,清除知识库目录选择(互斥)
if (groupKey === "dataSource" && group.selected.length > 0) {
settingsStore.setKnowledgeBaseDirectory(null, null);
settingsStore.setKnowledgeBaseFiles([]);
}
}
// 验证并过滤 selected 值,只保留在 options 中存在的选项
const validOptionIds = group.options.map((opt) => opt.id);
group.selected = group.selected.filter((id) => validOptionIds.includes(id));
// 如果过滤后为空,且没有选择知识库,使用默认值
if (
group.selected.length === 0 &&
!settingsStore.selectedKnowledgeBaseDirectory
) {
const defaultFilter = createDefaultLiteratureFilters().find(
(f) => f.key === groupKey,
);
if (defaultFilter) {
group.selected = defaultFilter.selected || [];
}
}
// 同步到 store(保存前已经验证和过滤)
settingsStore.setLiteratureFilters(literatureFilters.value);
// 初始化阶段等场景可以选择不立即保存
if (shouldSave) {
// 保存到后端
try {
await settingsStore.saveCurrentSearchSettings();
} catch (error) {
console.error("保存检索设置失败:", error);
}
}
};
// 判断选项是否选中
const isLiteratureFilterOptionSelected = (
groupKey: string,
optionId: string,
): boolean => {
const group = literatureFilters.value.find((g) => g.key === groupKey);
return group ? group.selected.includes(optionId) : false;
};
// 显示历史任务的计算属性
const displayChatSessions = computed(() => {
return [...historyChatSessions.value];
});
// 获取服务价格
const fetchServicePrice = async () => {
try {
const serviceTypeId = aiMode.value === "deerflow" ? 2 : 1;
const response = await getServicePrice({ serviceTypeId });
servicePrice.value = response.data;
} catch (error) {
console.error("获取服务价格失败:", error);
servicePrice.value = null;
}
};
const handleStop = () => {
if (aiMode.value === "deerflow") {
deerflowStore.stopStreaming();
} else {
chatApiStore.closeAllEventSources();
}
ElMessage.info(t("chat.stopStreaming") || "已中止当前生成");
};
// AI 模式切换
const setAiMode = (mode: "linkmed" | "deerflow") => {
aiMode.value = mode;
// 切换模式时,如果当前tab不适用于新模式,则切换回"最近访问"
if (mode === "linkmed" && currentSidebarTab.value === "advanced") {
currentSidebarTab.value = "recent";
} else if (mode === "deerflow" && currentSidebarTab.value === "settings") {
currentSidebarTab.value = "recent";
}
// 切换模式时重新获取价格
fetchServicePrice();
if (mode === "deerflow") {
deerflowStore.initDeerFlow().catch((error) => {
console.error("初始化 DeerFlow 失败:", error);
ElMessage.error("DeerFlow 连接失败,请检查后端服务是否启动");
});
}
};
// 处理输入提交
const handleInputSubmit = async (content: string) => {
if (!content.trim() || isSubmitting.value) return;
isSubmitting.value = true;
// 设置 schedulesStore 的 description 值
schedulesStore.description = content.trim();
try {
// 判断是否需要创建定时任务
if (schedulesStore.startTask) {
deerflowStore.currentThreadId = "";
// 创建定时任务
const result = await schedulesStore.createScheduleTask();
if (result.success) {
await loadHistoryChatSessions();
// 重置状态
schedulesStore.resetScheduleInfo();
schedulesStore.description = "";
schedulesStore.startTask = false;
// 显示历史任务列表并跳转到定时任务面板中
switchSidebarTab("recent");
// 等待一个 tick,确保数据已更新
await nextTick();
// 获取重新加载后的任务列表第一项(最新创建的定时任务)
const firstChat = historyChatSessions.value?.[0];
if (firstChat) {
await handleChatClick(firstChat);
}
} else {
ElMessage.error(result.message || "定时任务创建失败");
}
// 不跳转到 DeerFlowChat 页面
return;
} else {
// 先获取领医豆余额和服务单价
try {
// 使用全局 payStore 中的余额,不再在此处单独请求接口
const balance = payStore.beansBalance ?? 0;
// 根据 aiMode 获取对应的服务单价
let servicePrice = 0;
if (aiMode.value === "deerflow") {
const priceResponse = await getServicePrice({ serviceTypeId: 2 });
servicePrice = priceResponse.data;
} else if (aiMode.value === "linkmed") {
const priceResponse = await getServicePrice({ serviceTypeId: 1 });
servicePrice = priceResponse.data;
}
// 判断领医豆余额是否大于服务单价
if (balance < servicePrice) {
ElMessage.error("领医豆余额不足,无法使用该服务");
return;
}
} catch (error: any) {
ElMessage.error(
error?.response?.data?.message || "获取余额或服务价格失败",
);
return;
}
const currentDateTime = new Date();
schedulesStore.setScheduleInfo({
startTime: currentDateTime.toISOString(),
notifyType: "",
repeatType: "immediately",
repeatExpr: undefined,
repeatEndTime: undefined,
});
// 如果 startTask 为 false,正常跳转到 DeerFlowChat 页面
if (aiMode.value === "deerflow") {
deerflowStore.clearMessages();
} else if (aiMode.value === "linkmed") {
chatApiStore.clearMessages();
}
// 保存初始消息
initialMessage.value = content.trim();
// 标记聊天已开始
chatStarted.value = true;
isHistoryDeerFlow.value = false;
currentDeepSearchTaskId.value = null; // 重置任务ID
}
} finally {
isSubmitting.value = false;
}
};
// 处理会话创建事件
const handleSessionCreated = (session: any) => {
currentSession.value = session;
};
// 处理消息发送事件
const handleMessageSent = async (data: any) => {
// 百川发送消息后,立即刷新左侧边栏的历史/任务列表(不用等 answer-completed)
if (data?.provider === "baichuan") {
await handleAnswerCompleted();
}
};
// 处理回答完成事件(百川模型)
const handleAnswerCompleted = async () => {
// 只刷新百川的历史对话列表
const baichuanChats = await loadBaichuanHistory();
// 获取当前的深度检索记录
const deepSearchChats = historyChatSessions.value.filter(
(chat) => chat.provider === "deerflow",
);
// 合并并更新历史对话列表
const allChats = [...baichuanChats, ...deepSearchChats];
// 按时间降序排序
allChats.sort((a, b) => {
const timeA = new Date(a.createdAt).getTime();
const timeB = new Date(b.createdAt).getTime();
return timeB - timeA;
});
historyChatSessions.value = allChats;
};
// 处理标签页切换
const handleTabChange = (tab: string) => {};
// 处理工具按钮点击
const handleToolClick = (tool: string) => {
switch (tool) {
case "web-search":
ElMessage.info("Web搜索功能开发中...");
break;
case "attach-file":
ElMessage.info("文件上传功能开发中...");
break;
case "mention-user":
ElMessage.info("提及用户功能开发中...");
break;
}
};
// 处理新对话点击
const handleNewChat = () => {
// 清除选中状态
selectedChatId.value = null;
selectedItemId.value = null;
isChatHistoryPanelVisible.value = false;
showScheduledTaskSessionList.value = false;
chatStarted.value = false;
// 如果存在正在执行的深度检索任务,中断流式连接
if (deerflowStore.streaming) {
// 关闭当前的流式连接
if (deerflowStore.currentStream) {
try {
deerflowStore.currentStream.close();
console.log("已关闭流式连接");
} catch (error) {
console.warn("关闭流式连接失败:", error);
}
}
// 重置流式状态
deerflowStore.streaming = false;
deerflowStore.aiTyping = false;
deerflowStore.aiThinking = false;
// 清空消息
deerflowStore.clearMessages();
}
// 清除当前运行任务ID
deerflowStore.setCurrentRunningTaskId(null);
// 重置聊天状态,回到欢迎界面
aiMode.value = "linkmed";
chatStarted.value = false;
initialMessage.value = "";
currentSession.value = null;
};
// 侧边栏切换
const switchSidebarTab = (tab: "recent" | "advanced" | "settings") => {
currentSidebarTab.value = tab;
};
const toggleSidebarCollapse = () => {
isSidebarCollapsed.value = !isSidebarCollapsed.value;
};
// 切换最近文档展开/收起状态
const toggleHistory = () => {
isHistoryExpanded.value = !isHistoryExpanded.value;
};
// 切换历史对话展开/收起状态
const toggleChatHistory = () => {
isChatHistoryExpanded.value = !isChatHistoryExpanded.value;
};
// 切换文献搜索展开/收起状态
const toggleLiteratureSearch = () => {
isLiteratureSearchExpanded.value = !isLiteratureSearchExpanded.value;
};
// 处理打开高级筛选
const handleOpenAdvancedFilter = () => {
// 切换到深度检索面板
currentSidebarTab.value = "advanced";
// 展开侧边栏(如果折叠的话)
isSidebarCollapsed.value = false;
// 打开文献筛选内容面板
isLiteratureSearchExpanded.value = true;
};
// 切换模型设置展开/收起状态
const toggleModelSettings = () => {
isModelSettingsExpanded.value = !isModelSettingsExpanded.value;
};
// 切换功能配置展开/收起状态
const toggleFunctionConfig = () => {
isFunctionConfigExpanded.value = !isFunctionConfigExpanded.value;
};
// 切换定时任务展开/收起状态
const toggleScheduledTaskSection = () => {
isScheduledTaskExpanded.value = !isScheduledTaskExpanded.value;
};
// 定时任务弹窗相关
const scheduledTaskDialogVisible = ref(false);
// 定时任务列表弹窗相关
const scheduledTaskListDialogVisible = ref(false);
const scheduledTaskListReloadKey = ref(0);
// 打开定时任务弹窗(现在打开的是添加任务列表弹窗)
const openScheduledTaskDialog = () => {
scheduledTaskDialogVisible.value = true;
};
const openScheduledTaskListDialog = () => {
scheduledTaskListDialogVisible.value = true;
};
// 处理定时任务取消
const handleScheduledTaskCancel = () => {
// 取消时的处理逻辑(如果需要)
};
// 定时任务创建成功
const handleScheduledTaskCreated = () => {
scheduledTaskListReloadKey.value += 1;
};
// 处理定时任务列表关闭
const handleScheduledTaskListClose = () => {
// 关闭时的处理逻辑(如果需要)
};
// 从任务列表弹窗中添加任务
const handleAddTaskFromList = () => {
// 关闭任务列表弹窗
// scheduledTaskListDialogVisible.value = false;
// 打开添加任务弹窗
scheduledTaskDialogVisible.value = true;
};
// 从任务列表弹窗中管理任务
const handleManageTaskFromList = () => {
// TODO: 实现管理任务的逻辑
ElMessage.info("管理任务功能待实现");
};
// 显示历史对话面板
const showChatHistoryPanel = () => {
isChatHistoryPanelVisible.value = true;
// 如果存在正在执行的深度检索任务,中断流式连接
if (deerflowStore.streaming) {
// 关闭当前的流式连接
if (deerflowStore.currentStream) {
try {
deerflowStore.currentStream.close();
} catch (error) {
console.warn("关闭流式连接失败:", error);
}
}
// 重置流式状态
deerflowStore.streaming = false;
deerflowStore.aiTyping = false;
deerflowStore.aiThinking = false;
// 清空消息
deerflowStore.clearMessages();
}
// 清除当前运行任务ID
deerflowStore.setCurrentRunningTaskId(null);
};
// 关闭历史对话面板
const closeChatHistoryPanel = () => {
// 关闭历史对话面板
isChatHistoryPanelVisible.value = false;
// 清除选中状态
selectedChatId.value = null;
selectedItemId.value = null;
// 确保回到欢迎界面主页(WelcomeMainContent)
chatStarted.value = false;
};
// 处理面板中的对话点击
const handlePanelChatClick = async (chat: ChatSession) => {
// 关闭面板
closeChatHistoryPanel();
await handleChatClick(chat);
};
// 处理历史对话面板中的删除事件
const handleChatDeleted = async (chatId: number) => {
// 从左侧边栏列表中移除已删除的对话
historyChatSessions.value = historyChatSessions.value.filter(
(c) => c.id !== chatId,
);
// 重新加载历史对话列表,确保数据同步
await loadHistoryChatSessions();
};
// 处理任务状态改变事件
const handleTaskStatusChanged = async () => {
// 重新加载历史任务列表,更新任务的启用状态
await loadHistoryChatSessions();
};
const refreshDeepChatInBackground = async (chat: ChatSession) => {
try {
const res = await getDeepSearchDetail(chat.id);
const data = res?.data;
if (!data) return;
isHistoryDeerFlow.value = true;
const messages = data.data || data.messages || [];
// 写缓存(深拷贝,防止 UI 污染)
deepChatCache.set(chat.id, {
messages: JSON.parse(JSON.stringify(messages)),
question: data.question || chat.question || chat.title,
threadId: data.threadId || chat.threadId,
createdAt: data.createdAt,
updatedAt: Date.now(),
});
// 如果用户仍然停留在这个 chat,静默更新 UI
if (selectedItemId.value === chat.id) {
deerflowStore.loadHistoryTask({
id: chat.id,
data: messages,
question: data.question || chat.question || chat.title,
threadId: data.threadId || chat.threadId,
createdAt: data.createdAt || new Date().toISOString(),
});
}
} catch (e) {
console.warn("deep chat 后台刷新失败,继续使用缓存");
}
};
/** 从通知中心点击后,根据 sourceId 打开深度检索任务详情 */
const openDeepSearchFromSourceId = async (sourceId: number) => {
// 清除 URL 中的 sourceId,避免重复触发
router.replace({ path: route.path, query: {} });
aiMode.value = "deerflow";
chatStarted.value = true;
currentDeepSearchTaskId.value = sourceId;
isHistoryDeerFlow.value = true;
fromScheduledTaskList.value = false;
selectedItemId.value = sourceId;
selectedChatId.value = sourceId;
deerflowStore.currentRunningTaskId = sourceId;
isChatHistoryPanelVisible.value = false;
showScheduledTaskSessionList.value = false;
const chat: ChatSession = {
id: sourceId,
title: "",
question: "",
createdAt: "",
threadId: undefined,
hasData: true,
recurrenceType: "immediately",
statusIcon: "jiansuo.svg",
deleted: false,
provider: "deerflow",
type: "deep",
};
try {
const res = await getDeepSearchDetail(sourceId);
const data = res?.data;
if (!data) {
ElMessage.error("获取任务详情失败");
return;
}
const messages = data.data || data.messages || [];
const hasData = messages.length > 0;
chat.question = data.question || chat.question;
chat.threadId = data.threadId || chat.threadId;
chat.createdAt = data.createdAt || chat.createdAt;
chat.hasData = hasData;
if (hasData) {
const question = chat.question || "";
const threadId = chat.threadId || "";
deepChatCache.set(sourceId, {
messages: JSON.parse(JSON.stringify(messages)),
question,
threadId,
createdAt: chat.createdAt || "",
updatedAt: Date.now(),
});
isHistoryDeerFlow.value = true;
deerflowStore.loadHistoryTask({
id: sourceId,
data: messages,
question,
threadId,
createdAt: chat.createdAt || new Date().toISOString(),
});
} else if (chat.threadId) {
const statusResponse = await getChatStatus(chat.threadId);
const statusData = statusResponse?.data || statusResponse;
if (statusData?.finished && statusData?.cursor !== -1) {
isHistoryDeerFlow.value = true;
await deerflowStore.loadChatHistory({
threadId: chat.threadId,
question: chat.question || statusData?.question,
sessionId: sourceId,
});
} else if (!statusData?.finished && statusData?.cursor !== -1) {
isHistoryDeerFlow.value = true;
const taskDetail = {
id: sourceId,
threadId: chat.threadId,
question: chat.question,
createdAt: chat.createdAt || new Date().toISOString(),
sessionId: sourceId,
} as any;
await deerflowStore.replayHistoryTask(taskDetail);
} else {
ElMessage.error("未找到历史数据");
}
} else {
ElMessage.error("获取任务详情失败");
}
} catch (e) {
console.error("从通知打开深度检索任务失败:", e);
ElMessage.error("加载任务失败,请重试");
}
};
// 监听从通知中心跳转的 sourceId,打开深度检索任务详情
watch(
() => route.query.sourceId,
(sourceId) => {
if (sourceId && /^\d+$/.test(String(sourceId))) {
openDeepSearchFromSourceId(Number(sourceId));
}
},
{ immediate: true }
);
// 处理会话点击
const handleSessionClick = async (session: any) => {
const chat: ChatSession = {
id: session.id,
title: session.title,
question: session.question,
createdAt: session.createdAt,
threadId: session.threadId,
hasData: session.hasData,
recurrenceType: "immediately",
statusIcon: "jiansuo.svg",
deleted: false,
provider: "deerflow",
type: "deep",
};
currentDeepSearchTaskId.value = chat.id;
isChatHistoryPanelVisible.value = false;
showScheduledTaskSessionList.value = false;
fromScheduledTaskList.value = true; // 标记从定时任务会话列表进入
chatStarted.value = true;
deerflowStore.currentRunningTaskId = chat.id; // 当前运行会话id
selectedItemId.value = chat.id;
const cached = deepChatCache.get(chat.id);
if (cached) {
isHistoryDeerFlow.value = true;
deerflowStore.loadHistoryTask({
id: chat.id,
data: cached.messages,
question: cached.question,
threadId: cached.threadId,
createdAt: cached.createdAt || new Date(cached.updatedAt).toISOString(),
});
} else {
deerflowStore.setCurrentRunningTaskId(null);
deerflowStore.clearMessages();
deerflowStore.currentThreadId = null;
}
if (chat.hasData === false) {
const statusResponse = await getChatStatus(chat.threadId || "");
const statusData = statusResponse.data || statusResponse;
// 根据 finished 状态调用不同的接口
if (statusData.finished && statusData.cursor !== -1) {
// history 模式
isHistoryDeerFlow.value = true;
// 任务已完成,加载历史记录
await deerflowStore.loadChatHistory({
threadId: chat.threadId || "",
question: chat.question || chat.title,
sessionId: chat.id || undefined,
});
} else if (!statusData.finished && statusData.cursor !== -1) {
// 任务未完成,重放历史任务
// history 模式
isHistoryDeerFlow.value = true;
const taskDetail = {
id: chat.id,
threadId: chat.threadId || "",
question: chat.question || chat.title,
createdAt: chat.createdAt || new Date().toISOString(),
sessionId: chat.id || undefined,
} as any;
await deerflowStore.replayHistoryTask(taskDetail);
} else {
console.log("未找到历史数据");
ElMessage.error("未找到历史数据");
}
} else {
// hasData 为true
refreshDeepChatInBackground(chat);
}
};
// 处理返回到定时任务会话列表
const handleBackToScheduledTaskList = () => {
fromScheduledTaskList.value = false;
showScheduledTaskSessionList.value = true;
chatStarted.value = false;
};
// 格式化历史对话时间为 YYYY/MM/DD HH:mm:ss 格式
const formatChatDate = (dateString: string): string => {
if (!dateString) return "";
try {
const date = new Date(dateString);
if (isNaN(date.getTime())) {
return dateString; // Return original if invalid
}
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, "0");
const day = date.getDate().toString().padStart(2, "0");
const hours = date.getHours().toString().padStart(2, "0");
const minutes = date.getMinutes().toString().padStart(2, "0");
const seconds = date.getSeconds().toString().padStart(2, "0");
return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
} catch (error) {
console.error("Error formatting chat date:", error);
return dateString;
}
};
// 加载最近访问的文档
const loadRecentDocuments = async () => {
try {
// 使用真实API获取最近访问记录,显示10条
const response = await fileHistoryApi.getList({
page: 1,
size: 10,
sortBy: "last_accessed_at",
sortOrder: "DESC",
});
if (response.code === 200) {
recentDocuments.value = response.data.items || [];
} else {
recentDocuments.value = [];
}
} catch (error) {
console.error("加载最近文档失败:", error);
recentDocuments.value = [];
}
};
// 加载百川历史记录
const loadBaichuanHistory = async () => {
try {
// 获取百川的历史对话(传递 provider=baichuan)
const baichuanResponse = await listChats({
page: 0,
size: 20,
provider: "baichuan",
});
// 处理百川的对话记录
const baichuanChats = (baichuanResponse.data || [])
.filter((chat: ChatSession) => !chat.deleted)
.map((chat: ChatSession) => ({
...chat,
provider: "baichuan",
type: "quick" as const,
recurrenceType: "",
}));
return baichuanChats;
} catch (error) {
console.error("加载百川历史记录失败:", error);
return [];
}
};
// 加载深度检索历史记录
const loadDeepSearchHistory = async () => {
try {
// 获取定时任务列表(深度检索任务)
const deepSearchResponse = await getScheduleList({
page: 1,
size: 20,
});
// 处理深度检索记录 - 正确提取 items 数组
// 接口返回格式:{ total: number, items: [] }
const deepSearchData = deepSearchResponse?.data?.items || [];
// 将深度检索任务转换为 ChatSession 格式
const deepSearchChats = deepSearchData.map((task: any) => {
const paramsJson = JSON.parse(task.paramsJson);
const threadId = paramsJson.thread_id;
return {
id: task.id,
title: task.title || task.question,
question: task.question,
createdAt: task.createdAt || task.startTime,
deleted: task.deleted || false,
provider: "deerflow",
type: "deep" as const,
recurrenceType: task.recurrenceType,
hasData: false, // 定时任务默认没有数据
threadId: threadId, // 定时任务没有线程ID
statusIcon: "jiansuo.svg",
isFinished: undefined,
enabled: task.enabled,
endTime: task.endTime, // 重复结束时间
recurrenceExpr: task.recurrenceExpr, // 重复表达式
nextRunAt: task.nextRunAt, // 下一次执行时间
paramsJson: task.paramsJson, // 保存原始 paramsJson 字符串
};
});
// 返回处理后的数据
return deepSearchChats;
} catch (error) {
console.error("加载深度检索历史记录失败:", error);
return [];
}
};
// 加载任务历史 - 整合百川和深度检索的历史记录
const loadHistoryChatSessions = async () => {
try {
// 并行获取百川和深度检索的历史对话
const [baichuanChats, deepSearchChats] = await Promise.all([
loadBaichuanHistory(),
loadDeepSearchHistory(),
]);
// 合并百川和深度检索的列表
const allChats = [...baichuanChats, ...deepSearchChats];
// 合并并按时间降序排序(最新的在前)
allChats.sort((a, b) => {
const timeA = new Date(a.createdAt).getTime();
const timeB = new Date(b.createdAt).getTime();
return timeB - timeA; // 降序排序
});
historyChatSessions.value = allChats;
} catch (error) {
console.error("加载历史对话失败:", error);
historyChatSessions.value = [];
}
};
// 删除历史记录项
const deleteHistoryItem = async (fileId: string) => {
try {
const response: any = await fileHistoryApi.deleteHistory(fileId);
if (response.code === 200 || response.status === 200) {
// 从列表中移除该项
recentDocuments.value = recentDocuments.value.filter(
(doc) => doc.fileId !== fileId,
);
ElMessage.success("已删除该访问记录");
} else {
ElMessage.error(response.message || "删除失败");
}
} catch (error) {
console.error("删除历史记录失败:", error);
ElMessage.error("删除历史记录失败");
}
};
// 删除历史对话
const deleteChatSession = async (chatId: number) => {
try {
// 查找对话记录,判断是否为深度检索任务
const chat = historyChatSessions.value.find((c) => c.id === chatId);
if (!chat) {
ElMessage.error("未找到该对话记录");
return;
}
let response: any;
if (chat.type === "deep") {
// 深度检索任务,调用 DELETE /agent/deep-searches/{id}
response = await deleteSchedule(chatId);
} else {
// 普通对话(豆包或百川),调用原有的删除接口
response = await deleteChat(chatId);
}
if (response.code === 200 || response.status === 200) {
// 从列表中移除该项
historyChatSessions.value = historyChatSessions.value.filter(
(c) => c.id !== chatId,
);
ElMessage.success(
chat.type === "deep" ? "已删除该深度检索任务" : "已删除该对话",
);
} else {
ElMessage.error(response.message || "删除失败");
}
} catch (error) {
console.error("删除历史对话失败:", error);
ElMessage.error("删除失败");
}
};
// 处理历史对话点击
// ⭐ 点击中止:连续点击时直接取消上一次请求链,避免并发覆盖状态
let chatClickAbortController: AbortController | null = null;
// ⭐ 深度检索(immediately)点击防抖:2 秒内多次点击只在窗口结束时切换到最新任务
let deepImmediateClickTimer: ReturnType<typeof setTimeout> | null = null;
let deepImmediateLatestChat: ChatSession | null = null;
// 当前已在处理/已触发请求链的 deep-immediately chatId(用于“相同则复用,不重复发”)
let deepImmediateActiveChatId: ChatSession["id"] | null = null;
const handleChatClick = async (chat: ChatSession) => {
// 仅在“真正要开启新请求链”时才会创建/中止 controller
let controller: AbortController | null = null;
const runWithNewController = async (
fn: (signal: AbortSignal) => Promise<void>,
) => {
if (chatClickAbortController) {
try {
chatClickAbortController.abort();
} catch {}
}
controller = new AbortController();
chatClickAbortController = controller;
try {
await fn(controller.signal);
} finally {
// 仅清理由本次创建的 controller,避免竞态清掉后续点击的 controller
if (chatClickAbortController === controller) {
chatClickAbortController = null;
}
}
};
fromScheduledTaskList.value = false; // 不显示返回按钮
// 记录选中的任务ID,用于高亮显示
if (selectedChatId.value === chat.id) {
return;
} else {
selectedChatId.value = chat.id;
}
// 关闭历史任务面板和定时任务会话列表,确保能显示聊天界面
isChatHistoryPanelVisible.value = false;
showScheduledTaskSessionList.value = false;
chatStarted.value = true;
// 判断是深度检索还是普通对话
if (chat.type === "deep") {
// 关闭正在进行的流式请求
deerflowStore.stopStreaming();
schedulesStore.scheduleId = chat.id;
setAiMode("deerflow");
// 立即执行的任务
if (chat.recurrenceType === "immediately") {
// 将 deep/immediately 的请求链封装起来:由定时器决定是否 abort & 触发
const startDeepImmediateLoad = async (targetChat: ChatSession) => {
deepImmediateActiveChatId = targetChat.id;
await runWithNewController(async (signal) => {
// 获取会话列表,获取会话详情;
const response = await getDeepSearchHistory(
{
scheduleId: targetChat.id,
},
signal,
);
const item: any = response?.items[0] || targetChat;
currentDeepSearchTaskId.value = item.id;
selectedItemId.value = item.id;
deerflowStore.currentRunningTaskId = item.id; // 当前运行会话id
const cached = deepChatCache.get(item.id);
if (cached) {
isHistoryDeerFlow.value = true;
deerflowStore.loadHistoryTask({
id: item.id,
data: cached.messages,
question: cached.question,
threadId: cached.threadId,
createdAt:
cached.createdAt || new Date(cached.updatedAt).toISOString(),
});
// 设置处理状态(任务已完成,不在进行中)
deerflowStore.processingStatus.isPlanGenerating = false;
deerflowStore.processingStatus.isResearchInProgress = false;
deerflowStore.processingStatus.isReportGenerating = false;
deerflowStore.processingStatus.isResearchCompleted = true;
deerflowStore.streaming = false;
} else {
deerflowStore.setCurrentRunningTaskId(null);
deerflowStore.clearMessages();
deerflowStore.currentThreadId = null;
}
// hasData 为false
if (item.hasData === false) {
const statusResponse = await getChatStatus(item.threadId, signal);
const statusData = statusResponse.data || statusResponse;
// 同步后端 interrupted 状态到 store,用于控制“修订/接受计划”按钮显示
if (
statusData &&
typeof statusData.interrupted === "boolean" &&
item.threadId
) {
deerflowStore.setThreadInterrupted(
item.threadId,
statusData.interrupted,
);
}
if (statusData.finished && statusData.cursor !== -1) {
// history 模式
isHistoryDeerFlow.value = true;
// 任务已完成,加载历史记录
await deerflowStore.loadChatHistory({
threadId: item.threadId || "",
question: statusData.question || targetChat.title,
sessionId: item.id || undefined,
signal,
});
} else if (!statusData.finished && statusData.cursor !== -1) {
// replay 模式
isHistoryDeerFlow.value = false;
schedulesStore.scheduleId = targetChat.id; // 任务ID
const taskDetail = {
id: item.id,
threadId: item.threadId || "",
question: item.question || targetChat.title,
createdAt: item.createdAt || new Date().toISOString(),
sessionId: item.id || undefined,
};
await deerflowStore.replayHistoryTask(taskDetail, signal);
} else {
console.log("未找到历史数据");
ElMessage.error("未找到历史数据");
}
} else {
// hasData 为true
refreshDeepChatInBackground(item);
}
});
};
// 2 秒窗口:点击时不立刻中止也不立刻发请求;2 秒后再判断是否需要 abort & 发请求
deepImmediateLatestChat = chat;
if (deepImmediateClickTimer) {
clearTimeout(deepImmediateClickTimer);
}
deepImmediateClickTimer = setTimeout(async () => {
const latest = deepImmediateLatestChat;
// 窗口结束,清理 timer(latest 保留到读取后再清)
deepImmediateClickTimer = null;
deepImmediateLatestChat = null;
// 没有最新点击:不处理
if (!latest) return;
// 2 秒后待执行 id 与当前 active id 一样:不中止,也不进行后续请求(延用之前的请求)
if (deepImmediateActiveChatId === latest.id) {
return;
}
try {
await startDeepImmediateLoad(latest);
} catch (immediateError) {
// 如果是用户触发的新点击导致的取消,不提示错误
const err: any = immediateError;
const isCanceled =
err?.name === "AbortError" ||
err?.code === "ERR_CANCELED" ||
err?.message?.includes("canceled") ||
err?.message?.includes("aborted");
if (!isCanceled) {
ElMessage.error("加载任务失败,请重试");
}
}
// 确保 DeerFlow 已初始化
if (!deerflowStore.connected && !deerflowStore.connecting) {
try {
await deerflowStore.initDeerFlow();
} catch (initError) {
console.warn("DeerFlow 初始化失败,继续加载历史数据:", initError);
}
}
// 清空初始消息(加载历史不需要发送新消息)
initialMessage.value = "";
aiMode.value = "deerflow";
// 从 paramsJson 中提取 literature_filters
if (latest.paramsJson) {
try {
const paramsJson = JSON.parse(latest.paramsJson);
const literature_filters = paramsJson.literature_filters;
if (literature_filters) {
deerFlowLiteratureFilters.value =
literature_filters.literatureFilters;
deerFlowLiteratureDateRange.value =
literature_filters.literatureDateRange;
} else {
deerFlowLiteratureFilters.value = undefined;
deerFlowLiteratureDateRange.value = undefined;
}
} catch (error) {
deerFlowLiteratureFilters.value = undefined;
deerFlowLiteratureDateRange.value = undefined;
}
} else {
deerFlowLiteratureFilters.value = undefined;
deerFlowLiteratureDateRange.value = undefined;
}
// 等待一个 tick,让 aiMode 的变化生效
await nextTick();
// 标记聊天已开始
chatStarted.value = true;
// 再等待一个 tick,确保 DOM 已更新
await nextTick();
}, 300);
// 立刻返回:不 abort、不发请求,等待 2 秒窗口结束再决定
return;
} else {
// 跳转到定时任务会话列表页面
showScheduledTaskSessionList.value = true;
currentScheduleId.value = chat.id;
currentTaskTitle.value = chat.title || chat.question;
currentTaskEnabled.value = chat.enabled; // 设置任务启用状态
currentTaskEndTime.value = (chat as any).endTime; // 设置重复结束时间
currentTaskRecurrenceExpr.value = (chat as any).recurrenceExpr; // 设置重复表达式
currentTaskNextRunAt.value = (chat as any).nextRunAt; // 设置下一次执行时间
currentTaskRecurrenceType.value = (chat as any).recurrenceType; // 设置重复类型
// 从 paramsJson 中提取 literature_filters
if (chat.paramsJson) {
try {
const paramsJson = JSON.parse(chat.paramsJson);
const literature_filters = paramsJson.literature_filters;
if (literature_filters) {
currentTaskLiteratureFilters.value =
literature_filters.literatureFilters;
currentTaskLiteratureDateRange.value =
literature_filters.literatureDateRange;
} else {
currentTaskLiteratureFilters.value = undefined;
currentTaskLiteratureDateRange.value = undefined;
}
} catch (error) {
console.error("解析 paramsJson 失败:", error);
currentTaskLiteratureFilters.value = undefined;
currentTaskLiteratureDateRange.value = undefined;
}
} else {
currentTaskLiteratureFilters.value = undefined;
currentTaskLiteratureDateRange.value = undefined;
}
}
} else {
// 普通对话(豆包或百川)
await runWithNewController(async (_signal) => {
// 普通对话这里不需要 signal 透传(原逻辑未使用)
// 转换为 chatApiStore 需要的 Session 格式
const session = {
sessionId: chat.id,
id: chat.id,
title: chat.title,
preview: "",
messageCount: 0,
lastActivity: chat.createdAt,
createdAt: chat.createdAt,
updatedAt: chat.createdAt,
status: chat.deleted ? "DELETED" : "ACTIVE",
agentId: null,
agentName:
chat.provider === "baichuan" ? "百川 AI助手" : "LinkMed AI助手",
};
// 根据 provider 设置 selectedModel
if (chat.provider === "baichuan") {
selectedModel.value = "baichuan";
chatApiStore.setSelectedModel("baichuan");
} else {
selectedModel.value = "doubao";
chatApiStore.setSelectedModel("doubao");
}
// 使用 chatApiStore 选择会话并加载消息历史
await chatApiStore.selectSession({
session: session,
fetchMessages: true, // 重要:加载消息历史
});
// 设置当前会话
currentSession.value = session;
// 设置为 LinkMed 模式
aiMode.value = "linkmed";
// 标记聊天已开始
chatStarted.value = true;
});
}
};
// 获取文件图标
const getFileIcon = (type: string): string => {
const iconMap: Record<string, string> = {
pdf: "/pdf_icon.svg",
doc: "/word_icon.svg",
docx: "/word_icon.svg",
xls: "/excel_icon.svg",
xlsx: "/excel_icon.svg",
txt: "/TXT_icon.svg",
md: "/md_icon.svg",
jpg: "/jpg_icon.svg",
jpeg: "/jpg_icon.svg",
png: "/png_icon.svg",
gif: "/gif_icon.svg",
};
return iconMap[type] || "/TXT_icon.svg";
};
// 获取对话类型图标
const getChatTypeIcon = (type?: "quick" | "deep"): string => {
if (type === "deep") {
return "fas fa-search"; // 深度检索使用搜索图标
}
return "fas fa-comment-dots"; // 快问快答使用聊天图标
};
// 判断任务是否正在执行
const isRunningTask = (chat: ChatSession): boolean => {
// 只有深度检索任务才可能是正在执行的任务
if (chat.type !== "deep") {
return false;
}
// 比较任务 ID 与当前正在执行的任务 ID
return deerflowStore.currentRunningTaskId === chat.id;
};
// 格式化日期
const formatDate = (dateString: string): string => {
try {
const date = new Date(dateString);
const now = new Date();
const diffTime = Math.abs(now.getTime() - date.getTime());
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// 格式化时间,显示时分秒
const timeStr = date.toLocaleTimeString("zh-CN", {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
hour12: false,
});
if (diffDays === 1) {
return `今天 ${timeStr}`;
} else if (diffDays === 2) {
return `昨天 ${timeStr}`;
} else if (diffDays <= 7) {
return `${diffDays - 1}天前 ${timeStr}`;
} else {
return `${date.toLocaleDateString()} ${timeStr}`;
}
} catch (error) {
return dateString;
}
};
// 处理文档点击事件
const handleDocumentClick = (document: RecentDocument) => {
// 跳转到工作台编辑文件
router.push({
name: "Workspace",
query: {
fileId: document.fileId,
fileName: document.displayName,
extension: document.extension,
folderId: document.folderId,
folderPath: document.folderPath,
},
});
};
// 显示信息认证弹窗的内部逻辑
const showRegisterSuccessCardInternal = async () => {
// 0. 先检查认证状态,如果已通过认证(APPROVED),则不显示弹窗
try {
const response = await apiGetCertificationStatus();
if (response.data?.status === "APPROVED") {
return;
}
} catch (error) {
// 如果接口调用失败,继续显示弹窗(不影响原有逻辑)
console.error("获取认证状态失败:", error);
}
// 1. 检查 localStorage 中是否有"7天内不再提醒"的标记
const dontRemindUntil = localStorage.getItem(
"registerSuccessDontRemindUntil",
);
if (dontRemindUntil) {
const untilDate = new Date(dontRemindUntil);
const now = new Date();
// 如果当前时间还在"不再提醒"的有效期内,则不显示弹窗
if (now < untilDate) {
return;
}
// 如果已过期,清除标记
localStorage.removeItem("registerSuccessDontRemindUntil");
}
// 2. 检查当天是否已经显示过弹窗
const today = new Date().toISOString().split("T")[0]; // 格式: YYYY-MM-DD
const lastShownDate = localStorage.getItem("registerSuccessLastShownDate");
// 如果今天已经显示过,则不显示
if (lastShownDate === today) {
return;
}
// 3. 满足条件,显示弹窗并记录当天日期
// 如果 showReward 为 true,先展示烟花效果
if (showReward.value) {
// 启动烟花特效
if (fireworksRef.value) {
(fireworksRef.value as any).start();
}
// 3秒后显示成功卡片并停止烟花
setTimeout(() => {
nextTick(() => {
showSuccessCard.value = true;
localStorage.setItem("registerSuccessLastShownDate", today as string);
// 停止烟花
if (fireworksRef.value) {
(fireworksRef.value as any).stop();
}
});
}, 3000);
} else {
// 直接显示弹窗
nextTick(() => {
showSuccessCard.value = true;
localStorage.setItem("registerSuccessLastShownDate", today as string);
});
}
};
// 检查是否需要显示信息认证弹窗(登录成功后)
const checkAndShowRegisterSuccessCard = () => {
if (route.query.registerSuccess !== "true") {
return;
}
// 如果同时有 loginSuccess 参数,说明需要先显示反馈弹窗,这里不自动显示认证弹窗
// 认证弹窗会在反馈弹窗关闭后由 handleCloseFeedback/handleSkipFeedback/handleGoToFeedback 触发
if (route.query.loginSuccess === "true") {
return;
}
// 如果没有 loginSuccess 参数,直接显示认证弹窗
// 认证状态检查已在 showRegisterSuccessCardInternal 内部进行
showRegisterSuccessCardInternal();
};
// 处理成功卡片关闭
const handleSuccessCardClose = (dontRemindFor7Days: boolean) => {
// 如果勾选了"7天内不再提醒"
if (dontRemindFor7Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000); // 7天后
localStorage.setItem(
"registerSuccessDontRemindUntil",
untilDate.toISOString(),
);
}
// 记录当天已显示(用户关闭弹窗后,当天不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("registerSuccessLastShownDate", today);
showSuccessCard.value = false;
// 如果正在执行认证跳转,不执行路由清除操作,避免冲突
if (isVerifying.value) {
return;
}
// 清除路由参数
router.replace({ path: route.path, query: {} });
};
// 处理稍后认证
const handleRegisterSuccessLater = (dontRemindFor7Days: boolean) => {
// 如果勾选了"7天内不再提醒"
if (dontRemindFor7Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000); // 7天后
localStorage.setItem(
"registerSuccessDontRemindUntil",
untilDate.toISOString(),
);
}
// 记录当天已显示(即使没有勾选7天,当天也不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("registerSuccessLastShownDate", today);
showSuccessCard.value = false;
// 清除路由参数
router.replace({ path: route.path, query: {} });
};
// 处理立即认证
const handleRegisterSuccessVerify = (dontRemindFor7Days: boolean) => {
// 设置标记,防止 handleSuccessCardClose 执行路由操作
isVerifying.value = true;
// 如果勾选了"7天内不再提醒"
if (dontRemindFor7Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 7 * 24 * 60 * 60 * 1000); // 7天后
localStorage.setItem(
"registerSuccessDontRemindUntil",
untilDate.toISOString(),
);
}
// 记录当天已显示(即使没有勾选7天,当天也不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("registerSuccessLastShownDate", today);
showSuccessCard.value = false;
// 跳转到设置页面的认证标签页
router
.push({
name: "Settings",
query: { tab: "authentication" },
})
.catch((err) => {
if (err.name !== "NavigationDuplicated") {
console.error("Navigation error:", err);
}
})
.finally(() => {
// 跳转完成后重置标记
setTimeout(() => {
isVerifying.value = false;
}, 100);
});
};
onMounted(async () => {
// 加载筛选设置
try {
await settingsStore.fetchSearchSettings();
// 从 store 中获取数据并更新本地 ref
const savedDateRange = settingsStore.getLiteratureDateRange();
const savedQuickTime = settingsStore.getLiteratureQuickTime();
const savedFilters = settingsStore.getLiteratureFilters();
if (savedDateRange) {
literatureDateRange.value = savedDateRange;
}
if (savedQuickTime) {
literatureQuickTime.value = savedQuickTime;
}
// 使用默认配置作为基础,只从保存的数据中获取 selected 值
const defaultFilters = createDefaultLiteratureFilters();
if (savedFilters && savedFilters.length > 0) {
// 遍历默认配置,从保存的数据中匹配 key,只更新 selected 字段
// 并验证 selected 值是否在 options 中存在
literatureFilters.value = defaultFilters.map((defaultFilter) => {
const savedFilter = savedFilters.find(
(f) => f.key === defaultFilter.key,
);
return {
...defaultFilter,
selected: validateAndFilterSelected(
defaultFilter,
savedFilter?.selected,
),
};
});
} else {
literatureFilters.value = defaultFilters;
}
// 同步更新深度检索配置的本地 ref 值
maxPlanIterations.value = settingsStore.maxPlanIterations;
maxStepNum.value = settingsStore.maxStepNum;
maxSearchResults.value = settingsStore.maxSearchResults;
deepSearchMode.value = normalizeDeepSearchMode(
settingsStore.getDeepSearchMode(),
);
await syncDataSourceByDeepSearchMode(false);
} catch (error) {
console.error("加载检索设置失败:", error);
}
// 加载最近访问的文档
loadRecentDocuments();
// 初始化时同时加载百川和深度检索的历史对话数据
await loadHistoryChatSessions();
// 检查是否需要显示反馈弹窗(登录成功后)
checkAndShowFeedbackDialog();
// 检查是否需要显示信息认证弹窗(登录成功后)
checkAndShowRegisterSuccessCard();
// 检查是否需要显示会员失效提示弹窗(登录成功后)
await checkAndShowMemberExpireDialog();
// 检查是否需要显示领医豆余额提醒弹窗(登录成功后)
// 先通过 payStore 拉取一次余额,再根据余额决定是否弹窗
await payStore.fetchBeansBalance();
await checkAndShowBeansBalanceDialog();
// 检查用户手机号并显示绑定弹窗(如果需要)
await checkAndShowBindPhoneDialog();
// 初始化时获取服务价格
await fetchServicePrice();
});
// 发送绑定验证码
const sendBindSmsCode = async () => {
if (!bindPhoneForm.value.phoneNumber?.trim()) {
ElMessage.warning("请输入手机号");
return;
}
// 验证手机号格式
const phoneRegex = /^1[3-9]\d{9}$/;
if (!phoneRegex.test(bindPhoneForm.value.phoneNumber.trim())) {
ElMessage.warning("请输入正确的手机号");
return;
}
try {
bindPhoneLoading.value = true;
await apiSendBindSms(bindPhoneForm.value.phoneNumber.trim());
ElMessage.success("验证码已发送");
// 开始倒计时
smsCodeCountdown.value = 60;
if (smsCodeTimer.value) {
clearInterval(smsCodeTimer.value);
}
smsCodeTimer.value = window.setInterval(() => {
smsCodeCountdown.value--;
if (smsCodeCountdown.value <= 0) {
if (smsCodeTimer.value) {
clearInterval(smsCodeTimer.value);
smsCodeTimer.value = null;
}
}
}, 1000);
} catch (error: any) {
console.error("发送验证码失败:", error);
ElMessage.error(error?.response?.data?.message || "发送验证码失败");
} finally {
bindPhoneLoading.value = false;
}
};
// 提交绑定手机号
const submitBindPhone = async () => {
if (!bindPhoneForm.value.phoneNumber?.trim()) {
ElMessage.warning("请输入手机号");
return;
}
// 验证手机号格式
const phoneRegex = /^1[3-9]\d{9}$/;
if (!phoneRegex.test(bindPhoneForm.value.phoneNumber.trim())) {
ElMessage.warning("请输入正确的手机号");
return;
}
if (!bindPhoneForm.value.smsCode?.trim()) {
ElMessage.warning("请输入验证码");
return;
}
try {
bindPhoneLoading.value = true;
await apiBindPhone({
phoneNumber: bindPhoneForm.value.phoneNumber.trim(),
smsCode: bindPhoneForm.value.smsCode.trim(),
userId: userId.value || undefined,
});
ElMessage.success("手机号绑定成功");
bindPhoneDialogVisible.value = false;
// 清除表单和定时器
bindPhoneForm.value = {
phoneNumber: "",
smsCode: "",
};
if (smsCodeTimer.value) {
clearInterval(smsCodeTimer.value);
smsCodeTimer.value = null;
}
smsCodeCountdown.value = 0;
} catch (error: any) {
console.error("绑定手机号失败:", error);
ElMessage.error(error?.response?.data?.message || "绑定手机号失败");
} finally {
bindPhoneLoading.value = false;
}
};
// 检查是否需要显示反馈弹窗
const checkAndShowFeedbackDialog = () => {
// 检查是否是登录成功后的跳转
if (route.query.loginSuccess !== "true") {
return;
}
// 1. 检查 localStorage 中是否有"30天内不再提醒"的标记
const dontRemindUntil = localStorage.getItem("feedbackDontRemindUntil");
if (dontRemindUntil) {
const untilDate = new Date(dontRemindUntil);
const now = new Date();
// 如果当前时间还在"不再提醒"的有效期内,则不显示弹窗
if (now < untilDate) {
return;
}
// 如果已过期,清除标记
localStorage.removeItem("feedbackDontRemindUntil");
}
// 2. 检查当天是否已经显示过弹窗
const today = new Date().toISOString().split("T")[0]; // 格式: YYYY-MM-DD
const lastShownDate = localStorage.getItem("feedbackDialogLastShownDate");
// 如果今天已经显示过,则不显示
if (lastShownDate === today) {
return;
}
// 3. 满足条件,显示弹窗并记录当天日期
nextTick(() => {
feedbackDialogVisible.value = true;
localStorage.setItem("feedbackDialogLastShownDate", today as string);
});
};
// 检查并显示会员失效提示弹窗(仅在登录成功后显示)
const checkAndShowMemberExpireDialog = async () => {
// 仅在登录成功跳转到欢迎页时展示
if (route.query.loginSuccess !== "true") {
return;
}
// 如果之前勾选了“不再提醒”,则直接不再弹窗
const neverRemind = localStorage.getItem("memberExpireDialogNeverRemind") as
| "true"
| "false"
| null;
if (neverRemind === "true") {
return;
}
// memberExpireDialogTitle.value = `你的金卡会员已失效`;
// memberExpireDialogDescription.value = `温馨提醒:你的金卡会员权益已失效,将无法继续享受会员专属特权。`;
// memberExpireDialogVisible.value = true;
// 每天只提醒一次
const today = new Date().toISOString().split("T")[0] as string;
const lastShownDate = localStorage.getItem("memberExpireDialogLastShownDate");
if (lastShownDate === today) {
return;
}
try {
const [expireRes, memberTypeRes] = await Promise.all([
getCurrentUserMemberExpireTime(),
getCurrentUserMemberType().catch(() => null),
]);
const expireTime = expireRes.data;
if (!expireTime) return;
const now = new Date();
const expireDate = new Date(expireTime);
if (Number.isNaN(expireDate.getTime())) return;
const diffMs = expireDate.getTime() - now.getTime();
const oneDayMs = 1000 * 60 * 60 * 24;
const diffDays = Math.ceil(diffMs / oneDayMs);
const memberName =
memberTypeRes?.data?.memberName ||
(memberTypeRes?.data?.memberCode === "gold" ? "金卡" : "白金卡");
if (diffMs <= 0) {
// 已失效
memberExpireDialogTitle.value = `你的${memberName}会员已失效`;
memberExpireDialogDescription.value = `温馨提醒:你的${memberName}会员权益已失效,将无法继续享受会员专属特权。`;
} else if (diffDays <= 7) {
// 3 天内即将失效
memberExpireDialogTitle.value = `你的${memberName}会员即将失效`;
memberExpireDialogDescription.value = `温馨提醒:你的${memberName}会员权益将于${diffDays}天后失效,将无法继续享受会员专属特权。`;
} else {
// 距离到期时间较长,不提醒
return;
}
memberExpireDialogVisible.value = true;
localStorage.setItem("memberExpireDialogLastShownDate", today);
} catch (error) {
console.error("检查会员失效状态失败:", error);
}
};
// 处理会员失效弹窗“暂不充值”
const handleMemberExpireCancel = (dontRemind?: boolean) => {
if (dontRemind) {
localStorage.setItem("memberExpireDialogNeverRemind", "true");
}
memberExpireDialogVisible.value = false;
};
// 处理会员失效弹窗"立即充值"
const handleMemberExpireRecharge = (dontRemind?: boolean) => {
if (dontRemind) {
localStorage.setItem("memberExpireDialogNeverRemind", "true");
}
memberExpireDialogVisible.value = false;
router
.push({
name: "Settings",
query: { tab: "membersRecords" },
})
.catch((err) => {
if (err.name !== "NavigationDuplicated") {
console.error("Navigation error:", err);
}
});
};
// 检查并显示领医豆余额提醒弹窗(仅在登录成功后显示)
const checkAndShowBeansBalanceDialog = async () => {
// 仅在登录成功跳转到欢迎页时展示
if (route.query.loginSuccess !== "true") {
return;
}
// 如果之前勾选了"不再提醒",则直接不再弹窗
const neverRemind = localStorage.getItem("beansBalanceDialogNeverRemind") as
| "true"
| "false"
| null;
if (neverRemind === "true") {
return;
}
// beansBalance.value = 700;
// beansBalanceDialogVisible.value = true;
// 每天只提醒一次
const today = new Date().toISOString().split("T")[0] as string;
const lastShownDate = localStorage.getItem("beansBalanceDialogLastShownDate");
if (lastShownDate === today) {
return;
}
try {
// 此处不再直接调用接口,而是复用全局 payStore 中已获取的余额
const balance = payStore.beansBalance ?? 0;
// 如果余额小于20,则显示弹窗
if (balance < 20) {
beansBalance.value = balance;
beansBalanceDialogVisible.value = true;
localStorage.setItem("beansBalanceDialogLastShownDate", today);
}
} catch (error) {
console.error("查询领医豆余额失败:", error);
}
};
// 处理领医豆余额弹窗"暂不充值"
const handleBeansBalanceCancel = (dontRemind?: boolean) => {
if (dontRemind) {
localStorage.setItem("beansBalanceDialogNeverRemind", "true");
}
beansBalanceDialogVisible.value = false;
};
// 处理领医豆余额弹窗"立即充值"
const handleBeansBalanceRecharge = (dontRemind?: boolean) => {
if (dontRemind) {
localStorage.setItem("beansBalanceDialogNeverRemind", "true");
}
beansBalanceDialogVisible.value = false;
router
.push({
name: "Settings",
query: { tab: "membersRecords" },
})
.catch((err) => {
if (err.name !== "NavigationDuplicated") {
console.error("Navigation error:", err);
}
});
};
// 处理关闭反馈弹窗
const handleCloseFeedback = (dontRemindFor30Days: boolean) => {
// 如果勾选了"30天内不再提醒"
if (dontRemindFor30Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000); // 30天后
localStorage.setItem("feedbackDontRemindUntil", untilDate.toISOString());
}
// 记录当天已显示(用户关闭弹窗后,当天不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("feedbackDialogLastShownDate", today);
// 清除路由参数
feedbackDialogVisible.value = false;
// 如果路由中有 registerSuccess 参数,关闭反馈弹窗后显示认证弹窗
if (route.query.registerSuccess === "true") {
// 延迟一下,确保反馈弹窗完全关闭后再显示认证弹窗
nextTick(() => {
setTimeout(() => {
showRegisterSuccessCardInternal();
}, 300);
});
// 清除 loginSuccess 参数,但保留 registerSuccess 参数,等认证弹窗关闭后再清除
router.replace({
path: route.path || "/",
query: {
registerSuccess: "true",
showReward: route.query.showReward || "false",
},
});
} else {
router.replace({ path: route.path || "/", query: {} });
}
};
// 处理跳过反馈
const handleSkipFeedback = (dontRemindFor30Days: boolean) => {
// 如果勾选了"30天内不再提醒"
if (dontRemindFor30Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000); // 30天后
localStorage.setItem("feedbackDontRemindUntil", untilDate.toISOString());
}
// 记录当天已显示(即使没有勾选30天,当天也不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("feedbackDialogLastShownDate", today);
// 如果路由中有 registerSuccess 参数,关闭反馈弹窗后显示认证弹窗
if (route.query.registerSuccess === "true") {
feedbackDialogVisible.value = false;
// 延迟一下,确保反馈弹窗完全关闭后再显示认证弹窗
nextTick(() => {
setTimeout(() => {
showRegisterSuccessCardInternal();
}, 300);
});
// 清除 loginSuccess 参数,但保留 registerSuccess 参数,等认证弹窗关闭后再清除
router.replace({
path: route.path || "/",
query: {
registerSuccess: "true",
showReward: route.query.showReward || "false",
},
});
} else {
feedbackDialogVisible.value = false;
router.replace({ path: route.path || "/", query: {} });
}
};
// 处理立即反馈
const handleGoToFeedback = (dontRemindFor30Days: boolean) => {
// 如果勾选了"30天内不再提醒"
if (dontRemindFor30Days) {
const now = new Date();
const untilDate = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000); // 30天后
localStorage.setItem("feedbackDontRemindUntil", untilDate.toISOString());
}
// 记录当天已显示(即使没有勾选30天,当天也不再显示)
const today = new Date().toISOString().split("T")[0] as string;
localStorage.setItem("feedbackDialogLastShownDate", today);
// 如果路由中有 registerSuccess 参数,关闭反馈弹窗后显示认证弹窗
if (route.query.registerSuccess === "true") {
feedbackDialogVisible.value = false;
// 延迟一下,确保反馈弹窗完全关闭后再显示认证弹窗
nextTick(() => {
setTimeout(() => {
showRegisterSuccessCardInternal();
}, 300);
});
// 清除 loginSuccess 参数,但保留 registerSuccess 参数,等认证弹窗关闭后再清除
router.replace({
path: route.path || "/",
query: {
registerSuccess: "true",
showReward: route.query.showReward || "false",
},
});
} else {
feedbackDialogVisible.value = false;
router.replace({ path: route.path || "/", query: {} });
}
// TODO: 这里可以跳转到反馈页面或打开反馈表单
// 例如:router.push('/feedback') 或打开反馈表单弹窗
};
// 检查并显示绑定手机号弹窗
const checkAndShowBindPhoneDialog = async () => {
try {
// 直接请求接口获取用户信息
const userProfile = await getUserProfile();
// 检查 phoneNumber 是否为空(可能是 undefined、null 或空字符串)
if (userProfile?.phoneNumber) {
// 手机号已绑定,不需要显示弹窗
return;
}
userId.value = userProfile.id || null;
// 手机号为空,显示强制绑定弹窗
bindPhoneForm.value = {
phoneNumber: "",
smsCode: "",
};
bindPhoneDialogVisible.value = true;
} catch (error) {
console.error("获取用户信息失败:", error);
// 如果获取用户信息失败,不显示弹窗,避免影响正常使用
}
};
// 组件销毁时清除当前运行任务ID和定时器
onUnmounted(() => {
// 清除当前运行任务ID
deerflowStore.setCurrentRunningTaskId(null);
// 清除验证码倒计时定时器
if (smsCodeTimer.value) {
clearInterval(smsCodeTimer.value);
smsCodeTimer.value = null;
}
});
// 监听模型选择变化,同步到 chatApiStore
watch(selectedModel, (newModel) => {
chatApiStore.setSelectedModel(newModel);
});
// 监听当前运行任务ID变化,自动刷新深度检索历史列表
watch(
() => deerflowStore.currentRunningTaskId,
async (newTaskId, oldTaskId) => {
// 当任务ID变化时(包括从null变为有值,或从有值变为null),只重新加载深度检索历史列表
if (newTaskId !== oldTaskId) {
const deepSearchChats = await loadDeepSearchHistory();
// 获取当前的百川记录
const baichuanChats = historyChatSessions.value.filter(
(chat) => chat.provider === "baichuan",
);
// 合并并更新历史对话列表
const allChats = [...baichuanChats, ...deepSearchChats];
// 按时间降序排序
allChats.sort((a, b) => {
const timeA = new Date(a.createdAt).getTime();
const timeB = new Date(b.createdAt).getTime();
return timeB - timeA;
});
historyChatSessions.value = allChats;
}
},
);
</script>
<style lang="scss" scoped>
.welcome-page {
display: flex;
flex-direction: column;
height: 100vh;
width: 100%;
background: var(--color-bg, #141518);
color: var(--color-text, #eee);
overflow: hidden;
}
/* 欢迎界面样式 */
.welcome-interface {
display: flex;
flex-direction: row;
height: 100vh;
width: 100%;
overflow: hidden;
}
/* 左侧边栏样式 - 参考 Workspace.vue */
.welcome-sidebar {
width: 250px;
height: 100vh;
display: flex;
// display: none;
flex-direction: column;
background-color: var(--color-card);
border-right: 1px solid var(--color-border);
color: var(--outline-text, #222);
transition: all 0.3s ease;
flex: 0 0 250px;
min-width: 45px;
&.collapsed {
width: 54px;
min-width: 54px;
flex: 0 0 54px;
overflow: hidden;
.sidebar-header {
flex-direction: column;
height: 100%;
padding: 0;
gap: 0;
border-bottom: none;
align-items: center;
justify-content: flex-start;
background: transparent !important;
.sidebar-toggle {
width: 32px;
height: 31px;
margin: 5px 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: all 0.2s;
order: -2;
&:hover {
background: rgba(0, 0, 0, 0.05);
}
}
.collapsed-divider {
width: 100%;
height: 1px;
background-color: var(--color-border, #333);
order: -1;
}
.collapsed-tab-switcher {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
box-sizing: border-box;
padding-top: 12px;
.sidebar-tab-btn {
width: 32px;
height: 32px;
background: none;
border: none;
cursor: pointer;
padding: 6px;
border-radius: 4px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
&:hover {
background: rgba(0, 0, 0, 0.05);
border: none;
}
&.active {
background: #1e70ff;
color: #fff;
box-shadow: 0 2px 4px rgba(24, 144, 255, 0.3);
border: none;
i {
color: #fff;
}
}
i {
font-size: 16px;
color: var(--color-secondary, #666);
}
}
}
}
}
}
.sidebar-header {
display: flex;
align-items: center;
gap: 6px;
padding: 6px 4px 6px 12px;
flex-shrink: 0;
background: var(--color-card, #f5f5f5);
border-bottom: 1px solid var(--color-border, #e0e0e0);
.sidebar-tab-switcher {
flex: 1;
display: flex;
gap: 4px;
}
.sidebar-tab-btn {
display: flex;
align-items: center;
justify-content: center;
min-width: 32px;
height: 32px;
padding: 4px 6px;
background: var(--color-bg);
border: 1px solid var(--color-border, #e0e0e0);
cursor: pointer;
transition: all 0.2s;
color: var(--outline-text, #666);
font-size: 12px;
border-radius: 4px;
white-space: nowrap;
user-select: none;
i {
font-size: 16px;
line-height: 1;
color: var(--color-secondary, #666);
transition: color 0.2s;
flex-shrink: 0;
}
&:hover {
background: rgba(0, 0, 0, 0.02);
border-color: rgba(24, 144, 255, 0.3);
i {
color: var(--color-text, #333);
}
}
&.active {
background: #1e70ff;
color: #fff;
font-weight: 500;
border-color: #1e70ff;
box-shadow: 0 2px 4px rgba(24, 144, 255, 0.3);
i {
color: #fff;
}
}
}
.sidebar-toggle {
background: none;
border: none;
cursor: pointer;
padding: 6px;
border-radius: 4px;
transition: all 0.2s;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
&:hover {
background: rgba(0, 0, 0, 0.05);
}
}
.icon-svg-shouqi {
width: 16px;
height: 16px;
object-fit: contain;
flex-shrink: 0;
transition: filter 0.2s ease;
}
}
.sidebar-content-inner {
flex: 1;
overflow-y: auto;
padding: 8px;
scrollbar-width: thin;
scrollbar-color: var(--color-border, #333) transparent;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--color-border, #333);
border-radius: 3px;
&:hover {
background: var(--color-text-secondary, #666);
}
}
}
.sidebar-tab-content {
flex: 1;
overflow-y: auto;
}
.sidebar-section {
margin-bottom: 20px;
.section-title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
font-weight: 600;
color: var(--color-text-secondary, #999);
padding: 8px 12px;
text-transform: uppercase;
letter-spacing: 0.5px;
.section-actions {
font-size: 14px;
cursor: pointer;
opacity: 0.6;
transition: opacity 0.2s;
&:hover {
opacity: 1;
}
}
}
.menu-items {
display: flex;
flex-direction: column;
gap: 2px;
}
.menu-item {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 4px;
border-radius: 6px;
cursor: pointer;
transition: all 0.2s;
color: var(--color-text, #333);
font-size: 14px;
position: relative;
i {
font-size: 14px;
color: var(--color-text-secondary, #666);
width: 16px;
text-align: center;
flex-shrink: 0;
}
.menu-icon {
width: 16px;
height: 16px;
object-fit: contain;
flex-shrink: 0;
opacity: 0.8;
}
span {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
&:hover {
background: var(--color-hover, rgba(0, 0, 0, 0.05));
}
&.expand-more {
color: var(--color-text-secondary, #666);
font-size: 13px;
}
&.history-item {
justify-content: space-between;
.menu-item-left {
display: flex;
align-items: center;
gap: 10px;
flex: 1;
cursor: pointer;
}
.history-item-left {
display: flex;
align-items: center;
gap: 10px;
flex: 1;
cursor: pointer;
}
.history-item-actions {
display: flex;
align-items: center;
gap: 8px;
}
.view-all-btn {
font-size: 12px;
color: #1e70ff;
cursor: pointer;
padding: 2px 8px;
border-radius: 4px;
transition: all 0.2s;
user-select: none;
white-space: nowrap;
&:hover {
background: rgba(24, 144, 255, 0.1);
color: #1e70ff;
}
}
.toggle-icon {
font-size: 12px;
color: var(--color-text-secondary, #999);
transition: transform 0.2s ease;
cursor: pointer;
padding: 4px;
&:hover {
color: var(--color-text, #333);
}
}
}
}
// 历史记录内容样式
.history-content {
margin-left: 0;
padding-left: 0;
overflow: hidden;
}
.scheduled-task-content {
.scheduled-task-actions {
display: flex;
flex-direction: column;
gap: 12px;
.form-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 4px;
.form-label {
font-size: 13px;
color: var(--color-text, #333);
text-align: right;
flex-shrink: 0;
}
.form-content {
flex: 1;
display: flex;
align-items: center;
max-width: 160px;
.start-time-wrapper,
.repeat-wrapper {
width: 100%;
display: flex;
flex-direction: column;
gap: 8px;
}
.start-time-wrapper :deep(.el-date-editor) {
width: 100%;
}
}
}
}
.ends-on-wrapper {
display: flex;
align-items: center;
gap: 8px;
}
.ends-on-picker {
flex: 1;
}
.form-select {
width: 100%;
}
}
.empty-history {
padding: 12px 12px 12px 38px;
.empty-text {
font-size: 12px;
color: var(--color-text-secondary, #999);
}
}
.history-list {
display: flex;
flex-direction: column;
gap: 2px;
}
.history-item-row {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 4px;
cursor: pointer;
transition: all 0.2s;
border-radius: 4px;
position: relative;
&:hover {
background: var(--color-hover, rgba(0, 0, 0, 0.05));
.delete-icon-small {
opacity: 1;
}
}
// 正在执行的任务样式
&.running-task {
background: rgba(24, 144, 255, 0.05);
.file-name-compact {
color: var(--color-text);
font-weight: 500;
}
.running-icon {
color: #1890ff !important;
}
}
// 选中的任务样式
&.selected {
background: rgba(24, 144, 255, 0.1);
border: 1px solid #1890ff;
border-radius: 4px;
.file-name-compact {
color: #1890ff;
font-weight: 500;
}
}
// 禁用状态样式
&.disabled {
pointer-events: none;
&:hover {
background: rgba(24, 144, 255, 0.1);
cursor: not-allowed;
}
}
}
.file-icon-small {
width: 14px;
height: 14px;
object-fit: contain;
flex-shrink: 0;
}
.chat-type-icon {
width: 14px;
height: 14px;
font-size: 14px;
color: var(--color-text-secondary, #999);
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
transition: color 0.2s;
&.fa-search {
color: #722ed1; // 深度检索使用紫色
}
&.fa-comment-dots {
color: #1890ff; // 快问快答使用蓝色
}
&.status-icon {
object-fit: contain;
opacity: 0.9;
&:hover {
opacity: 1;
}
}
}
.history-item-row:hover .chat-type-icon {
color: var(--color-text, #333);
&.fa-search {
color: #9254de;
}
&.fa-comment-dots {
color: #40a9ff;
}
}
.file-info-compact {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}
.file-name-compact {
font-size: 12px;
color: var(--color-text, #333);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-date-compact {
font-size: 10px;
color: var(--color-text-secondary, #999);
}
.delete-icon-small {
width: 14px;
height: 14px;
cursor: pointer;
opacity: 0;
transition:
opacity 0.2s,
filter 0.2s,
transform 0.2s;
flex-shrink: 0;
filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%)
hue-rotate(93deg) brightness(50%) contrast(107%);
&:hover {
filter: brightness(0) saturate(100%) invert(100%) sepia(0%) saturate(0%)
hue-rotate(93deg) brightness(50%) contrast(107%);
transform: scale(1.1);
}
}
// 配置内容样式
.config-content {
padding: 0 4px;
display: flex;
flex-direction: column;
}
}
</style>
<style lang="scss">
// 树节点自定义样式
.custom-tree-node {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
i {
color: #1e6fff; // 文件夹图标颜色
}
}
// 知识库弹窗样式 (非 scoped 以匹配 append-to-body 的弹窗)
.kb-folder-dialog {
.el-dialog__body {
padding: 0;
}
.kb-dialog-body {
height: 400px;
border-top: 1px solid var(--color-border-light, #ebeef5);
border-bottom: 1px solid var(--color-border-light, #ebeef5);
}
.kb-dialog-layout {
display: flex;
height: 100%;
.kb-tree-side {
width: 250px;
border-right: 1px solid var(--color-border-light, #ebeef5);
padding: 12px;
overflow-y: auto;
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
overflow: hidden;
i {
color: #1e6fff;
font-size: 14px;
min-width: 14px;
}
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
.kb-files-side {
flex: 1;
display: flex;
flex-direction: column;
padding: 12px;
background: var(--color-bg-light, #f8f9fa);
min-width: 0;
.side-header {
font-size: 13px;
font-weight: 600;
margin-bottom: 12px;
color: var(--color-text, #333);
display: flex;
justify-content: space-between;
align-items: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
.file-count {
font-weight: normal;
color: var(--color-text-placeholder, #999);
margin-left: 8px;
flex-shrink: 0;
}
}
.kb-file-preview-list {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 4px;
.preview-item {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 10px;
background: #fff;
border-radius: 4px;
border: 1px solid var(--color-border-light, #ebeef5);
.file-icon {
width: 16px !important;
height: 16px !important;
min-width: 16px;
min-height: 16px;
object-fit: contain;
&.is-loading {
animation: rotating 2s linear infinite;
color: var(--el-color-primary);
}
}
.file-name {
flex: 1;
font-size: 12px;
color: var(--color-text, #333);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.status-tag {
flex-shrink: 0;
margin-left: 4px;
height: 20px;
line-height: 18px;
padding: 0 6px;
font-size: 11px;
}
}
.empty-tip {
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-text-placeholder, #999);
font-size: 13px;
}
}
}
}
}
</style>
<style lang="scss" scoped>
.literature-config-content {
display: flex;
flex-direction: column;
max-height: 500px;
overflow-y: auto;
padding: 0 4px;
scrollbar-width: thin;
scrollbar-color: var(--color-border, #333) transparent;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&::-webkit-scrollbar-thumb {
background: var(--color-border, #333);
border-radius: 3px;
&:hover {
background: var(--color-text-secondary, #666);
}
}
}
.config-group {
display: flex;
flex-direction: column;
gap: 8px;
padding: 8px 0;
&.kb-section {
.kb-selector {
width: 100%;
height: 32px;
border: 1px solid var(--color-border, #dcdfe6);
border-radius: 4px;
padding: 0 12px;
display: flex;
align-items: center;
cursor: pointer;
font-size: 13px;
color: var(--color-text, #333);
margin-bottom: 4px;
background: var(--color-bg, #fff);
transition: all 0.2s;
overflow: hidden;
gap: 8px;
.kb-icon-left {
color: #1e6fff;
font-size: 14px;
}
.kb-icon-right {
color: var(--color-text-placeholder, #c0c4cc);
font-size: 12px;
}
span {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
}
&:hover {
border-color: var(--color-primary, #1890ff);
}
}
.kb-path-display {
font-size: 11px;
color: var(--color-text-secondary, #666);
margin-bottom: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
padding: 0 2px;
}
.kb-note {
font-size: 11px;
color: var(--color-text-placeholder, #999);
line-height: 1.4;
margin-bottom: 8px;
padding: 0 2px;
}
.kb-file-list {
max-height: 150px;
overflow-y: auto;
border: 1px solid var(--color-border, #dcdfe6);
border-radius: 4px;
background: var(--color-bg-light, #f5f7fa);
&::-webkit-scrollbar {
width: 4px;
}
.kb-file-item {
display: flex;
align-items: center;
padding: 6px 10px;
gap: 6px;
font-size: 12px;
border-bottom: 1px solid var(--color-border-light, #ebeef5);
&:last-child {
border-bottom: none;
}
.kb-file-icon {
width: 14px;
height: 14px;
flex-shrink: 0;
}
.kb-file-name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.remove-icon {
cursor: pointer;
font-size: 11px;
color: var(--color-text-placeholder, #c0c4cc);
padding: 2px;
&:hover {
color: var(--color-danger, #f56c6c);
}
}
}
}
}
}
.config-group-title {
font-size: 12px;
font-weight: 600;
color: var(--color-text, #333);
margin-bottom: 4px;
}
// 复选框组
.checkbox-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.checkbox-item {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-size: 12px;
color: var(--color-text, #333);
padding: 4px 0;
user-select: none;
input[type="checkbox"] {
width: 14px;
height: 14px;
cursor: pointer;
accent-color: #1890ff;
flex-shrink: 0;
}
span {
flex: 1;
}
&:hover {
color: #1890ff;
}
}
// 单选框组
.radio-group {
display: flex;
flex-direction: column;
gap: 6px;
}
.radio-item {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
font-size: 12px;
color: var(--color-text, #333);
padding: 4px 0;
user-select: none;
input[type="radio"] {
width: 14px;
height: 14px;
cursor: pointer;
accent-color: #1890ff;
flex-shrink: 0;
}
span {
flex: 1;
}
&:hover {
color: #1890ff;
}
}
// 按钮组(分区按钮)
.button-group {
display: flex;
gap: 8px;
flex-wrap: wrap;
}
.search-mode-select-wrap {
width: 100%;
}
.search-mode-select {
width: 100%;
}
.zone-btn {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 6px 14px;
border: 1px solid var(--color-border, #ddd);
border-radius: 4px;
background: var(--color-bg, #fff);
color: var(--color-text, #333);
font-size: 12px;
cursor: pointer;
transition: all 0.2s;
outline: none;
user-select: none;
white-space: nowrap;
&:hover {
border-color: #1890ff;
color: #1890ff;
background: rgba(24, 144, 255, 0.05);
}
&:active,
&.active {
border-color: #1890ff;
color: #1890ff;
background: rgba(24, 144, 255, 0.05);
}
&.disabled {
cursor: not-allowed;
opacity: 0.75;
pointer-events: none;
}
}
.data-source-note {
margin-top: 8px;
font-size: 12px;
line-height: 1.6;
color: var(--color-text-secondary, #666);
p {
margin: 4px 0;
}
}
.separator {
font-size: 12px;
color: var(--color-text-secondary, #999);
}
.config-item {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
padding: 6px 0;
&.scheduled-task-item {
.scheduled-task-actions {
display: flex;
align-items: center;
gap: 8px;
flex-shrink: 0;
.expanded-icon {
width: 22px;
height: 22px;
cursor: pointer;
padding: 2px;
transition: all 0.2s;
opacity: 0.6;
object-fit: contain;
display: block;
flex-shrink: 0;
&:hover {
opacity: 1;
}
}
}
}
}
.config-label {
font-size: 12px;
color: var(--color-text, #333);
flex: 1;
}
.config-select,
.config-input {
padding: 4px 8px;
border: 1px solid var(--color-border, #ddd);
border-radius: 4px;
background: var(--color-bg, #fff);
color: var(--color-text, #333);
font-size: 12px;
outline: none;
transition: border-color 0.2s;
&:focus {
border-color: #1890ff;
}
}
.config-input {
width: 60px;
text-align: center;
}
.config-select {
min-width: 100px;
}
.config-slider {
flex: 1;
height: 4px;
border-radius: 2px;
background: var(--color-border, #ddd);
outline: none;
-webkit-appearance: none;
appearance: none;
&::-webkit-slider-thumb {
-webkit-appearance: none;
appearance: none;
width: 14px;
height: 14px;
border-radius: 50%;
background: #1890ff;
cursor: pointer;
transition: all 0.2s;
&:hover {
transform: scale(1.2);
}
}
&::-moz-range-thumb {
width: 14px;
height: 14px;
border: none;
border-radius: 50%;
background: #1890ff;
cursor: pointer;
transition: all 0.2s;
&:hover {
transform: scale(1.2);
}
}
}
// 开关样式
.switch {
position: relative;
display: inline-block;
width: 36px;
height: 20px;
flex-shrink: 0;
input {
opacity: 0;
width: 0;
height: 0;
}
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: 0.3s;
border-radius: 20px;
&:before {
position: absolute;
content: "";
height: 14px;
width: 14px;
left: 3px;
bottom: 3px;
background-color: white;
transition: 0.3s;
border-radius: 50%;
}
}
input:checked + .slider {
background-color: #1890ff;
}
input:checked + .slider:before {
transform: translateX(16px);
}
input:focus + .slider {
box-shadow: 0 0 1px #1890ff;
}
}
/* 聊天界面样式 */
.chat-interface {
display: flex;
flex-direction: row;
height: 100vh;
flex: 1; /* 使用 flex: 1 代替 width: 100% */
min-width: 0; /* 允许收缩 */
position: relative;
overflow: hidden; /* 确保内容不溢出 */
}
/* 深色主题适配 */
:root.theme-dark {
.sidebar-header {
background: var(--color-bg, #1a1a1a);
border-bottom: 1px solid var(--color-border, #333);
.sidebar-tab-btn {
background: var(--color-bg);
border: 1px solid var(--color-border, #444);
color: var(--color-text, #aaa);
i {
color: var(--color-secondary, #888);
}
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(24, 144, 255, 0.5);
i {
color: var(--color-text, #aaa);
}
}
&.active {
background: #1e70ff;
color: #fff;
border-color: #1e70ff;
i {
color: #fff;
}
}
}
.sidebar-toggle:hover {
background: rgba(255, 255, 255, 0.1);
}
}
.sidebar-section {
.section-title {
color: var(--color-text-secondary, #888);
}
.menu-item {
color: var(--color-text, #ccc);
i {
color: var(--color-text-secondary, #888);
}
&:hover {
background: var(--color-hover, rgba(255, 255, 255, 0.05));
}
&.expand-more {
color: var(--color-text-secondary, #888);
}
&.history-item {
.view-all-btn {
color: #1890ff;
&:hover {
background: rgba(24, 144, 255, 0.15);
color: #40a9ff;
}
}
.toggle-icon {
color: var(--color-text-secondary, #888);
&:hover {
color: var(--color-text, #ccc);
}
}
}
}
.history-item-row {
&:hover {
background: var(--color-hover, rgba(255, 255, 255, 0.05));
}
// 深色主题下的正在执行任务样式
&.running-task {
background: rgba(24, 144, 255, 0.15);
.file-name-compact {
color: #69c0ff;
font-weight: 500;
}
.running-icon {
color: #69c0ff !important;
}
}
// 深色主题下的选中任务样式
&.selected {
background: rgba(24, 144, 255, 0.2);
border: 1px solid #1890ff;
border-radius: 4px;
.file-name-compact {
color: #69c0ff;
font-weight: 500;
}
}
}
.chat-type-icon {
color: var(--color-text-secondary, #888);
&.fa-search {
color: #b37feb; // 深度检索使用浅紫色(深色主题)
}
&.fa-comment-dots {
color: #69c0ff; // 快问快答使用浅蓝色(深色主题)
}
}
.history-item-row:hover .chat-type-icon {
&.fa-search {
color: #d3adf7;
}
&.fa-comment-dots {
color: #91d5ff;
}
}
.file-name-compact {
color: var(--color-text, #ccc);
}
.file-date-compact {
color: var(--color-text-secondary, #888);
}
.empty-text {
color: var(--color-text-secondary, #888);
}
}
// 深色主题下的配置项样式
.config-group {
border-bottom-color: var(--color-border, rgba(255, 255, 255, 0.1));
}
.config-group-title {
color: var(--color-text, #ccc);
}
.checkbox-item,
.radio-item {
color: var(--color-text, #ccc);
&:hover {
color: #1890ff;
}
}
.zone-btn {
background: var(--color-bg, #1a1a1a);
border-color: var(--color-border, #444);
color: var(--color-text, #ccc);
&:hover {
border-color: #1890ff;
color: #1890ff;
background: rgba(24, 144, 255, 0.1);
}
&:active,
&.active {
border-color: #1890ff;
background: #1890ff;
color: #fff;
}
&.disabled {
cursor: not-allowed;
opacity: 0.75;
pointer-events: none;
}
}
.data-source-note {
color: var(--color-text-secondary, #999);
}
.separator {
color: var(--color-text-secondary, #666);
}
.config-label {
color: var(--color-text, #ccc);
}
.scheduled-task-item {
.scheduled-task-actions {
.expanded-icon {
opacity: 0.6;
&:hover {
opacity: 1;
}
}
}
}
.config-select,
.config-input {
background: var(--color-bg, #1a1a1a);
border-color: var(--color-border, #444);
color: var(--color-text, #ccc);
&:focus {
border-color: #1890ff;
}
}
.config-slider {
background: var(--color-border, #555);
&::-webkit-slider-thumb {
background: #40a9ff;
}
&::-moz-range-thumb {
background: #40a9ff;
}
}
.switch {
.slider {
background-color: #555;
&:before {
background-color: #ddd;
}
}
input:checked + .slider {
background-color: #1890ff;
}
}
}
</style>
<style lang="scss" scoped>
// 日期范围选择器容器
.date-range-container {
width: 216px !important;
max-width: 216px !important;
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 8px;
// 确保内部的 Element Plus 日期范围选择器宽度跟随容器
:deep(.el-date-editor.el-date-editor--daterange),
:deep(.el-range-editor.el-input__wrapper),
:deep(.el-range-editor) {
width: 100% !important;
max-width: 100% !important;
}
}
// 文献日期选择器样式
.literature-date-picker {
width: 194px !important;
max-width: 194px !important;
:deep(.el-input__wrapper) {
width: 194px !important;
max-width: 194px !important;
background: var(--color-bg, #fff);
border: 1px solid var(--color-border, #ddd);
box-shadow: none;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
transition: all 0.2s;
&:hover {
border-color: #1890ff;
}
&.is-focus {
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}
}
:deep(.el-range-editor.el-input__wrapper) {
width: 194px !important;
max-width: 194px !important;
}
:deep(.el-range-editor) {
width: 194px !important;
max-width: 194px !important;
}
:deep(.el-input__inner) {
color: var(--color-text, #333);
font-size: 12px;
height: 28px;
line-height: 28px;
}
:deep(.el-range-separator) {
color: var(--color-text-secondary, #999);
font-size: 12px;
padding: 0 4px;
}
:deep(.el-input__prefix),
:deep(.el-input__suffix) {
color: var(--color-text-secondary, #999);
}
:deep(.el-range-input) {
font-size: 10px !important;
color: var(--color-text, #333);
&::placeholder {
color: var(--color-text-secondary, #999);
font-size: 10px !important;
}
}
}
// 深色主题下的日期选择器
.literature-date-picker {
width: 194px !important;
max-width: 194px !important;
:deep(.el-input__wrapper) {
width: 194px !important;
max-width: 194px !important;
background: var(--color-bg, #1a1a1a);
border-color: var(--color-border, #444);
&:hover {
border-color: #1890ff;
}
&.is-focus {
border-color: #1890ff;
box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.15);
}
}
:deep(.el-range-editor.el-input__wrapper) {
width: 194px !important;
max-width: 194px !important;
}
:deep(.el-range-editor) {
width: 194px !important;
max-width: 194px !important;
}
:deep(.el-input__inner) {
color: var(--color-text, #ccc);
}
:deep(.el-range-separator) {
color: var(--color-text-secondary, #666);
}
:deep(.el-input__prefix),
:deep(.el-input__suffix) {
color: var(--color-text-secondary, #666);
}
:deep(.el-range-input) {
color: var(--color-text, #ccc);
font-size: 10px !important;
&::placeholder {
color: var(--color-text-secondary, #666);
}
}
}
.el-range-input {
font-size: 11px !important;
color: var(--color-text) !important;
&::placeholder {
color: var(--color-text-secondary) !important;
}
}
.el-date-editor .el-range__icon {
font-size: 12px !important;
}
/* 折叠/展开按钮主题样式 - 需要在非 scoped 样式中才能匹配全局主题类 */
.theme-dark .icon-svg-shouqi {
filter: brightness(0) saturate(100%) invert(1);
}
.theme-light .icon-svg-shouqi {
filter: brightness(0) saturate(100%) invert(27%) sepia(5%) saturate(500%)
hue-rotate(180deg) brightness(0.95) contrast(0.9);
}
</style>