新增: 无人值守P0任务边界全链
- 任务级授权边界判定与审批旁路单点插桩 - boundary_json 随会话落库(V45 可逆迁移) - 六路非正常终局统一安全停靠与托盘通知 - 每五轮进度事件与会话头部进度条 - 前端边界配置卡侧栏徽标及 UX 校验补齐
This commit is contained in:
@@ -119,6 +119,20 @@
|
||||
<div class="ai-bottom-tools" ref="goalsRef">
|
||||
<span v-if="currentConvTitle" class="ai-bottom-title">{{ currentConvTitle }}</span>
|
||||
<div class="ai-bottom-tools-right">
|
||||
<!-- 无人值守任务进度(AiTaskProgress,设计 §4.3):当前会话有进度快照时显示,
|
||||
静默期(子代理长跑/大工具执行/重入退避)凭最后快照可见「在干活」;终局即清。
|
||||
max_rounds=0(不限轮次)不显分母进度条,只显轮次与 token。 -->
|
||||
<div v-if="taskProgress" class="ai-task-progress">
|
||||
<span class="ai-task-progress-dot"></span>
|
||||
<span class="ai-task-progress-text">{{ taskProgressText }}</span>
|
||||
<span
|
||||
v-if="taskProgress.maxRounds > 0"
|
||||
class="ai-task-progress-bar"
|
||||
:title="$t('ai.taskProgress.barHint', { round: taskProgress.round, max: taskProgress.maxRounds })"
|
||||
>
|
||||
<span class="ai-task-progress-fill" :style="{ width: taskProgressPct + '%' }"></span>
|
||||
</span>
|
||||
</div>
|
||||
<!-- 目标计数 -->
|
||||
<div v-if="goals.length" class="ai-goals-inline">
|
||||
<span class="ai-goals-inline-badge ai-tool-badge" @click="togglePanel('goals')" :title="$t('aiChat.viewGoals')">
|
||||
@@ -217,6 +231,7 @@ import { ref, computed, watch, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useAiStore } from '../../stores/ai'
|
||||
import { aiApi } from '../../api/ai'
|
||||
import { pendingTaskProgress } from '../../composables/ai/useAiPendingState'
|
||||
import type { AiMessage, ModelConfig, GoalEntry } from '../../api/types'
|
||||
|
||||
defineProps<{
|
||||
@@ -356,6 +371,28 @@ const currentConvTitle = computed(() => {
|
||||
return conv?.title || ''
|
||||
})
|
||||
|
||||
// ── 无人值守任务进度(设计 §4.3,AiTaskProgress per-conv 快照)──
|
||||
// 消费 useAiEvents 归集的 pendingTaskProgress(per-conv Map,终局即清):无快照不渲染。
|
||||
// 切会话自动跟随(Map 按 activeId 取),多会话并发各显各的,不串台。
|
||||
const taskProgress = computed(() => {
|
||||
const id = store.state.activeConversationId
|
||||
if (!id) return null
|
||||
return pendingTaskProgress.get(id) ?? null
|
||||
})
|
||||
const taskProgressText = computed(() => {
|
||||
const p = taskProgress.value
|
||||
if (!p) return ''
|
||||
const tokens = p.tokensUsed >= 1000 ? `${(p.tokensUsed / 1000).toFixed(1)}k` : String(p.tokensUsed)
|
||||
return p.maxRounds > 0
|
||||
? t('ai.taskProgress.running', { round: p.round, max: p.maxRounds, tokens })
|
||||
: t('ai.taskProgress.unlimited', { round: p.round, tokens })
|
||||
})
|
||||
const taskProgressPct = computed(() => {
|
||||
const p = taskProgress.value
|
||||
if (!p || p.maxRounds <= 0) return 0
|
||||
return Math.min(100, Math.round((p.round / p.maxRounds) * 100))
|
||||
})
|
||||
|
||||
// 🎯 对话目标面板(对话透明化 L1:Goal visibility)
|
||||
const goals = ref<GoalEntry[]>([])
|
||||
const goalsExpanded = ref(false)
|
||||
@@ -744,7 +781,10 @@ onBeforeUnmount(() => {
|
||||
color: var(--df-text-secondary);
|
||||
min-width: 0;
|
||||
margin-right: auto;
|
||||
|
||||
/* 长标题单行截断(防换行撑高工具行;右侧徽章族 flex-shrink:0,分离窄窗口更挤) */
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ai-bottom-tools-right {
|
||||
display: flex;
|
||||
@@ -753,6 +793,45 @@ onBeforeUnmount(() => {
|
||||
flex-shrink: 0;
|
||||
margin-left: auto;
|
||||
}
|
||||
/* 无人值守任务进度(设计 §4.3):绿点+轮次/token 文本+细进度条,与右侧徽章族同排 */
|
||||
.ai-task-progress {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
margin-right: 4px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.ai-task-progress-dot {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
border-radius: 50%;
|
||||
background: var(--df-success);
|
||||
flex-shrink: 0;
|
||||
animation: ai-task-progress-pulse 1.6s ease-in-out infinite;
|
||||
}
|
||||
.ai-task-progress-text {
|
||||
font-size: 11px;
|
||||
color: var(--df-text-secondary);
|
||||
}
|
||||
.ai-task-progress-bar {
|
||||
display: inline-block;
|
||||
width: 48px;
|
||||
height: 3px;
|
||||
border-radius: 2px;
|
||||
background: color-mix(in srgb, var(--df-text-dim) 25%, transparent);
|
||||
overflow: hidden;
|
||||
}
|
||||
.ai-task-progress-fill {
|
||||
display: block;
|
||||
height: 100%;
|
||||
border-radius: 2px;
|
||||
background: var(--df-success);
|
||||
transition: width .4s var(--df-ease);
|
||||
}
|
||||
@keyframes ai-task-progress-pulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.35; }
|
||||
}
|
||||
/* ═══ Provider Bar (header 中间区) ═══ */
|
||||
.ai-provider-bar {
|
||||
display: inline-flex;
|
||||
|
||||
Reference in New Issue
Block a user