| | |
| | | import { onMounted, onBeforeMount, reactive, ref } from "vue"; |
| | | import { Message } from "@arco-design/web-vue"; |
| | | import { queryModelList,kbUpdate } from "@/api/kbList"; |
| | | import message from "@arco-design/web-vue/es/message"; |
| | | |
| | | |
| | | const props = defineProps(['kbtenantInfo']) |
| | | // const emit = defineEmits(['upTabdateItem']) |
| | | const kbtenantInfo = props.kbtenantInfo; |
| | | // 解析方法列表 |
| | | let parser_ids = kbtenantInfo.parser_ids.split(",").map((item) => { |
| | | let parser_ids = props.kbtenantInfo.parser_ids.split(",").map((item) => { |
| | | const [value1, value2] = item.split(":"); |
| | | return { |
| | | name: value2, |
| | |
| | | if (errors){ |
| | | return; |
| | | } |
| | | console.log(form); |
| | | let parms = { |
| | | name: form.name, |
| | | avatar: form.avatar, |
| | |
| | | }, |
| | | kb_id: kbObj.id, |
| | | } |
| | | if(form.layout_recognize){ |
| | | if(form.use_raptor){ |
| | | parms.parser_config.raptor = { |
| | | use_raptor: form.use_raptor, |
| | | prompt: form.prompt, |
| | |
| | | random_seed: form.random_seed, |
| | | }; |
| | | } |
| | | |
| | | |
| | | try { |
| | | |
| | | const data = await kbUpdate(parms); |
| | |
| | | Message.success("配置成功"); |
| | | // window.location.reload(); |
| | | } |
| | | // visible.value = false; |
| | | // emit('upTabdateItem') |
| | | |
| | | } catch (err) { |
| | | // you can report use errorHandler or other |
| | | Message.error(err.message); |
| | | } |
| | | |
| | | |
| | |
| | | form.random_seed = Math.floor(Math.random() * (max - min + 1)) + min; |
| | | } |
| | | |
| | | const onChangeRAPTOR = () => { |
| | | console.log(form); |
| | | }; |
| | | |
| | | |
| | | const handleClick = () => { |
| | | visible.value = true; |
| | | }; |
| | | const handleBeforeOk = (done) => { |
| | | formRef.value.validate().then(res => { |
| | | console.log("form:", form); |
| | |
| | | } |
| | | }); |
| | | }; |
| | | const handleCancel = () => { |
| | | visible.value = false; |
| | | }; |
| | | |
| | | const handleOpened =(el) => { |
| | | Object.assign(form,{ |
| | | |
| | |
| | | }; |
| | | |
| | | const changekbObj = (value) => { |
| | | formRef.value.resetFields(); |
| | | kbObj = value; |
| | | console.log(kbObj, 'kbObj'); |
| | | // if(kbObj.avatar){ |
| | |
| | | let configObj = { |
| | | name: kbObj.name, |
| | | avatar: kbObj.avatar, |
| | | chunk_token_num: kbObj.parser_config ? kbObj.parser_config.chunk_token_num : 128, |
| | | pages: kbObj.pages, |
| | | chunk_token_num: kbObj.parser_config.chunk_token_num, |
| | | pages: kbObj.parser_config.pages, |
| | | description: kbObj.description, |
| | | language: "English", |
| | | permission: kbObj.permission, |
| | | embd_id: "BAAI/bge-large-zh-v1.5", |
| | | embd_id: props.kbtenantInfo.embd_id || kbObj.embd_id, |
| | | parser_id: kbObj.parser_id, |
| | | layout_recognize: kbObj.parser_config ? kbObj.parser_config.layout_recognize:false, |
| | | layout_recognize: true, |
| | | } |
| | | let raptor = {} |
| | | if(kbObj.parser_config && kbObj.parser_config.raptor){ |
| | |
| | | Object.assign(form,{ |
| | | ...configObj, |
| | | ...raptor, |
| | | use_raptor: kbObj.parser_config.raptor.use_raptor, |
| | | }); |
| | | }else{ |
| | | Object.assign(form,configObj); |
| | | } |
| | | |
| | | console.log(form,'配置页面表单信息'); |
| | | } |
| | | |
| | | defineExpose({ |