diff --git a/src/api/openapi.ts b/src/api/openapi.ts index 4f52feaa08..cf1c71e226 100644 --- a/src/api/openapi.ts +++ b/src/api/openapi.ts @@ -581,7 +581,6 @@ export const getHistoryMessage= async (dataSources:Chat.Chat[],loadingCnt=1 ,sta let fileBase64= JSON.parse(str) as string[]; let arr = fileBase64.filter( (ff:string)=>ff.indexOf('http')>-1); if(arr.length>0) content = arr.join(' ')+' '+ content ; - mlog(t('mjchat.attr') ,o.opt.images[0] , content ); }catch(ee){ } diff --git a/src/views/mj/aiGpt.vue b/src/views/mj/aiGpt.vue index e2eb7aaf8a..e8597311eb 100644 --- a/src/views/mj/aiGpt.vue +++ b/src/views/mj/aiGpt.vue @@ -71,7 +71,7 @@ watch(()=>homeStore.myData.act, async (n)=>{ if( !canVisionModel(model) ) model= canBase64Model(model)//model='gpt-4-vision-preview'; try{ - let images= await localSaveAny( JSON.stringify( dd.fileBase64) ) ; + let images= await localSaveAny( JSON.stringify({fileName: dd.fileName, fileBase64: dd.fileBase64 }) ) ; mlog('key', images ); promptMsg.opt= {images:[images]} }catch(e){ diff --git a/src/views/mj/aiGptInput.vue b/src/views/mj/aiGptInput.vue index 5d19f87c30..1b0f0d727d 100644 --- a/src/views/mj/aiGptInput.vue +++ b/src/views/mj/aiGptInput.vue @@ -24,7 +24,7 @@ const chatStore = useChatStore() const emit = defineEmits(['update:modelValue']) const props = defineProps<{ modelValue:string,disabled?:boolean,searchOptions?:AutoCompleteOptions,renderOption?: RenderLabel }>(); const fsRef = ref() -const st = ref<{fileBase64:string[],isLoad:number,isShow:boolean,showMic:boolean,micStart:boolean}>({fileBase64:[],isLoad:0 +const st = ref<{fileBase64:string[],fileName:string[],isLoad:number,isShow:boolean,showMic:boolean,micStart:boolean}>({fileBase64:[],fileName:[],isLoad:0 ,isShow:false,showMic:false , micStart:false}) const { isMobile } = useBasicLayout() const placeholder = computed(() => { @@ -50,11 +50,13 @@ const handleSubmit = ( ) => { } let obj={ prompt: mvalue.value, - fileBase64:st.value.fileBase64 + fileBase64:st.value.fileBase64, + fileName:st.value.fileName } homeStore.setMyData({act:'gpt.submit', actData:obj }); mvalue.value=''; st.value.fileBase64=[]; + st.value.fileName=[]; return false; } const ms= useMessage(); @@ -102,6 +104,7 @@ funt(); return ; } st.value.fileBase64.push(d) + st.value.fileName.push(file.name) } ).catch(e=>ms.error(e)); } }else{ @@ -117,8 +120,10 @@ funt(); ms.info(t('mj.uploadSuccess')); if(r.url.indexOf('http')>-1) { st.value.fileBase64.push(r.url) + st.value.fileName.push(file.name) }else{ st.value.fileBase64.push(location.origin +r.url) + st.value.fileName.push(file.name) } }else if(r.error) ms.error(r.error); }).catch(e=>{ diff --git a/src/views/mj/mjTextAttr.vue b/src/views/mj/mjTextAttr.vue index 1825d7998b..96d8a469bc 100644 --- a/src/views/mj/mjTextAttr.vue +++ b/src/views/mj/mjTextAttr.vue @@ -1,33 +1,71 @@ + \ No newline at end of file