重构知识库相关接口,更新数据结构和命名,移除示例文件,调整组件和视图以支持新命名,优化文档和数据集管理功能。
This commit is contained in:
@@ -13,22 +13,20 @@
|
||||
<div class="document-content">
|
||||
<div class="content-header">
|
||||
<h2>{{ documentInfo.name }}</h2>
|
||||
<div class="content-meta">
|
||||
Size:{{ formatFileSize(documentInfo.fileSize) }} Uploaded Time:{{ documentInfo.createdAt }}
|
||||
</div>
|
||||
<div class="content-meta">Size:{{ formatFileSize(documentInfo.fileSize) }} Uploaded Time:{{ documentInfo.createdAt }}</div>
|
||||
</div>
|
||||
<div class="content-body" v-loading="contentLoading">
|
||||
<pre class="document-text">{{ documentContent }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 右侧:切片结果 -->
|
||||
<div class="chunk-panel">
|
||||
<div class="panel-header">
|
||||
<h3>切片结果</h3>
|
||||
<div class="panel-subtitle">查看用于嵌入和召回的切片段落。</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel-toolbar">
|
||||
<div class="toolbar-tabs">
|
||||
<el-radio-group v-model="viewMode" size="small">
|
||||
@@ -37,13 +35,7 @@
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<el-input
|
||||
v-model="chunkSearch"
|
||||
placeholder="搜索"
|
||||
clearable
|
||||
size="small"
|
||||
style="width: 120px"
|
||||
>
|
||||
<el-input v-model="chunkSearch" placeholder="搜索" clearable size="small" style="width: 120px">
|
||||
<template #prefix>
|
||||
<el-icon><ele-Search /></el-icon>
|
||||
</template>
|
||||
@@ -53,17 +45,13 @@
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="chunk-list" v-loading="chunkLoading">
|
||||
<div class="select-all">
|
||||
<el-checkbox v-model="selectAll" @change="onSelectAllChange">选择所有</el-checkbox>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="chunk-item"
|
||||
v-for="chunk in filteredChunks"
|
||||
:key="chunk.id"
|
||||
>
|
||||
|
||||
<div class="chunk-item" v-for="chunk in filteredChunks" :key="chunk.id">
|
||||
<div class="chunk-checkbox">
|
||||
<el-checkbox v-model="chunk.selected" />
|
||||
</div>
|
||||
@@ -74,10 +62,10 @@
|
||||
<el-switch v-model="chunk.enabled" size="small" @change="onChunkStatusChange(chunk)" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<el-empty v-if="filteredChunks.length === 0 && !chunkLoading" description="暂无切片" :image-size="60" />
|
||||
</div>
|
||||
|
||||
|
||||
<!-- 分页 -->
|
||||
<div class="panel-footer">
|
||||
<span class="total-info">总共 {{ chunkTotal }} 条</span>
|
||||
@@ -112,8 +100,8 @@ import { ElMessage } from 'element-plus';
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean;
|
||||
datasetId: string;
|
||||
datasetName: string;
|
||||
knowledgeId: string;
|
||||
knowledgeName: string;
|
||||
document: any;
|
||||
}>();
|
||||
|
||||
@@ -150,9 +138,7 @@ const selectAll = ref(false);
|
||||
// 过滤后的切片列表
|
||||
const filteredChunks = computed(() => {
|
||||
if (!chunkSearch.value) return chunkList.value;
|
||||
return chunkList.value.filter((chunk) =>
|
||||
(chunk.content || '').toLowerCase().includes(chunkSearch.value.toLowerCase())
|
||||
);
|
||||
return chunkList.value.filter((chunk) => (chunk.content || '').toLowerCase().includes(chunkSearch.value.toLowerCase()));
|
||||
});
|
||||
|
||||
// 格式化文件大小
|
||||
@@ -179,7 +165,7 @@ const getDocumentDetail = async () => {
|
||||
documentInfo.fileType = props.document?.fileType || 'txt';
|
||||
documentInfo.fileSize = props.document?.fileSize || 10;
|
||||
documentInfo.createdAt = props.document?.createdAt || '22/01/2026 00:53:32';
|
||||
|
||||
|
||||
// 模拟文档内容
|
||||
documentContent.value = '<p>123</p>';
|
||||
} catch (_error) {
|
||||
@@ -215,7 +201,7 @@ const getChunkList = async () => {
|
||||
|
||||
// 全选变化
|
||||
const onSelectAllChange = (val: boolean) => {
|
||||
chunkList.value.forEach(chunk => {
|
||||
chunkList.value.forEach((chunk) => {
|
||||
chunk.selected = val;
|
||||
});
|
||||
};
|
||||
@@ -231,12 +217,15 @@ const onAddChunk = () => {
|
||||
};
|
||||
|
||||
// 监听弹窗打开
|
||||
watch(() => props.modelValue, (val) => {
|
||||
if (val && props.document) {
|
||||
getDocumentDetail();
|
||||
getChunkList();
|
||||
watch(
|
||||
() => props.modelValue,
|
||||
(val) => {
|
||||
if (val && props.document) {
|
||||
getDocumentDetail();
|
||||
getChunkList();
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
@@ -250,7 +239,7 @@ watch(() => props.modelValue, (val) => {
|
||||
.drawer-content {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
|
||||
|
||||
// 左侧文档内容
|
||||
.document-content {
|
||||
flex: 1;
|
||||
@@ -258,30 +247,30 @@ watch(() => props.modelValue, (val) => {
|
||||
flex-direction: column;
|
||||
border-right: 1px solid #ebeef5;
|
||||
overflow: hidden;
|
||||
|
||||
|
||||
.content-header {
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
|
||||
h2 {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
|
||||
.content-meta {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.content-body {
|
||||
flex: 1;
|
||||
padding: 16px 20px;
|
||||
overflow: auto;
|
||||
background: #fafafa;
|
||||
|
||||
|
||||
.document-text {
|
||||
margin: 0;
|
||||
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
|
||||
@@ -293,53 +282,53 @@ watch(() => props.modelValue, (val) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 右侧切片面板
|
||||
.chunk-panel {
|
||||
width: 420px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: #fff;
|
||||
|
||||
|
||||
.panel-header {
|
||||
padding: 16px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
|
||||
h3 {
|
||||
margin: 0 0 4px 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
|
||||
.panel-subtitle {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.panel-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 20px;
|
||||
border-bottom: 1px solid #ebeef5;
|
||||
|
||||
|
||||
.toolbar-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.chunk-list {
|
||||
flex: 1;
|
||||
overflow: auto;
|
||||
padding: 12px 20px;
|
||||
|
||||
|
||||
.select-all {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
|
||||
.chunk-item {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
@@ -348,16 +337,16 @@ watch(() => props.modelValue, (val) => {
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
border: 1px solid #ebeef5;
|
||||
|
||||
|
||||
.chunk-checkbox {
|
||||
margin-right: 12px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
|
||||
.chunk-content {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
|
||||
.chunk-text {
|
||||
font-size: 14px;
|
||||
color: #303133;
|
||||
@@ -365,14 +354,14 @@ watch(() => props.modelValue, (val) => {
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.chunk-actions {
|
||||
margin-left: 12px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.panel-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -380,7 +369,7 @@ watch(() => props.modelValue, (val) => {
|
||||
gap: 12px;
|
||||
padding: 12px 20px;
|
||||
border-top: 1px solid #ebeef5;
|
||||
|
||||
|
||||
.total-info {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
|
||||
Reference in New Issue
Block a user