feat(rohs-check): 增强 RoHS 检核工具进度展示,新增判定统计与当前步骤信息
This commit is contained in:
1 parent
b82f31af8f
commit
ee39270069
9 files changed
+349
-11
No files matched your search
@@ -12,6 +12,23 @@ export interface ToolRunProgress {
|
||||
success_count: number;
|
||||
failed_count: number;
|
||||
skipped_count: number;
|
||||
current_step?: {
|
||||
step?: string;
|
||||
label?: string;
|
||||
row_id?: string | number | null;
|
||||
started_at?: string | null;
|
||||
processed_count?: number;
|
||||
success_count?: number;
|
||||
failed_count?: number;
|
||||
skipped_count?: number;
|
||||
} | null;
|
||||
judgement?: {
|
||||
qualified_count?: number;
|
||||
unqualified_count?: number;
|
||||
manual_count?: number;
|
||||
dify_error_count?: number;
|
||||
invalid_result_count?: number;
|
||||
};
|
||||
progress_percent: number;
|
||||
started_at?: string | null;
|
||||
finished_at?: string | null;
|
||||
|
||||
@@ -23,10 +23,29 @@ const statusLabel = (status?: string) => {
|
||||
|
||||
const formatTime = (value?: string | null) => {
|
||||
if (!value) return '-';
|
||||
return String(value).replace('T', ' ').slice(0, 19);
|
||||
const date = new Date(String(value));
|
||||
if (Number.isNaN(date.getTime())) return String(value).replace('T', ' ').slice(0, 19);
|
||||
const pad = (num: number) => String(num).padStart(2, '0');
|
||||
return [
|
||||
date.getFullYear(),
|
||||
pad(date.getMonth() + 1),
|
||||
pad(date.getDate()),
|
||||
].join('-') + ' ' + [
|
||||
pad(date.getHours()),
|
||||
pad(date.getMinutes()),
|
||||
pad(date.getSeconds()),
|
||||
].join(':');
|
||||
};
|
||||
|
||||
const percent = () => Math.max(0, Math.min(Number(props.run?.progress_percent || 0), 100));
|
||||
|
||||
const judgementTotal = () => {
|
||||
const judgement = props.run?.judgement;
|
||||
if (!judgement) return 0;
|
||||
return Number(judgement.qualified_count || 0)
|
||||
+ Number(judgement.unqualified_count || 0)
|
||||
+ Number(judgement.manual_count || 0);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -48,6 +67,11 @@ const percent = () => Math.max(0, Math.min(Number(props.run?.progress_percent ||
|
||||
<template v-else-if="loading">正在查询任务进度...</template>
|
||||
<template v-else>{{ error }}</template>
|
||||
</p>
|
||||
<p v-if="run?.status === 'running' && run.current_step" class="mt-1 text-xs text-sky-700">
|
||||
当前阶段:{{ run.current_step.label || run.current_step.step }}
|
||||
<span v-if="run.current_step.row_id"> · 当前记录:{{ run.current_step.row_id }}</span>
|
||||
<span v-if="run.current_step.started_at"> · 阶段开始:{{ formatTime(run.current_step.started_at) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
v-if="run?.excel?.download_url"
|
||||
@@ -95,6 +119,32 @@ const percent = () => Math.max(0, Math.min(Number(props.run?.progress_percent ||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="judgementTotal() > 0" class="rounded-xl bg-white/70 px-3 py-3">
|
||||
<div class="mb-2 text-xs font-semibold text-slate-600">判定口径</div>
|
||||
<div class="grid grid-cols-2 gap-2 md:grid-cols-5">
|
||||
<div class="rounded-lg bg-emerald-50/80 px-3 py-2">
|
||||
<div class="text-xs text-slate-500">合格</div>
|
||||
<div class="text-lg font-bold text-emerald-700">{{ run.judgement?.qualified_count || 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-rose-50/80 px-3 py-2">
|
||||
<div class="text-xs text-slate-500">不合格</div>
|
||||
<div class="text-lg font-bold text-rose-700">{{ run.judgement?.unqualified_count || 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-amber-50/80 px-3 py-2">
|
||||
<div class="text-xs text-slate-500">人工判定</div>
|
||||
<div class="text-lg font-bold text-amber-700">{{ run.judgement?.manual_count || 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-orange-50/80 px-3 py-2">
|
||||
<div class="text-xs text-slate-500">Dify 异常</div>
|
||||
<div class="text-lg font-bold text-orange-700">{{ run.judgement?.dify_error_count || 0 }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-slate-50/80 px-3 py-2">
|
||||
<div class="text-xs text-slate-500">返回异常</div>
|
||||
<div class="text-lg font-bold text-slate-700">{{ run.judgement?.invalid_result_count || 0 }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="run.knowledge_base?.sync_status || run.error_message" class="rounded-xl bg-white/70 px-3 py-2 text-xs text-slate-600">
|
||||
<div v-if="run.knowledge_base?.sync_status">知识库同步:{{ run.knowledge_base.sync_status }}</div>
|
||||
<div v-if="run.knowledge_base?.error_message" class="text-amber-700">同步错误:{{ run.knowledge_base.error_message }}</div>
|
||||
|
||||
@@ -11,8 +11,6 @@ export interface ToolRunProgressConfig {
|
||||
lock_message?: string;
|
||||
}
|
||||
|
||||
const TERMINAL_STATUSES = new Set(['success', 'partial_failed', 'failed', 'cancelled', 'canceled']);
|
||||
|
||||
const clampPollMs = (seconds: unknown) => {
|
||||
const raw = Number(seconds);
|
||||
const safe = Number.isFinite(raw) ? raw : 2;
|
||||
@@ -65,7 +63,7 @@ export function useToolRunProgress(configRef: Ref<ToolRunProgressConfig | null>)
|
||||
loading.value = false;
|
||||
}
|
||||
|
||||
if (!run.value || run.value.status === 'running' || !TERMINAL_STATUSES.has(run.value.status)) {
|
||||
if (run.value?.status === 'running') {
|
||||
scheduleNext();
|
||||
} else {
|
||||
clearTimer();
|
||||
|
||||
@@ -466,7 +466,14 @@ const toolRunProgressConfig = computed<ToolRunProgressConfig | null>(() => {
|
||||
if (!capabilities.includes('tool_run_progress')) return null;
|
||||
const raw = extra.tool_run_progress;
|
||||
if (!raw || typeof raw !== 'object') return null;
|
||||
return raw as ToolRunProgressConfig;
|
||||
const cfg = raw as ToolRunProgressConfig;
|
||||
const cid = String(conversationId.value || '').trim();
|
||||
if (!cid || !cfg.active_url) return null;
|
||||
const separator = cfg.active_url.includes('?') ? '&' : '?';
|
||||
return {
|
||||
...cfg,
|
||||
active_url: `${cfg.active_url}${separator}conversation_id=${encodeURIComponent(cid)}`,
|
||||
};
|
||||
});
|
||||
const {
|
||||
run: toolRunProgress,
|
||||
@@ -474,8 +481,14 @@ const {
|
||||
error: toolRunProgressError,
|
||||
shouldLockInput: toolRunShouldLockInput,
|
||||
lockMessage: toolRunLockMessage,
|
||||
refresh: refreshToolRunProgress,
|
||||
} = useToolRunProgress(toolRunProgressConfig);
|
||||
|
||||
const refreshToolRunProgressAfterSend = async () => {
|
||||
await nextTick();
|
||||
void refreshToolRunProgress();
|
||||
};
|
||||
|
||||
type AgentSuggestedQuestionItem = {
|
||||
question: string;
|
||||
group: string;
|
||||
@@ -3171,6 +3184,7 @@ const handleSend = async (textOrEvent?: string | Event) => {
|
||||
if (typeof textOrEvent !== 'string') input.value = '';
|
||||
attachments.value = [];
|
||||
await sendMessage(prompt, currentAgentId.value, selectedKb.value, files);
|
||||
await refreshToolRunProgressAfterSend();
|
||||
if (!conversationId.value && history.value.length === 0) {
|
||||
await loadHistory();
|
||||
} else if (conversationId.value) {
|
||||
@@ -3332,6 +3346,7 @@ const handleSend = async (textOrEvent?: string | Event) => {
|
||||
attachments.value = [];
|
||||
|
||||
await sendMessage(content, currentAgentId.value, selectedKb.value, files);
|
||||
await refreshToolRunProgressAfterSend();
|
||||
|
||||
if (!conversationId.value && history.value.length === 0) {
|
||||
await loadHistory();
|
||||
|
||||
Reference in new issue
Block a user