|
|
@@ -136,63 +136,39 @@
|
|
|
</p>
|
|
|
</div>
|
|
|
<div class="wb-toolbar__actions">
|
|
|
- <a-button @click="getList">刷新</a-button>
|
|
|
+ <a-button @click="handleRefresh">刷新</a-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
- <a-table
|
|
|
- :columns="columns"
|
|
|
- :data-source="runList"
|
|
|
- :loading="loading"
|
|
|
- :pagination="false"
|
|
|
- :locale="{ emptyText: '暂无编排运行数据' }"
|
|
|
- :scroll="{ x: 1665 }"
|
|
|
- row-key="id"
|
|
|
- size="small"
|
|
|
- class="wb-table"
|
|
|
- >
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
- <template v-if="column.key === 'user'">
|
|
|
- <span v-if="record.userName">{{ record.userName }}</span>
|
|
|
- <span v-else class="wb-muted">{{ record.userId ?? '-' }}</span>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'action'">
|
|
|
- <a-tag :color="actionTagColor(record.action)">{{ actionLabel(record.action) }}</a-tag>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'status'">
|
|
|
- <a-tag :color="statusTagColor(record.status)">{{ statusLabel(record.status) }}</a-tag>
|
|
|
- <a-tooltip v-if="record.degradeReason" :title="record.degradeReason">
|
|
|
- <Icon icon="i-mdi:alert-circle-outline" class="status-tip-icon" />
|
|
|
- </a-tooltip>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'expertAgentNames'">{{ record.expertAgentNames || '-' }}</template>
|
|
|
- <template v-else-if="column.key === 'expertCallCount'">{{ record.expertCallCount ?? 0 }}</template>
|
|
|
- <template v-else-if="column.key === 'duration'">{{ formatDuration(record.durationMs) }}</template>
|
|
|
- <template v-else-if="column.key === 'totalTokens'">{{ formatNumber(record.totalTokens) }}</template>
|
|
|
- <template v-else-if="column.key === 'totalCost'">
|
|
|
- <span>{{ formatCost(record.totalCost) }}</span>
|
|
|
- <a-tooltip v-if="record.priceConfigured === false" title="涉及模型未配置单价,费用按 0 估算">
|
|
|
- <a-tag color="default" class="cost-tip-tag">未配置单价</a-tag>
|
|
|
- </a-tooltip>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'rowAction'">
|
|
|
- <a-button type="link" size="small" @click="handleDetail(record)">详情</a-button>
|
|
|
- </template>
|
|
|
+ <BasicTable @register="registerTable" class="wb-table" :locale="{ emptyText: '暂无编排运行数据' }">
|
|
|
+ <template #user="{ record }">
|
|
|
+ <span v-if="record.userName">{{ record.userName }}</span>
|
|
|
+ <span v-else class="wb-muted">{{ record.userId ?? '-' }}</span>
|
|
|
</template>
|
|
|
- </a-table>
|
|
|
-
|
|
|
- <div v-show="total > 0" class="wb-pagination">
|
|
|
- <a-pagination
|
|
|
- v-model:current="queryParams.pageNum"
|
|
|
- v-model:page-size="queryParams.pageSize"
|
|
|
- :total="total"
|
|
|
- show-size-changer
|
|
|
- :show-total="showTotal"
|
|
|
- :page-size-options="['10', '20', '50', '100']"
|
|
|
- @change="getList"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <template #action="{ record }">
|
|
|
+ <a-tag :color="actionTagColor(record.action)">{{ actionLabel(record.action) }}</a-tag>
|
|
|
+ </template>
|
|
|
+ <template #status="{ record }">
|
|
|
+ <a-tag :color="statusTagColor(record.status)">{{ statusLabel(record.status) }}</a-tag>
|
|
|
+ <a-tooltip v-if="record.degradeReason" :title="record.degradeReason">
|
|
|
+ <Icon icon="i-mdi:alert-circle-outline" class="status-tip-icon" />
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ <template #expertAgentNames="{ record }">{{ record.expertAgentNames || '-' }}</template>
|
|
|
+ <template #expertCallCount="{ record }">{{ record.expertCallCount ?? 0 }}</template>
|
|
|
+ <template #duration="{ record }">{{ formatDuration(record.durationMs) }}</template>
|
|
|
+ <template #totalTokens="{ record }">{{ formatNumber(record.totalTokens) }}</template>
|
|
|
+ <template #totalCost="{ record }">
|
|
|
+ <span>{{ formatCost(record.totalCost) }}</span>
|
|
|
+ <a-tooltip v-if="record.priceConfigured === false" title="涉及模型未配置单价,费用按 0 估算">
|
|
|
+ <a-tag color="default" class="cost-tip-tag">未配置单价</a-tag>
|
|
|
+ </a-tooltip>
|
|
|
+ </template>
|
|
|
+ <template #rowAction="{ record }">
|
|
|
+ <a-button type="link" size="small" @click="handleDetail(record)">详情</a-button>
|
|
|
+ </template>
|
|
|
+ </BasicTable>
|
|
|
</a-card>
|
|
|
|
|
|
<a-drawer v-model:open="detail.visible" title="编排运行详情" width="65%" root-class-name="wb-detail-drawer">
|
|
|
@@ -268,14 +244,13 @@
|
|
|
</a-card>
|
|
|
|
|
|
<a-card :bordered="false" class="detail-card" title="专家调用明细">
|
|
|
- <a-table
|
|
|
+ <BasicTable
|
|
|
v-if="expertCalls.length"
|
|
|
:columns="expertColumns"
|
|
|
:data-source="expertCalls"
|
|
|
:pagination="false"
|
|
|
row-key="id"
|
|
|
bordered
|
|
|
- size="small"
|
|
|
>
|
|
|
<template #expandedRowRender="{ record }">
|
|
|
<div class="expand-block">
|
|
|
@@ -283,18 +258,16 @@
|
|
|
<pre class="detail-pre">{{ record.rawOutput || '-' }}</pre>
|
|
|
</div>
|
|
|
</template>
|
|
|
- <template #bodyCell="{ column, record }">
|
|
|
- <template v-if="column.key === 'callKind'">{{ callKindLabel(record.callKind) }}</template>
|
|
|
- <template v-else-if="column.key === 'status'">
|
|
|
- <a-tag :color="callStatusTagColor(record.status)">{{ callStatusLabel(record.status) }}</a-tag>
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'tokens'">
|
|
|
- {{ formatNumber(sumTokens(record.promptTokens, record.completionTokens)) }}
|
|
|
- </template>
|
|
|
- <template v-else-if="column.key === 'cost'">{{ formatCost(record.cost) }}</template>
|
|
|
- <template v-else-if="column.key === 'duration'">{{ formatDuration(record.durationMs) }}</template>
|
|
|
+ <template #expertCallKind="{ record }">{{ callKindLabel(record.callKind) }}</template>
|
|
|
+ <template #expertStatus="{ record }">
|
|
|
+ <a-tag :color="callStatusTagColor(record.status)">{{ callStatusLabel(record.status) }}</a-tag>
|
|
|
</template>
|
|
|
- </a-table>
|
|
|
+ <template #expertTokens="{ record }">
|
|
|
+ {{ formatNumber(sumTokens(record.promptTokens, record.completionTokens)) }}
|
|
|
+ </template>
|
|
|
+ <template #expertCost="{ record }">{{ formatCost(record.cost) }}</template>
|
|
|
+ <template #expertDuration="{ record }">{{ formatDuration(record.durationMs) }}</template>
|
|
|
+ </BasicTable>
|
|
|
<span v-else class="wb-muted">本轮未调用专家(自己回答)</span>
|
|
|
</a-card>
|
|
|
</template>
|
|
|
@@ -319,16 +292,15 @@
|
|
|
AForm,
|
|
|
AFormItem,
|
|
|
AInputNumber,
|
|
|
- APagination,
|
|
|
ASelect,
|
|
|
ASelectOption,
|
|
|
ASpin,
|
|
|
- ATable,
|
|
|
ATag,
|
|
|
ATooltip,
|
|
|
Modal,
|
|
|
message,
|
|
|
} from '@/workbench/components/ant';
|
|
|
+ import { BasicTable, useTable } from '@/core/components/Table';
|
|
|
import { Icon } from '@/core/components/Icon';
|
|
|
import {
|
|
|
getAuditRetention,
|
|
|
@@ -345,13 +317,10 @@
|
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
|
- const runList = ref<any[]>([]);
|
|
|
const agentOptions = ref<any[]>([]);
|
|
|
const stat = ref<any>({});
|
|
|
- const loading = ref(true);
|
|
|
const statLoading = ref(true);
|
|
|
const showSearch = ref(true);
|
|
|
- const total = ref(0);
|
|
|
const dateRange = ref<any>(null);
|
|
|
|
|
|
/** 审计数据保留:保留天数(0=不清理)与各表超期行数 */
|
|
|
@@ -380,8 +349,6 @@
|
|
|
});
|
|
|
|
|
|
const queryParams = reactive<any>({
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
sessionId: undefined,
|
|
|
expertAgentId: undefined,
|
|
|
action: undefined,
|
|
|
@@ -398,11 +365,9 @@
|
|
|
record: undefined,
|
|
|
});
|
|
|
|
|
|
- const showTotal = (count: number) => `共 ${count} 条`;
|
|
|
-
|
|
|
const columns: any[] = [
|
|
|
{ title: '创建时间', dataIndex: 'createTime', key: 'createTime', align: 'center', width: 170 },
|
|
|
- { title: '任务标题', dataIndex: 'sessionTitle', key: 'sessionTitle', align: 'left', ellipsis: true },
|
|
|
+ { title: '任务标题', dataIndex: 'sessionTitle', key: 'sessionTitle', align: 'left', width: 240, ellipsis: true },
|
|
|
{
|
|
|
title: '入口智能体',
|
|
|
dataIndex: 'entryAgentName',
|
|
|
@@ -411,26 +376,26 @@
|
|
|
width: 140,
|
|
|
ellipsis: true,
|
|
|
},
|
|
|
- { title: '提问用户', key: 'user', align: 'center', width: 110 },
|
|
|
- { title: '动作', key: 'action', align: 'center', width: 110 },
|
|
|
- { title: '状态', key: 'status', align: 'center', width: 150 },
|
|
|
- { title: '专家', key: 'expertAgentNames', align: 'center', width: 180, ellipsis: true },
|
|
|
- { title: '专家次数', key: 'expertCallCount', align: 'center', width: 100 },
|
|
|
- { title: '耗时', key: 'duration', align: 'center', width: 100 },
|
|
|
- { title: 'Token', key: 'totalTokens', align: 'center', width: 110 },
|
|
|
- { title: '费用(元)', key: 'totalCost', align: 'center', width: 140 },
|
|
|
- { title: '操作', key: 'rowAction', align: 'center', width: 100, fixed: 'right' },
|
|
|
+ { title: '提问用户', key: 'user', align: 'center', width: 110, slot: 'user' },
|
|
|
+ { title: '动作', key: 'action', align: 'center', width: 110, slot: 'action' },
|
|
|
+ { title: '状态', key: 'status', align: 'center', width: 150, slot: 'status' },
|
|
|
+ { title: '专家', key: 'expertAgentNames', align: 'center', width: 180, ellipsis: true, slot: 'expertAgentNames' },
|
|
|
+ { title: '专家次数', key: 'expertCallCount', align: 'center', width: 100, slot: 'expertCallCount' },
|
|
|
+ { title: '耗时', key: 'duration', align: 'center', width: 100, slot: 'duration' },
|
|
|
+ { title: 'Token', key: 'totalTokens', align: 'center', width: 110, slot: 'totalTokens' },
|
|
|
+ { title: '费用(元)', key: 'totalCost', align: 'center', width: 140, slot: 'totalCost' },
|
|
|
+ { title: '操作', key: 'rowAction', align: 'center', width: 100, fixed: 'right', ellipsis: false, slot: 'rowAction' },
|
|
|
];
|
|
|
|
|
|
const expertColumns: any[] = [
|
|
|
{ title: '第 N 次', dataIndex: 'attemptNo', key: 'attemptNo', align: 'center', width: 80 },
|
|
|
- { title: '类型', key: 'callKind', align: 'center', width: 110 },
|
|
|
+ { title: '类型', key: 'callKind', align: 'center', width: 110, slot: 'expertCallKind' },
|
|
|
{ title: '专家', dataIndex: 'expertAgentName', key: 'expertAgentName', align: 'left', width: 140, ellipsis: true },
|
|
|
- { title: '状态', key: 'status', align: 'center', width: 130 },
|
|
|
+ { title: '状态', key: 'status', align: 'center', width: 130, slot: 'expertStatus' },
|
|
|
{ title: '失败原因', dataIndex: 'validationError', key: 'validationError', align: 'left', ellipsis: true },
|
|
|
- { title: 'Token', key: 'tokens', align: 'center', width: 110 },
|
|
|
- { title: '费用(元)', key: 'cost', align: 'center', width: 100 },
|
|
|
- { title: '耗时', key: 'duration', align: 'center', width: 100 },
|
|
|
+ { title: 'Token', key: 'tokens', align: 'center', width: 110, slot: 'expertTokens' },
|
|
|
+ { title: '费用(元)', key: 'cost', align: 'center', width: 100, slot: 'expertCost' },
|
|
|
+ { title: '耗时', key: 'duration', align: 'center', width: 100, slot: 'expertDuration' },
|
|
|
];
|
|
|
|
|
|
/** 专家调用明细(缺失时兜底为空数组) */
|
|
|
@@ -668,25 +633,30 @@
|
|
|
return params;
|
|
|
};
|
|
|
|
|
|
- /** 查询列表与统计(同一筛选条件) */
|
|
|
- const getList = async () => {
|
|
|
- const params = buildParams();
|
|
|
- const statParams: any = { ...params };
|
|
|
- delete statParams.pageNum;
|
|
|
- delete statParams.pageSize;
|
|
|
- loading.value = true;
|
|
|
+ const [registerTable, { reload }] = useTable({
|
|
|
+ api: listRouteRuns,
|
|
|
+ columns,
|
|
|
+ rowKey: 'id',
|
|
|
+ fetchSetting: { pageField: 'pageNum', sizeField: 'pageSize', listField: 'rows', totalField: 'total' },
|
|
|
+ beforeFetch: (params) => ({ ...params, ...buildParams() }),
|
|
|
+ });
|
|
|
+
|
|
|
+ /** 编排统计(与列表同一筛选条件,不随分页变化) */
|
|
|
+ const loadStats = async () => {
|
|
|
statLoading.value = true;
|
|
|
try {
|
|
|
- const [statRes, listRes]: any[] = await Promise.all([routeRunStats(statParams), listRouteRuns(params)]);
|
|
|
+ const statRes: any = await routeRunStats(buildParams());
|
|
|
stat.value = statRes ?? {};
|
|
|
- runList.value = listRes?.rows ?? [];
|
|
|
- total.value = Number(listRes?.total ?? 0);
|
|
|
} finally {
|
|
|
- loading.value = false;
|
|
|
statLoading.value = false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ const handleRefresh = () => {
|
|
|
+ reload();
|
|
|
+ loadStats();
|
|
|
+ };
|
|
|
+
|
|
|
/** 查询专家选项(含已停用:历史数据里的专家可能已停用) */
|
|
|
const getAgentOptions = async () => {
|
|
|
const res = await optionAuditAgents();
|
|
|
@@ -702,8 +672,8 @@
|
|
|
};
|
|
|
|
|
|
const handleQuery = () => {
|
|
|
- queryParams.pageNum = 1;
|
|
|
- getList();
|
|
|
+ reload({ page: 1 });
|
|
|
+ loadStats();
|
|
|
};
|
|
|
|
|
|
const resetQuery = () => {
|
|
|
@@ -711,9 +681,9 @@
|
|
|
queryParams.expertAgentId = undefined;
|
|
|
queryParams.action = undefined;
|
|
|
queryParams.status = undefined;
|
|
|
- queryParams.pageNum = 1;
|
|
|
dateRange.value = defaultDateRange();
|
|
|
- getList();
|
|
|
+ reload({ page: 1 });
|
|
|
+ loadStats();
|
|
|
};
|
|
|
|
|
|
/** 查看详情(先展示列表行,再拉取含决策原文与专家明细的详情) */
|
|
|
@@ -739,7 +709,7 @@
|
|
|
dateRange.value = defaultDateRange();
|
|
|
applyRouteQuery();
|
|
|
getAgentOptions();
|
|
|
- getList();
|
|
|
+ loadStats();
|
|
|
getRetention();
|
|
|
});
|
|
|
</script>
|