@@ -301,6 +363,8 @@ export default {
},
activeTab: 'upload',
selectedFile: null,
+ chunkSize: null,
+ overlap: null,
uploading: false,
searchQuery: '',
searchResults: [],
@@ -323,7 +387,7 @@ export default {
embeddingModelProps(providerConfig) {
return {
title: providerConfig.embedding_model,
- subtitle: `提供商 ID: ${providerConfig.id}`,
+ subtitle: `提供商 ID: ${providerConfig.id} | 嵌入模型维度: ${providerConfig.embedding_dimensions}`,
}
},
checkPlugin() {
@@ -439,6 +503,9 @@ export default {
this.searchQuery = '';
this.searchResults = [];
this.searchPerformed = false;
+ // 重置分片长度和重叠长度参数
+ this.chunkSize = null;
+ this.overlap = null;
},
triggerFileInput() {
@@ -492,6 +559,15 @@ export default {
const formData = new FormData();
formData.append('file', this.selectedFile);
formData.append('collection_name', this.currentKB.collection_name);
+
+ // 添加可选的分片长度和重叠长度参数
+ if (this.chunkSize && this.chunkSize > 0) {
+ formData.append('chunk_size', this.chunkSize);
+ }
+
+ if (this.overlap && this.overlap >= 0) {
+ formData.append('chunk_overlap', this.overlap);
+ }
axios.post('/api/plug/alkaid/kb/collection/add_file', formData, {
headers: {
@@ -500,7 +576,7 @@ export default {
})
.then(response => {
if (response.data.status === 'ok') {
- this.showSnackbar('文件上传成功');
+ this.showSnackbar('操作成功: ' + response.data.message);
this.selectedFile = null;
// 刷新知识库列表,获取更新的数量
@@ -792,4 +868,28 @@ export default {
.kb-card:hover .kb-actions {
opacity: 1;
}
+
+.chunk-settings-card {
+ border: 1px solid rgba(92, 107, 192, 0.2) !important;
+ transition: all 0.3s ease;
+}
+
+.chunk-settings-card:hover {
+ border-color: rgba(92, 107, 192, 0.4) !important;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07) !important;
+}
+
+.chunk-field :deep(.v-field__input) {
+ padding-top: 8px;
+ padding-bottom: 8px;
+}
+
+.chunk-field :deep(.v-field__prepend-inner) {
+ padding-right: 8px;
+ opacity: 0.7;
+}
+
+.chunk-field:focus-within :deep(.v-field__prepend-inner) {
+ opacity: 1;
+}