From 2d708ae88849b6f4213ce0c168237844d3423699 Mon Sep 17 00:00:00 2001
From: liudong <liudong>
Date: 星期六, 24 八月 2024 14:44:44 +0800
Subject: [PATCH] agent名称修改
---
src/views/sessionManager/components/updataFile.vue | 184 ++++++++++++++++++++++++++++++++++++---------
1 files changed, 145 insertions(+), 39 deletions(-)
diff --git a/src/views/sessionManager/components/updataFile.vue b/src/views/sessionManager/components/updataFile.vue
index 549ec2e..0caa68c 100644
--- a/src/views/sessionManager/components/updataFile.vue
+++ b/src/views/sessionManager/components/updataFile.vue
@@ -5,10 +5,9 @@
trigger="click"
position="tl">
<a-button
- :disabled="onFileSelectedLoading"
type="text"
style="border-radius: 24px"
- @click="visible = !visible"
+ @click="visibleChange"
>
<icon-attachment
size="28"
@@ -37,12 +36,18 @@
<div>
<span>瑙f瀽鏂规硶: </span>
<a-radio-group v-model="parser_id">
- <a-radio
- v-for="item in parser_ids"
- :key="item.value"
- :value="item.value"
- style="margin-right: 10px"
- >{{item.name}}</a-radio>
+ <a-popover title=""
+ v-for="item in parser_ids"
+ :key="item.value"
+ >
+ <a-radio
+ :value="item.value"
+ style="margin-right: 10px"
+ >{{item.name}}</a-radio>
+ <template #content>
+ <p style="max-width: 300px">{{item.parser_config_str}}</p>
+ </template>
+ </a-popover>
</a-radio-group>
</div>
<a-button
@@ -74,7 +79,6 @@
const filesBtn = ref(null);
const onFileSelectedLoading = ref(false);
const parser_id = ref("");
-const parser_ids = ref([]);
const uploaditemList = ref([]);
const activeSessionId = ref('');
let kbtenantInfo = reactive({
@@ -83,14 +87,13 @@
img2txt_id: 'qwen-vl-max',
llm_id: 'qwen-plus',
name: 'wanghaos Kingdom',
- parser_ids:
- 'naive:General,qa:Q&A,resume:Resume,manual:Manual,table:Table,paper:Paper,book:Book,laws:Laws,presentation:Presentation,picture:Picture,one:One',
+ // parser_ids: 'naive:General,qa:Q&A,resume:Resume,manual:Manual,table:Table,paper:Paper,book:Book,laws:Laws,presentation:Presentation,picture:Picture,one:One',
+ parser_ids: 'naive:閫氱敤,qa:Q&A,resume:绠�鍘�,manual:璇存槑涔�,table:琛ㄦ牸,paper:澶氭ā鎬�,book:涔︾睄,laws:娉曞緥鏂囦欢,presentation:PPT,picture:鍥剧墖,one:鏁翠綋',
rerank_id: 'BAAI/bge-reranker-v2-m3',
role: 'owner',
tenant_id: '948fc6fa41ab11ef8fb80242ac120004',
parser_idObj: {},
});
-const uploadList = ref([]);
const parser = reactive({
naive: {
"chunk_token_num": 676,
@@ -104,8 +107,91 @@
"random_seed": 1500
}
}, // 鐢ㄦ埛鍚�
+ qa: {},
+ resume: {},
+ manual: {},
+ table: {},
+ paper: {},
+ book: {},
+ laws: {},
+ presentation: {},
+ picture: {},
+ one: {},
});
+const parser_ids = ref([
+ {
+ name: '閫氱敤',
+ value: 'naive',
+ parser_config: parser.naive,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负DOCX銆丒XCEL銆丳PT銆両MAGE銆丳DF銆乀XT'
+ },
+ {
+ name: 'Q&A',
+ value: 'qa',
+ parser_config: parser.qa,
+ parser_config_str: '鏀寔 excel 鍜� csv/txt 鏂囦欢鏍煎紡銆� \n' +
+ '濡傛灉鏂囦欢浠� excel 鏍煎紡锛屽垯搴旂敱涓や釜鍒楃粍鎴� 娌℃湁鏍囬锛氫竴涓彁鍑洪棶棰橈紝鍙︿竴涓敤浜庣瓟妗堬紝 绛旀鍒椾箣鍓嶇殑闂鍒椼�俓n' +
+ '濡傛灉鏂囦欢浠� csv/txt 鏍煎紡涓� 鐢ㄤ綔鍒嗗紑闂鍜岀瓟妗堢殑瀹氱晫绗︺�俓n'
+ },
+ {
+ name: '绠�鍘�',
+ value: 'resume',
+ parser_config: parser.resume,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负DOCX銆丳DF銆乀XT'
+ },
+ {
+ name: '璇存槑涔�',
+ value: 'manual',
+ parser_config: parser.manual,
+ parser_config_str: '浠呮敮鎸丳DF'
+ },
+ {
+ name: '琛ㄦ牸',
+ value: 'table',
+ parser_config: parser.table,
+ parser_config_str: '鏀寔EXCEL鍜孋SV/TXT鏍煎紡鏂囥�� \n' +
+ '瀵逛簬 csv 鎴� txt 鏂囦欢锛屽垪涔嬮棿鐨勫垎闅旂涓� TAB锛孿n' +
+ '绗竴琛屽繀椤绘槸鍒楁爣棰樸�俓n'
+ },
+ {
+ name: '澶氭ā鎬�',
+ value: 'paper',
+ parser_config: parser.paper,
+ parser_config_str: '浠呮敮鎸丳DF鏂囦欢'
+ },
+ {
+ name: '涔︾睄',
+ value: 'book',
+ parser_config: parser.book,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负DOCX銆丳DF銆乀XT'
+ },
+ {
+ name: '娉曞緥鏂囦欢',
+ value: 'laws',
+ parser_config: parser.laws,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负DOCX銆丳DF銆乀XT'
+ },
+ {
+ name: 'PPT',
+ value: 'presentation',
+ parser_config: parser.presentation,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负PDF銆丳PTX'
+ },
+ {
+ name: '鍥剧墖',
+ value: 'picture',
+ parser_config: parser.picture,
+ parser_config_str: '鏀寔鍥惧儚鏂囦欢'
+ },
+ {
+ name: '鏁翠綋',
+ value: 'one',
+ parser_config: parser.one,
+ parser_config_str: '鏀寔鐨勬枃浠舵牸寮忎负DOCX銆丒XCEL銆丳DF銆乀XT'
+ },
+]);
+const uploadList = ref([]);
const props = defineProps(["sessionId"]);
const emit = defineEmits(["selectFileCallback"]);
const uploadRef = ref();
@@ -115,19 +201,23 @@
});
const init = () => {
- parser_ids.value = kbtenantInfo.parser_ids.split(",").map((item) => {
- const [value1, value2] = item.split(":");
- return {
- name: value2,
- value: value1
- };
- });
+ // parser_ids.value = kbtenantInfo.parser_ids.split(",").map((item) => {
+ // const [value1, value2] = item.split(":");
+ // return {
+ // name: value2,
+ // value: value1
+ // };
+ // });
}
const onChange = (fileList) => {
files.value = fileList;
};
+const visibleChange = (e) => {
+ e.stopPropagation();
+ visible.value = !visible.value;
+}
const upDataFile = () => {
console.log(files.value, "files");
@@ -136,37 +226,53 @@
Message.warning('璇烽�夋嫨鏂囦欢');
return;
}
- uploaditemList.value = files.value.map((item)=>{
+ uploaditemList.value = files.value.map((item,index)=>{
return {
+ index: index,
name: item.name,
size: (item.file.size/1024).toFixed(2) + 'K',
}
})
- onFileSelectedLoading.value = true;
- const formData = new FormData();
- for (let i = 0; i < files.value.length; i++) {
- formData.append('file', files.value[i].file);
- formData.append('conversation_id', activeSessionId.value);
- formData.append('parser_id', parser_id.value);
- formData.append('parser_config', '');
- }
- uploadWithoutKb(formData).then((res) => {
- if (res.code == 200) {
- visible.value = false;
- onFileSelectedLoading.value = false;
- // uploaditemList.value = [];
- emit('selectFileCallback', uploaditemList.value);
- Message.success('涓婁紶鎴愬姛');
- } else {
- Message.error('涓婁紶澶辫触');
- }
- });
+ // onFileSelectedLoading.value = true;
+ // const formData = new FormData();
+ // for (let i = 0; i < files.value.length; i++) {
+ // formData.append('file', files.value[i].file);
+ // formData.append('conversation_id', activeSessionId.value);
+ // formData.append('parser_id', parser_id.value);
+ // formData.append('parser_config', '');
+ // }
+ // uploadWithoutKb(formData).then((res) => {
+ // onFileSelectedLoading.value = false;
+ // if (res.code == 200) {
+ // cancel();
+ // // uploaditemList.value = [];
+ // emit('selectFileCallback', uploaditemList.value);
+ // Message.success('涓婁紶鎴愬姛');
+ // } else {
+ // Message.error('涓婁紶澶辫触');
+ // }
+ // });
+
+ cancel();
+ emit('selectFileCallback', uploaditemList.value);
};
+const cancel = () => {
+ if(!onFileSelectedLoading.value){
+ visible.value = false;
+ parser_id.value = "";
+ }
+};
+
+defineExpose({
+ cancel
+})
+
+
onBeforeMount(() => {
init();
--
Gitblit v1.8.0