fix(web): 更新工具组件,优化界面显示和逻辑处理
This commit is contained in:
parent
43188c77c0
commit
59dcc6330b
@ -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">
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user