Преглед на файлове

AI问答,支持word的两种格式

hbchen преди 8 месеца
родител
ревизия
0ddf149521

BIN
src/assets/img/icons/file_type_pdf.png


BIN
src/assets/img/icons/file_type_ppt.png


BIN
src/assets/img/icons/file_type_unknown.png


+ 8 - 7
src/views/operation_manage/AIQA/AIQA.vue

@@ -63,7 +63,7 @@
                 <div class="upload-row">
                     <el-upload
                     style="display: inline-block; margin-right: 8px"
-                    accept=".pptx,.pdf"
+                    accept=".pptx,.pdf,.docx,.doc"
                     action=""
                     :http-request="handleUpload"
                     :before-upload="handleBeforeUpload"
@@ -71,7 +71,7 @@
                     :disabled="startUploadAudio">
                         <img src="~@/assets/img/icons/ai-upload.png" />
                     </el-upload>
-                    <span>支持格式:PDF、PPTX;大小不超过50MB</span>
+                    <span>支持格式:PDF、PPTX、DOC、DOCX;大小不超过50MB</span>
                 </div>
                 <textarea rows="6" v-model="inputText" placeholder="请输入提问,Shift+Enter换行" @keydown.enter="handleSendMsg"></textarea>
                 <div class="send-btn" @click="handleSendMsg"><img src="~@/assets/img/ai_m/send.png" />发送</div>
@@ -131,7 +131,8 @@ export default {
             companyName:'',
             aiFileIds:[],
             // 上传窗口的队列
-            windowSet:new Set()
+            windowSet:new Set(),
+            fileTypeRule:new RegExp(/\.pdf|\.pptx|\.doc(x)?$/,'i')
         };
     },
     watch:{
@@ -453,14 +454,14 @@ export default {
                     return this.$message.error("单次只能上传一个文件,请重试");
                 }else{
                     let file = DataTransferItemList[0]
-                    if(file.type && (file.name.endsWith('.pdf')||file.name.endsWith('.pptx'))){
+                    if(file.type && this.fileTypeRule.test(file.name)){
                         if(file.size/1024/1024 > 50.1){
                             this.$message.error("上传文件大小不超过50MB");
                             return false;
                         }
                         this.handleUpload({file})
                     }else{
-                        return this.$message.error("上传文件格式只支持PDF、PPTX");
+                        return this.$message.error("上传文件格式只支持PDF、PPTX、DOC、DOCX");
                     }
                 }
             }else{
@@ -470,8 +471,8 @@ export default {
             }
         },
         handleBeforeUpload(e) {
-            if(!(e.name.endsWith('.pdf') || e.name.endsWith('.pptx'))){
-                this.$message.error("上传文件格式只支持PDF、PPTX");
+            if(!this.fileTypeRule.test(e.name)){
+                this.$message.error("上传文件格式只支持PDF、PPTX、DOC、DOCX");
                 return false;
             }
             if(!(e.size/1024/1024 < 50.1)){

+ 8 - 5
src/views/operation_manage/AIQA/components/messageItem.vue

@@ -69,12 +69,15 @@ export default {
         },
         getFileIcon(){
             if(this.messageInfo.askFileUrl){
-                if(this.messageInfo.askFileUrl.endsWith('.pdf')){
-                    return require('@/assets/img/icons/file_type_pdf.png')
-                }else if(this.messageInfo.askFileUrl.endsWith('.pptx')){
-                    return require('@/assets/img/icons/file_type_ppt.png')
+                let fileUrl=this.messageInfo.askFileUrl.toLocaleLowerCase()
+                if(fileUrl.endsWith('.pdf')){
+                    return require('@/assets/img/cloudDisk/pdf_icon.png')
+                }else if(fileUrl.endsWith('.pptx')){
+                    return require('@/assets/img/cloudDisk/ppt_icon.png')
+                }else if(fileUrl.endsWith('.doc') || fileUrl.endsWith('.docx')){
+                    return require('@/assets/img/cloudDisk/word_icon.png')
                 }else{
-                    return require('@/assets/img/icons/file_type_unknown.png')
+                    return require('@/assets/img/cloudDisk/config_icon.png')
                 }
             }else{
                 return ''