Browse Source

知识库设置

CzRger 2 weeks ago
parent
commit
afe381d13a
2 changed files with 14 additions and 1 deletions
  1. 10 1
      src/views/manage/app/make/index.vue
  2. 4 0
      src/views/manage/knowledge/recall-config.vue

+ 10 - 1
src/views/manage/app/make/index.vue

@@ -646,6 +646,7 @@
       </div>
     </div>
     <recallConfig
+      ref="ref_recalConfig"
       v-model:show="state.recallConfig.show"
       :transfer="state.recallConfig.transfer"
       @refresh="getRecallConfig"
@@ -770,6 +771,7 @@ const state: any = reactive({
     modelId: '',
     components: [],
     datasetIds: [],
+    datasetConfigs: null,
     workflowId: '',
     prologue: '',
     prologueQuestions: [],
@@ -826,6 +828,7 @@ const ref_formPublish = ref()
 const ref_tips = ref()
 const ref_prologue = ref()
 const ref_prologueBody = ref()
+const ref_recalConfig = ref()
 const ref_chat = ref()
 const canPublishCpt = computed(() => {
   if (state.config.createTime === state.config.updateTime) {
@@ -875,6 +878,11 @@ const autoSave = debounce((v) => {
   if (state.detail.type === 0) {
     params.modelId = state.form.modelId
     params.datasetIds = state.form.datasetIds
+    console.log(state.form.datasetConfigs)
+    if (!state.form.datasetConfigs) {
+      state.form.datasetConfigs = ref_recalConfig.value.getData()
+    }
+    params.datasetConfigs = state.form.datasetConfigs
   } else {
     params.workflowId = state.form.workflowId
   }
@@ -927,6 +935,7 @@ const initDetail = () => {
             if (state.detail.type === 0) {
               state.form.modelId = configData.modelId || ''
               state.form.datasetIds = configData.datasetIds || []
+              state.form.datasetConfigs = configData.datasetConfigs
             } else {
               state.form.workflowId = configData.workflowId
             }
@@ -1231,7 +1240,7 @@ const onRecall = () => {
   state.recallConfig.show = true
 }
 const getRecallConfig = (config) => {
-  console.log(config)
+  state.form.datasetConfigs = { ...config }
 }
 onMounted(() => {
   initDictionary()

+ 4 - 0
src/views/manage/knowledge/recall-config.vue

@@ -307,6 +307,7 @@ const onSubmit = () => {
 }
 onMounted(() => {
   initDictionary()
+  reset()
 })
 const initDictionary = () => {
   pluginGetListByType({ type: 'RERANK' })
@@ -319,6 +320,9 @@ const initDictionary = () => {
     })
     .catch(() => {})
 }
+defineExpose({
+  getData: () => ({ ...state.config }),
+})
 </script>
 
 <style lang="scss" scoped>