CzRger 2 månader sedan
förälder
incheckning
1cfb33d3d3

+ 5 - 14
src/views/manage/knowledge/upload/index.vue

@@ -195,7 +195,7 @@
               class="flex flex-1 flex-col overflow-hidden rounded-[0.25rem] border border-[var(--czr-main-color)] p-4"
             >
               <div class="flex-1 overflow-y-auto">
-                <stageConfig />
+                <stageConfig ref="ref_stageConfig" />
               </div>
               <div class="mt-4">
                 <CzrButton type="normal" title="预览块" @click="onTextView" />
@@ -428,7 +428,7 @@ const state: any = reactive({
   ID: route.params.id,
   knowledge: {},
   uploadType: UploadTypeEnum.Text,
-  step: 2,
+  step: 1,
   uploadFiles: new Map(),
   uploadFileList: [],
   previewFile: '',
@@ -451,6 +451,7 @@ const state: any = reactive({
     success: new Map(),
   },
 })
+const ref_stageConfig = ref()
 const UploadConfig = {
   limit: 50,
   maxSize: 100,
@@ -566,12 +567,7 @@ const onTextView = () => {
   state.query.loading = true
   datasetsDocumentsDealView({
     fileId: state.previewFile,
-    contentConfig: {
-      maxParentSize: 500,
-      overlapSize: 20,
-      parentSeparator: '\n\n',
-      splitType: 'CustomSymbolSplitter',
-    },
+    contentConfig: ref_stageConfig.value.getData(),
   })
     .then(({ data }: any) => {
       state.query.result.data = data.contentResult
@@ -628,12 +624,7 @@ const initTask = () => {
       datasetDocumentList: state.uploadFileList.map((v) => ({
         name: v.name,
         fileId: v.url,
-        contentConfig: {
-          maxParentSize: 500,
-          overlapSize: 20,
-          parentSeparator: '\n\n',
-          splitType: 'CustomSymbolSplitter',
-        },
+        contentConfig: ref_stageConfig.value.getData(),
       })),
     }).then(() => {
       state.uploadFileList.forEach((v) => {

+ 36 - 68
src/views/manage/knowledge/upload/stage-config.vue

@@ -472,76 +472,44 @@ const reset = () => {
     },
   }
 }
-const getData = () => {}
-const init = ({ indexingTechnique, embeddingModelId, indexConfig }) => {
-  reset()
-  if (props.indexMethod) {
-    state.indexMethod.value = indexingTechnique
-  }
-  if (props.embedding) {
-    state.embedding.value = embeddingModelId
+const getData = () => {
+  const result: any = {
+    splitType: state.config.value,
   }
-  if (props.searchMethod) {
-    state.searchMethod.value = indexConfig.type
-    switch (state.searchMethod.value) {
-      case SearchMethodType.Vector:
-        {
-          state.searchMethod[SearchMethodType.Vector].isRerank = Number(
-            indexConfig.isRerank,
-          )
-          state.searchMethod[SearchMethodType.Vector].rerank =
-            indexConfig.rerankTypeId
-          state.searchMethod[SearchMethodType.Vector].topK = Number(
-            indexConfig.topK,
-          )
-          state.searchMethod[SearchMethodType.Vector].isScore = Number(
-            indexConfig.isScore,
-          )
-          state.searchMethod[SearchMethodType.Vector].score = Number(
-            indexConfig.score,
-          )
-        }
-        break
-      case SearchMethodType.Global:
-        {
-          state.searchMethod[SearchMethodType.Global].isRerank = Number(
-            indexConfig.isRerank,
-          )
-          state.searchMethod[SearchMethodType.Global].rerank =
-            indexConfig.rerankTypeId
-          state.searchMethod[SearchMethodType.Global].topK = Number(
-            indexConfig.topK,
-          )
-          state.searchMethod[SearchMethodType.Global].isScore = Number(
-            indexConfig.isScore,
-          )
-          state.searchMethod[SearchMethodType.Global].score = Number(
-            indexConfig.score,
-          )
-        }
-        break
-      case SearchMethodType.Mix:
-        {
-          state.searchMethod[SearchMethodType.Mix].indexMethod =
-            indexConfig.weightRerank
-          state.searchMethod[SearchMethodType.Mix].weight = Number(
-            indexConfig.semantics,
-          )
-          state.searchMethod[SearchMethodType.Mix].rerank =
-            indexConfig.rerankTypeId
-          state.searchMethod[SearchMethodType.Mix].topK = Number(
-            indexConfig.topK,
-          )
-          state.searchMethod[SearchMethodType.Mix].isScore = Number(
-            indexConfig.isScore,
-          )
-          state.searchMethod[SearchMethodType.Mix].score = Number(
-            indexConfig.score,
-          )
-        }
-        break
-    }
+  switch (state.config.value) {
+    case StageMethodType.Fixed:
+      {
+        result.maxParentSize = state.config[StageMethodType.Fixed].max
+        result.overlapSize = state.config[StageMethodType.Fixed].overlap
+        result.isNewLine = state.config[StageMethodType.Fixed].replaceBlank
+        result.isEmail = state.config[StageMethodType.Fixed].delUrlEmail
+      }
+      break
+    case StageMethodType.Split:
+      {
+        result.parentSeparator = state.config[StageMethodType.Split].sign
+        result.maxParentSize = state.config[StageMethodType.Split].max
+        result.overlapSize = state.config[StageMethodType.Split].overlap
+        result.isNewLine = state.config[StageMethodType.Split].replaceBlank
+        result.isEmail = state.config[StageMethodType.Split].delUrlEmail
+      }
+      break
+    case StageMethodType.FatherSon:
+      {
+        result.parentSeparator =
+          state.config[StageMethodType.FatherSon].signFather
+        result.maxParentSize = state.config[StageMethodType.FatherSon].maxFather
+        result.childSeparator = state.config[StageMethodType.FatherSon].signSon
+        result.maxChildSize = state.config[StageMethodType.FatherSon].maxSon
+        result.isNewLine = state.config[StageMethodType.FatherSon].replaceBlank
+        result.isEmail = state.config[StageMethodType.FatherSon].delUrlEmail
+      }
+      break
   }
+  return result
+}
+const init = ({ contentConfig }) => {
+  reset()
 }
 onMounted(() => {
   initDictionary()