fix(web): 更新工具组件,优化界面显示和逻辑处理

This commit is contained in:
Wenjie Zhang 2026-04-05 21:44:41 +08:00
parent 43188c77c0
commit 59dcc6330b
5 changed files with 19 additions and 13 deletions

View File

@ -3,6 +3,8 @@
<template #header>
<div class="sep-header">
<span class="note">{{ operationLabel }}</span>
<span class="separator">|</span>
<span class="description">{{ headerSummary }}</span>
</div>
</template>
<template #result="{}">
@ -50,6 +52,17 @@ const kbList = computed(() => {
const data = parseData(resultContent)
return Array.isArray(data) ? data : []
})
const headerSummary = computed(() => {
const names = kbList.value.map((kb) => kb?.name).filter(Boolean)
if (!names.length) return '暂无知识库'
const previewNames = names.slice(0, 3).join('')
const remainingCount = names.length - 3
return remainingCount > 0
? `${names.length}个知识库:${previewNames}${remainingCount}`
: `${names.length}个知识库:${previewNames}`
})
</script>
<style scoped lang="less">

View File

@ -1,5 +1,5 @@
<template>
<BaseToolCall :tool-call="toolCall" :default-expanded="true" :hide-params="true">
<BaseToolCall :tool-call="toolCall" :hide-params="true">
<template #header-success>
<span class="sep-header">
<span class="keywords">描述表结构</span>

View File

@ -1,5 +1,5 @@
<template>
<BaseToolCall :tool-call="toolCall" :default-expanded="true" :hide-params="true">
<BaseToolCall :tool-call="toolCall" :hide-params="true">
<template #header-success>
<span class="sep-header">
<span class="keywords">列出数据库表</span>

View File

@ -1,5 +1,5 @@
<template>
<BaseToolCall :tool-call="toolCall" :default-expanded="true">
<BaseToolCall :tool-call="toolCall">
<template #header-success>
<span class="sep-header">
<span class="keywords">执行SQL查询</span>

View File

@ -12,7 +12,7 @@
@click="toggleFile(fileGroup.filename)"
>
<div class="file-info">
<FileText :size="14" />
<FileText :size="14" color="var(--gray-600)" />
<span class="file-name">{{ fileGroup.filename }}</span>
<span class="chunk-count">{{ fileGroup.chunks.length }} chunks</span>
</div>
@ -109,17 +109,11 @@ const fileGroupList = computed(() => {
watch(
fileGroupList,
(groups) => {
//
//
const validFilenames = new Set(groups.map((item) => item.filename))
const nextExpanded = new Set(
expandedFiles.value = new Set(
[...expandedFiles.value].filter((filename) => validFilenames.has(filename))
)
for (const group of groups) {
if (group.chunks.length === 1) {
nextExpanded.add(group.filename)
}
}
expandedFiles.value = nextExpanded
},
{ immediate: true }
)
@ -200,7 +194,6 @@ const openChunkDetail = (chunk, index) => {
.file-name {
font-size: 13px;
font-weight: 500;
color: var(--gray-700);
flex: 1;
min-width: 0;