feat(agent): 立账凭证检核
(cherry picked from commit f9e2fb5efc1ec7bf4f6e52e08dd3591b4e77edd9)
This commit is contained in:
1 parent
9bcbf9d211
commit
f615e56bb9
70 files changed
+4968
-108
No files matched your search
@@ -1,11 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/chat/components/ToolRunProgressCard.vue
|
||||
* 用途:展示文件检核等 Agent 异步 tool_run 的实时进度、知识库同步态与 Excel 下载。
|
||||
* 用途:展示文件检核/立账凭证检核等 Agent 异步 tool_run 的实时进度、知识库同步态与 Excel 下载。
|
||||
* 依赖:vue-i18n、lucide 图标、getAuthHeaders、toolRunProgress.api。
|
||||
* 逻辑:由聊天消息列表在绑定 run_id 后挂载;轮询结果经 props.run 传入,本组件只负责展示与下载。
|
||||
* 逻辑:由聊天消息列表在绑定 run_id 后挂载;有 progress_metrics 时按领域指标渲染,否则回退八格。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { AlertCircle, CheckCircle2, Clock3, Download, Loader2 } from 'lucide-vue-next';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
@@ -19,10 +19,26 @@ const props = defineProps<{
|
||||
fallbackTitle?: string;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const { t, te } = useI18n();
|
||||
const downloadingExcel = ref(false);
|
||||
const downloadError = ref('');
|
||||
|
||||
/**
|
||||
* 领域自定义进度指标;有值时覆盖默认文件检核八格。
|
||||
* 核心逻辑:读取 progress_metrics,按 label_key 做 i18n,缺省回退 label/key。
|
||||
*/
|
||||
const domainMetrics = computed(() => {
|
||||
const metrics = props.run?.progress_metrics;
|
||||
if (!Array.isArray(metrics) || !metrics.length) return null;
|
||||
return metrics.map((item) => {
|
||||
const labelKey = String(item.label_key || '').trim();
|
||||
const label = labelKey && te(labelKey)
|
||||
? t(labelKey)
|
||||
: (item.label || item.key);
|
||||
return { key: item.key, label, value: Number(item.value) || 0 };
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 将后端 run.status 映射为本地化状态文案。
|
||||
* 核心逻辑:命中已知状态码用 i18n;未知状态回退原始值,再回退“等待中”。
|
||||
@@ -215,7 +231,20 @@ const downloadExcel = async () => {
|
||||
<span>{{ $t('chat.toolRun.startedAt', { time: formatTime(run.started_at) }) }} · {{ $t('chat.toolRun.finishedAt', { time: formatTime(run.finished_at) }) }}</span>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-1.5 sm:grid-cols-4 lg:grid-cols-8">
|
||||
<div
|
||||
v-if="domainMetrics"
|
||||
class="grid grid-cols-2 gap-1.5 sm:grid-cols-3 lg:grid-cols-5"
|
||||
>
|
||||
<div
|
||||
v-for="metric in domainMetrics"
|
||||
:key="metric.key"
|
||||
class="rounded-lg bg-white/80 px-2 py-1.5"
|
||||
>
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ metric.label }}</div>
|
||||
<div class="text-base font-bold text-slate-800">{{ metric.value }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="grid grid-cols-2 gap-1.5 sm:grid-cols-4 lg:grid-cols-8">
|
||||
<div class="rounded-lg bg-white/80 px-2 py-1.5">
|
||||
<div class="whitespace-nowrap text-xs text-slate-500">{{ $t('chat.toolRun.total') }}</div>
|
||||
<div class="text-base font-bold text-slate-800">{{ run.total_count }}</div>
|
||||
|
||||
Reference in new issue
Block a user