feat(文档向量): 添加文档向量管理功能

- 新增文档向量查询接口和更新接口
- 重构文档详情弹窗,将切片展示改为向量列表展示
- 优化表格模板语法使用解构写法
- 统一文件计数字段名为documentCount
This commit is contained in:
2026-04-13 15:16:08 +08:00
parent 919aaa195d
commit 3055da01c7
3 changed files with 168 additions and 116 deletions

View File

@@ -27,7 +27,7 @@
</div>
<div class="card-info">
<div class="card-name">{{ item.name }}</div>
<div class="card-meta">{{ item.fileCount || 0 }} 个文件</div>
<div class="card-meta">{{ item.documentCount || 0 }} 个文件</div>
<div class="card-time">{{ item.createdAt }}</div>
</div>
<!-- 悬停操作按钮 -->
@@ -78,7 +78,7 @@
</div>
<div class="profile-info">
<div class="profile-name">{{ currentknowledge.name }}</div>
<div class="profile-meta">{{ currentknowledge.fileCount || 0 }} 个文件 · {{ formatFileSize(currentknowledge.totalSize || 0) }}</div>
<div class="profile-meta">{{ currentknowledge.documentCount || 0 }} 个文件 · {{ formatFileSize(currentknowledge.totalSize || 0) }}</div>
<div class="profile-time">创建于 {{ currentknowledge.createdAt }}</div>
</div>
</div>
@@ -128,37 +128,29 @@
<div class="file-table" v-loading="fileLoading">
<el-table :data="fileList" style="width: 100%" row-key="id" border>
<el-table-column prop="title" label="名称" min-width="200">
<template #default="scope">
<span class="file-link" @click="onViewDocumentDetail(scope.row)" style="cursor: pointer; color: #409eff">{{
scope.row.title
}}</span>
<template #default="{ row }">
<span class="file-link" @click="onViewDocumentDetail(row)" style="cursor: pointer; color: #409eff">{{ row.title }}</span>
</template>
</el-table-column>
<el-table-column prop="chunkCount" label="分块数" width="80" align="center" />
<el-table-column prop="status" label="状态" width="90" align="center">
<template #default="scope">
<el-switch
v-model="scope.row.statusEnabled"
inline-prompt
active-text=""
inactive-text=""
@change="onFileStatusChange(scope.row)"
/>
<template #default="{ row }">
<el-switch v-model="row.statusEnabled" inline-prompt active-text="启" inactive-text="停" @change="onFileStatusChange(row)" />
</template>
</el-table-column>
<el-table-column prop="vectorStatus" label="向量化" width="100" align="center">
<template #default="scope">
<el-tag :type="scope.row.vectorStatus === 2 ? 'success' : 'warning'" size="small">
{{ scope.row.vectorStatus === 2 ? '已完成' : '未完成' }}
<template #default="{ row }">
<el-tag :type="row.vectorStatus === 2 ? 'success' : 'warning'" size="small">
{{ row.vectorStatus === 2 ? '已完成' : '未完成' }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="createdAt" label="上传日期" width="180" />
<el-table-column label="动作" width="180" align="center">
<template #default="scope">
<el-button text size="small" @click="onPreviewFile(scope.row)">预览</el-button>
<el-button text size="small" type="primary" @click="onGenerateVector(scope.row)">生成向量</el-button>
<el-button text size="small" type="danger" @click="onDeleteFile(scope.row)">删除</el-button>
<template #default="{ row }">
<el-button text size="small" @click="onPreviewFile(row)">预览</el-button>
<el-button text size="small" type="primary" @click="onGenerateVector(row)">生成向量</el-button>
<el-button text size="small" type="danger" @click="onDeleteFile(row)">删除</el-button>
</template>
</el-table-column>
</el-table>