|
|
@@ -123,6 +123,9 @@
|
|
|
import { onMounted, onBeforeMount, reactive, ref, watch, computed } from 'vue';
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
import { kbretrievalTest, queryModelList } from '../../../../apis/rgflow-dify';
|
|
|
+import { useI18n } from 'vue-i18n';
|
|
|
+
|
|
|
+const { t } = useI18n();
|
|
|
|
|
|
let visible = ref(false);
|
|
|
let loading = ref(false);
|
|
|
@@ -177,19 +180,24 @@ const handleSubmit = async ({ values, errors }) => {
|
|
|
loading.value = true;
|
|
|
const data = await kbretrievalTest(formObj);
|
|
|
if (data.retcode == 0) {
|
|
|
- Message.success('测试成功');
|
|
|
+ Message.success(t('knowledgeLib.test_success'));
|
|
|
all_chunks.value = data.data.chunks;
|
|
|
docList.value = data.data.doc_aggs;
|
|
|
- checked_list.value.push(docList.value[0].doc_id);
|
|
|
- chunks.value = all_chunks.value.filter((item) => item.doc_id == checked_list.value[0]);
|
|
|
+ if (docList.value.length) {
|
|
|
+ checked_list.value.push(docList.value[0].doc_id);
|
|
|
+ }
|
|
|
+ if (all_chunks.value.length) {
|
|
|
+ chunks.value = all_chunks.value?.filter((item) => item?.doc_id == checked_list.value[0]);
|
|
|
+ }
|
|
|
doc_pagination_props.total = docList.value.length;
|
|
|
doc_total.value = data.data.doc_aggs.length;
|
|
|
chunk_total.value = data.data.chunks.length;
|
|
|
} else {
|
|
|
- Message.error('测试失败');
|
|
|
+ Message.error(data.retmsg);
|
|
|
}
|
|
|
loading.value = false;
|
|
|
} catch (err) {
|
|
|
+ console.log(err);
|
|
|
Message.error(err.message);
|
|
|
loading.value = false;
|
|
|
}
|