CzRger пре 2 недеља
родитељ
комит
53aeb4b063
2 измењених фајлова са 79 додато и 0 уклоњено
  1. 25 0
      src/views/manage/app/make/index.vue
  2. 54 0
      src/views/manage/knowledge/recall-config.vue

+ 25 - 0
src/views/manage/app/make/index.vue

@@ -174,6 +174,12 @@
                     <template v-if="state.form.datasetIds.length > 0">
                       ({{ state.form.datasetIds.length }})
                     </template>
+                    <div
+                      class="__hover ml-4 text-sm font-normal text-[var(--czr-main-color)]"
+                      @click="onRecall"
+                    >
+                      知识库设置
+                    </div>
                     <CzrButton
                       type="normal"
                       title="新增"
@@ -639,6 +645,11 @@
         </div>
       </div>
     </div>
+    <recallConfig
+      v-model:show="state.recallConfig.show"
+      :transfer="state.recallConfig.transfer"
+      @refresh="getRecallConfig"
+    />
     <knowledgeSelect
       v-model:show="state.knowledgeSelect.show"
       :transfer="state.knowledgeSelect.transfer"
@@ -735,6 +746,7 @@ import {
 } from '@/api/modules/app/make'
 import { appDetail } from '@/api/modules/app'
 import { appTextToAudio } from '@/api/modules/app/chat'
+import recallConfig from '@/views/manage/knowledge/recall-config.vue'
 
 const DictionaryStore = useDictionaryStore()
 const AppStore = useAppStore()
@@ -804,6 +816,10 @@ const state: any = reactive({
   canDebug: true,
   canModelApply: true,
   history: [],
+  recallConfig: {
+    show: false,
+    transfer: {},
+  },
 })
 const ref_form = ref()
 const ref_formPublish = ref()
@@ -1208,6 +1224,15 @@ const onRestart = () => {
   state.canDebug = true
   ref_chat.value?.init()
 }
+const onRecall = () => {
+  state.recallConfig.transfer = {
+    config: null,
+  }
+  state.recallConfig.show = true
+}
+const getRecallConfig = (config) => {
+  console.log(config)
+}
 onMounted(() => {
   initDictionary()
   initDetail()

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

@@ -171,6 +171,55 @@
                 </div>
               </div>
             </div>
+            <div
+              class="text-4 mt-4 flex flex-col gap-2 rounded-[0.25rem] bg-[#ffffff] p-2.5 font-bold text-[#2E3238]"
+            >
+              <div class="flex gap-4">
+                <div class="flex-1">
+                  <div class="flex h-4 items-center gap-2">
+                    无召回回复
+                    <el-tooltip
+                      content="当知识库没有召回有效切片时的回复话术"
+                      placement="top"
+                    >
+                      <SvgIcon name="czr_tip" size="14" />
+                    </el-tooltip>
+                    <div
+                      class="__hover text-sm font-normal text-[var(--czr-main-color)]"
+                      @click="
+                        state.config.noRecall =
+                          '对不起,我已经学习的知识中不包含问题相关内容,暂时无法提供答案。如果你有相关的其他问题,我会尝试帮助你解答。'
+                      "
+                    >
+                      重置
+                    </div>
+                    <div class="mx-auto" />
+                    <el-switch
+                      size="small"
+                      v-model="state.config.showSource"
+                      :active-value="1"
+                      :inactive-value="0"
+                    />
+                    显示来源
+                    <el-tooltip
+                      content="显示召回的知识库源文件。"
+                      placement="top"
+                    >
+                      <SvgIcon name="czr_tip" size="14" />
+                    </el-tooltip>
+                  </div>
+                  <div class="mt-4">
+                    <CzrFormColumn
+                      :span="24"
+                      label-width="0px"
+                      v-model:param="state.config.noRecall"
+                      type="textarea"
+                      :rows="4"
+                    />
+                  </div>
+                </div>
+              </div>
+            </div>
           </div>
         </div>
       </CzrForm>
@@ -208,6 +257,8 @@ const state: any = reactive({
     topK: 5,
     isScore: 1,
     score: 0.5,
+    noRecall: '',
+    showSource: 0,
   },
   optionsRerank: [],
 })
@@ -234,6 +285,9 @@ const reset = () => {
     topK: 5,
     isScore: 1,
     score: 0.5,
+    noRecall:
+      '对不起,我已经学习的知识中不包含问题相关内容,暂时无法提供答案。如果你有相关的其他问题,我会尝试帮助你解答。',
+    showSource: 0,
   }
 }
 const onSubmit = () => {