修复: .trash WARN 降级 + ToolCard 分组标题增强

- .trash 跨盘迁移从 WARN 降为 DEBUG(预期行为,非异常)
- ToolCard 分组标题增加文件路径摘要(取前3个文件名),
  收起态也能看到影响了哪些文件
This commit is contained in:
2026-06-28 00:25:37 +08:00
parent b7b004dd68
commit cf223fc08b
3 changed files with 32 additions and 2 deletions

View File

@@ -19,6 +19,7 @@
<span class="ai-tool-group-icon" v-html="groupIcon(group.name)"></span>
<span class="ai-tool-group-name">{{ groupDisplayName(group) }}</span>
<span class="ai-tool-group-count">{{ group.calls.length }}</span>
<span class="ai-tool-group-files">{{ groupFileSummary(group) }}</span>
<span class="ai-tool-group-chevron" :class="{ 'is-open': !isGroupCollapsed(gi) }"></span>
<!-- 全部展开/收起(U-260618: topbar 下沉到首个可折叠分组标题行尾巴, run command 同行) -->
<div
@@ -216,6 +217,26 @@ function groupDisplayName(group: ToolCallGroup): string {
return group.name.replace(/_/g, ' ')
}
/** 从工具调用参数中提取路径摘要(取前 3 个文件名)。
* 供分组标题行展示,让用户一眼知道影响了哪些文件。*/
function groupFileSummary(group: ToolCallGroup): string {
const paths: string[] = []
for (const tc of group.calls) {
const args = tc.args as Record<string, unknown> | undefined
const p = args?.path
if (typeof p === 'string' && p.trim()) {
// 取最后一段文件名(或最后两级目录)
const parts = p.trim().split(/[/\\]/)
const short = parts.length >= 2
? parts.slice(-2).join('/')
: parts[parts.length - 1]
if (!paths.includes(short)) paths.push(short)
if (paths.length >= 3) break
}
}
return paths.length ? ' · ' + paths.join(' · ') : ''
}
/**
* 单卡是否展开:
* - 分组未折叠 → 用户手动 expandedCards 或首卡默认展开