|
@@ -264,14 +264,17 @@
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { onMounted, onBeforeMount, reactive, ref, nextTick, onUnmounted, onBeforeUnmount, computed } from 'vue';
|
|
import { onMounted, onBeforeMount, reactive, ref, nextTick, onUnmounted, onBeforeUnmount, computed } from 'vue';
|
|
|
-// import { kbdocumentupload, queryKbList, queryModelList } from '@/api/kbList';
|
|
|
|
|
|
|
+// import { kbdocumentupload, queryKbList, queryModelList } from '../../../apis/rgflow-dify';
|
|
|
|
|
+import { queryKbList, queryModelList, createRgFlow } from '../../../apis/rgflow-dify';
|
|
|
|
|
+import { createDialog } from '../../../apis/intelligent';
|
|
|
|
|
+import { dialogType } from '../../../views/manage/common';
|
|
|
import useLoading from './loading';
|
|
import useLoading from './loading';
|
|
|
import Upload from './Upload.vue';
|
|
import Upload from './Upload.vue';
|
|
|
import { Message } from '@arco-design/web-vue';
|
|
import { Message } from '@arco-design/web-vue';
|
|
|
// import { dialogSet } from '@/api/Agent';
|
|
// import { dialogSet } from '@/api/Agent';
|
|
|
|
|
|
|
|
const props = defineProps(['show_rg_config', 'typeAngint', 'formData']);
|
|
const props = defineProps(['show_rg_config', 'typeAngint', 'formData']);
|
|
|
-const emit = defineEmits(['queryList', 'update:show_rg_config']);
|
|
|
|
|
|
|
+const emit = defineEmits(['queryList', 'update:show_rg_config', 'updateIntelligentList']);
|
|
|
|
|
|
|
|
const { loading, setLoading } = useLoading(true);
|
|
const { loading, setLoading } = useLoading(true);
|
|
|
const visible = computed(() => props.show_rg_config);
|
|
const visible = computed(() => props.show_rg_config);
|
|
@@ -433,7 +436,15 @@ const handleOpened = (el) => {
|
|
|
}, 100);
|
|
}, 100);
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
-
|
|
|
|
|
|
|
+const createOwnDialog = async (data, title) => {
|
|
|
|
|
+ console.log(data, 'data');
|
|
|
|
|
+ const res = await createDialog(data);
|
|
|
|
|
+ if (res.code == 200) {
|
|
|
|
|
+ Message.success(title);
|
|
|
|
|
+ handleCancel();
|
|
|
|
|
+ emit('updateIntelligentList');
|
|
|
|
|
+ }
|
|
|
|
|
+};
|
|
|
const handleBeforeOk = async (done) => {
|
|
const handleBeforeOk = async (done) => {
|
|
|
formRef.value.validate().then((res) => {
|
|
formRef.value.validate().then((res) => {
|
|
|
// console.log('res:', res)
|
|
// console.log('res:', res)
|
|
@@ -444,6 +455,9 @@ const handleBeforeOk = async (done) => {
|
|
|
formRef2.value.validate().then((res) => {
|
|
formRef2.value.validate().then((res) => {
|
|
|
// console.log('res:', res)
|
|
// console.log('res:', res)
|
|
|
});
|
|
});
|
|
|
|
|
+ // TODO: 先写死知识库和模型
|
|
|
|
|
+ form.kb_ids = ['5e96cc5aad3111ef93990242ac130006'];
|
|
|
|
|
+ form.llm_id = 'qwen-2.5-72b-instruct___OpenAI-API@OpenAI-API-Compatible';
|
|
|
if (form.name && form.kb_ids.length > 0 && form.prompt_config.system && form.llm_id) {
|
|
if (form.name && form.kb_ids.length > 0 && form.prompt_config.system && form.llm_id) {
|
|
|
let title = '创建成功';
|
|
let title = '创建成功';
|
|
|
let formNew = { ...form };
|
|
let formNew = { ...form };
|
|
@@ -478,15 +492,27 @@ const handleBeforeOk = async (done) => {
|
|
|
|
|
|
|
|
setLoading(true);
|
|
setLoading(true);
|
|
|
try {
|
|
try {
|
|
|
- // const data = await dialogSet(formNew);
|
|
|
|
|
- // if (data.code == 0) {
|
|
|
|
|
- // Message.success(title);
|
|
|
|
|
- // handleCancel();
|
|
|
|
|
- // TODO: 刷新列表
|
|
|
|
|
- // EventBus.emit('queryList');
|
|
|
|
|
- // } else {
|
|
|
|
|
- // Message.error(data.msg);
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ const res = await createRgFlow(formNew);
|
|
|
|
|
+ if (res.data.id && res.data.id.length) {
|
|
|
|
|
+ const dialogData = {
|
|
|
|
|
+ id: res.data.id,
|
|
|
|
|
+ name: form.name,
|
|
|
|
|
+ description: '',
|
|
|
|
|
+ icon: form.icon,
|
|
|
|
|
+ dialogType: dialogType.RAGFLOW_TYPE,
|
|
|
|
|
+ mode: 'ragflow'
|
|
|
|
|
+ };
|
|
|
|
|
+ // TODO: 调用自己系统的新增
|
|
|
|
|
+ if (props.typeAngint == 'add') {
|
|
|
|
|
+ createOwnDialog(dialogData, title);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ emit('updateIntelligentList');
|
|
|
|
|
+ handleCancel();
|
|
|
|
|
+ Message.success(title);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Message.error(data.msg);
|
|
|
|
|
+ }
|
|
|
done(true);
|
|
done(true);
|
|
|
setLoading(false);
|
|
setLoading(false);
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
@@ -537,35 +563,35 @@ function handleTabChange(key) {
|
|
|
activeKey.value = key;
|
|
activeKey.value = key;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-const queryModel = async (params) => {
|
|
|
|
|
|
|
+const queryModel = async () => {
|
|
|
try {
|
|
try {
|
|
|
- // const data = await queryModelList(params);
|
|
|
|
|
- // const arrObj = {};
|
|
|
|
|
- // for (const key in data.data) {
|
|
|
|
|
- // if (Object.hasOwnProperty.call(data.data, key)) {
|
|
|
|
|
- // const element = data.data[key];
|
|
|
|
|
- // arrObj[key] = element.filter((item) => item.available === true && item.model_type === 'chat');
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // modelList.value = arrObj;
|
|
|
|
|
- // rankModelList.value = {
|
|
|
|
|
- // BAAI: [data.data.BAAI[1]],
|
|
|
|
|
- // Jina: data.data.Jina,
|
|
|
|
|
- // youdao: data.data.youdao
|
|
|
|
|
- // };
|
|
|
|
|
|
|
+ const data = await queryModelList();
|
|
|
|
|
+ const arrObj = {};
|
|
|
|
|
+ for (const key in data.data) {
|
|
|
|
|
+ if (Object.hasOwnProperty.call(data.data, key)) {
|
|
|
|
|
+ const element = data.data[key];
|
|
|
|
|
+ arrObj[key] = element.filter((item) => item.available === true && item.model_type === 'chat');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ modelList.value = arrObj;
|
|
|
|
|
+ rankModelList.value = {
|
|
|
|
|
+ BAAI: [data.data.BAAI[1]],
|
|
|
|
|
+ Jina: data.data.Jina,
|
|
|
|
|
+ youdao: data.data.Youdao
|
|
|
|
|
+ };
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
// you can report use errorHandler or other
|
|
// you can report use errorHandler or other
|
|
|
} finally {
|
|
} finally {
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-const knowledgeData = async (params = { page: 1, page_size: 20 }) => {
|
|
|
|
|
|
|
+const knowledgeData = async () => {
|
|
|
setLoading(true);
|
|
setLoading(true);
|
|
|
try {
|
|
try {
|
|
|
- // const { data } = await queryKbList(params);
|
|
|
|
|
- // nextTick(() => {
|
|
|
|
|
- // tabs.value = data;
|
|
|
|
|
- // });
|
|
|
|
|
|
|
+ const { data } = await queryKbList();
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ tabs.value = data;
|
|
|
|
|
+ });
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
// you can report use errorHandler or other
|
|
// you can report use errorHandler or other
|
|
|
} finally {
|
|
} finally {
|
|
@@ -574,7 +600,7 @@ const knowledgeData = async (params = { page: 1, page_size: 20 }) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onBeforeMount(() => {
|
|
onBeforeMount(() => {
|
|
|
- queryModel({});
|
|
|
|
|
|
|
+ queryModel();
|
|
|
knowledgeData();
|
|
knowledgeData();
|
|
|
});
|
|
});
|
|
|
onMounted(() => {});
|
|
onMounted(() => {});
|