240
240
241
241
<div class =" left-icons" >
242
242
<a-tooltip :title =" t('CHAT')" placement =" bottom" >
243
- <a @click =" goChat" class =" icon-button" >
243
+ <a @click =" goChat() " class =" icon-button" >
244
244
<MessageOutlined />
245
245
</a >
246
246
</a-tooltip >
292
292
<a-table
293
293
:columns =" columns"
294
294
:data-source =" tableData"
295
- :pagination =" { pageSize: 8 } "
295
+ :pagination =" pagination "
296
296
:row-key =" record => record.key"
297
297
size =" small"
298
298
class =" result-table"
299
+ @change =" handleTableChange"
300
+ @resizeColumn =" handleResizeColumn"
299
301
>
300
302
<template #bodyCell =" { text , record , column , index } " >
301
303
<template v-if =" column .dataIndex === ' status' " >
302
304
{{ record.status }}
303
305
</template >
304
306
<template v-else-if =" column .dataIndex === ' model' " >
305
- <span @click =" copyText(item.model)" >
307
+ <span style =" display : flex ; align-items : center " >
308
+ <MessageOutlined
309
+ style =" margin-right : 8px ; cursor : pointer "
310
+ @click =" goChat(record.model)"
311
+ />
306
312
{{ record.model }}
307
313
</span >
308
314
</template >
@@ -1157,6 +1163,21 @@ let chartInstance = null;
1157
1163
const showSVGModal = ref (false );
1158
1164
const svgDataUrl = ref (' ' );
1159
1165
const testingComplete = ref (false );
1166
+ const tableData = ref ([]);
1167
+ const totalModels = ref (0 );
1168
+ const completedModels = ref (0 );
1169
+ const progressPercent = ref (0 );
1170
+ const pagination = reactive ({
1171
+ current: 1 ,
1172
+ pageSize: 8 , // 默认每页显示8条,可以根据需要调整
1173
+ pageSizeOptions: [' 8' , ' 12' , ' 20' ], // 可供选择的每页条数
1174
+ showSizeChanger: true , // 显示每页条数切换器
1175
+ total: computed (() => tableData .value .length ), // 数据总数
1176
+ });
1177
+ const handleTableChange = (paginationInfo , filters , sorter ) => {
1178
+ pagination .current = paginationInfo .current ;
1179
+ pagination .pageSize = paginationInfo .pageSize ;
1180
+ };
1160
1181
1161
1182
const appDescription = computed (() => {
1162
1183
const currentLocale = locale .value || ' zh' ;
@@ -1596,11 +1617,6 @@ const checkQuota = async () => {
1596
1617
}
1597
1618
};
1598
1619
1599
- const tableData = ref ([]);
1600
- const totalModels = ref (0 );
1601
- const completedModels = ref (0 );
1602
- const progressPercent = ref (0 );
1603
-
1604
1620
// 添加 testModels 函数
1605
1621
async function testModels () {
1606
1622
// 重置结果
@@ -1909,6 +1925,7 @@ const columns = [
1909
1925
key: ' model' ,
1910
1926
width: 180 ,
1911
1927
ellipsis: true ,
1928
+ resizable: true ,
1912
1929
sorter : (a , b ) => a .model .localeCompare (b .model ),
1913
1930
customCell : () => ({ attrs: { ' data-label' : t (' MODEL_NAME_LABEL' ) } }),
1914
1931
},
@@ -1917,6 +1934,7 @@ const columns = [
1917
1934
dataIndex: ' responseTime' ,
1918
1935
width: 70 ,
1919
1936
key: ' responseTime' ,
1937
+ resizable: true ,
1920
1938
sorter : (a , b ) => parseFloat (a .responseTime ) - parseFloat (b .responseTime ),
1921
1939
customCell : () => ({ attrs: { ' data-label' : t (' RESPONSE_TIME_LABEL' ) } }),
1922
1940
},
@@ -1926,6 +1944,7 @@ const columns = [
1926
1944
key: ' remark' ,
1927
1945
width: 100 ,
1928
1946
ellipsis: true ,
1947
+ resizable: true ,
1929
1948
customCell : () => ({ attrs: { ' data-label' : t (' REMARK_LABEL' ) } }),
1930
1949
},
1931
1950
{
@@ -1940,6 +1959,10 @@ const columns = [
1940
1959
},
1941
1960
];
1942
1961
1962
+ function handleResizeColumn (w , col ) {
1963
+ col .width = w;
1964
+ }
1965
+
1943
1966
// 复制文本函数
1944
1967
function copyText (text ) {
1945
1968
navigator .clipboard
@@ -2644,8 +2667,17 @@ onMounted(() => {
2644
2667
});
2645
2668
2646
2669
// goChat
2647
- function goChat () {
2648
- const url = ` https://chat.crond.dev/#/?settings={"key":"${ apiKey .value } ","url":"${ apiUrl .value } "}` ;
2670
+ function goChat (modelName ) {
2671
+ // 模拟获取模型并打印数据
2672
+ if (! apiKey .value || ! apiUrl .value ) {
2673
+ message .error (' 请先填写 API Key 和 API URL' );
2674
+ return ;
2675
+ }
2676
+ // 判断是否有modelName 没有就不给url 传值
2677
+ let url = ` https://chat.crond.dev/#/?settings={"key":"${ apiKey .value } ","url":"${ apiUrl .value } "}` ;
2678
+ if (modelName) {
2679
+ url = ` https://chat.crond.dev/#/?settings={"key":"${ apiKey .value } ","url":"${ apiUrl .value } ","model":"${ modelName} "}` ;
2680
+ }
2649
2681
window .open (url);
2650
2682
}
2651
2683
@@ -2718,7 +2750,8 @@ function copyModels(type) {
2718
2750
message .info (t (' NO_MODELS_TO_COPY' ));
2719
2751
return ;
2720
2752
}
2721
- const textToCopy = models .join (' \n ' );
2753
+ // 需要加入,分割
2754
+ const textToCopy = models .join (' ,' );
2722
2755
navigator .clipboard
2723
2756
.writeText (textToCopy)
2724
2757
.then (() => {
0 commit comments