44 <el-button class =" border-primary video-stop-button" @click =" stopChat" >
55 <app-icon iconName =" app-video-stop" class =" mr-8" ></app-icon >
66 {{ $t('chat.operation.stopChat') }}
7- </el-button
8- >
7+ </el-button >
98 </div >
109
1110 <div class =" operate-textarea" >
4342 @mouseleave.stop =" mouseleave()"
4443 >
4544 <div class =" flex align-center" >
46- <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
45+ <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
4746 <div class =" ml-4 ellipsis-1" :title =" item && item?.name" >
4847 {{ item && item?.name }}
4948 </div >
5453 v-if =" showDelete === item.url"
5554 >
5655 <el-icon style =" font-size : 16px ; top : 2px " >
57- <CircleCloseFilled />
56+ <CircleCloseFilled />
5857 </el-icon >
5958 </div >
6059 </div >
8180 @mouseleave.stop =" mouseleave()"
8281 >
8382 <div class =" flex align-center" >
84- <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
83+ <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
8584 <div class =" ml-4 ellipsis-1" :title =" item && item?.name" >
8685 {{ item && item?.name }}
8786 </div >
9291 v-if =" showDelete === item.url"
9392 >
9493 <el-icon style =" font-size : 16px ; top : 2px " >
95- <CircleCloseFilled />
94+ <CircleCloseFilled />
9695 </el-icon >
9796 </div >
9897 </div >
116115 @mouseleave.stop =" mouseleave()"
117116 >
118117 <div class =" flex align-center" >
119- <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
118+ <img :src =" getImgUrl(item && item?.name)" alt =" " width =" 24" />
120119 <div class =" ml-4 ellipsis-1" :title =" item && item?.name" >
121120 {{ item && item?.name }}
122121 </div >
127126 v-if =" showDelete === item.url"
128127 >
129128 <el-icon style =" font-size : 16px ; top : 2px " >
130- <CircleCloseFilled />
129+ <CircleCloseFilled />
131130 </el-icon >
132131 </div >
133132 </div >
147146 v-if =" showDelete === item.url"
148147 >
149148 <el-icon style =" font-size : 16px ; top : 2px " >
150- <CircleCloseFilled />
149+ <CircleCloseFilled />
151150 </el-icon >
152151 </div >
153152 <el-image
174173 v-if =" showDelete === item.url"
175174 >
176175 <el-icon style =" font-size : 16px ; top : 2px " >
177- <CircleCloseFilled />
176+ <CircleCloseFilled />
178177 </el-icon >
179178 </div >
180179 <video
181180 v-if =" item.url"
182181 :src =" item.url"
183- controls style =" width : 100px ; display : block "
182+ controls
183+ style =" width : 100px ; display : block "
184184 class =" border-r-6"
185185 autoplay
186186 />
213213
214214 <div class =" operate flex-between" >
215215 <div >
216- <slot name =" userInput" />
216+ <slot name =" userInput" />
217217 </div >
218218 <div class =" flex align-center" >
219219 <template v-if =" props .applicationDetails .stt_model_enable " >
223223 <AppIcon v-if =" isMicrophone" iconName =" app-keyboard" ></AppIcon >
224224 <el-icon v-else >
225225 <!-- 录音 -->
226- <Microphone />
226+ <Microphone />
227227 </el-icon >
228228 </el-button >
229229 </span >
235235 v-if =" recorderStatus === 'STOP'"
236236 >
237237 <el-icon >
238- <Microphone />
238+ <Microphone />
239239 </el-icon >
240240 </el-button >
241241
242242 <div v-else class =" operate flex align-center" >
243243 <el-text type =" info"
244- >00:{{ recorderTime < 10 ? `0${recorderTime}` : recorderTime }}</el-text
244+ >00:{{ recorderTime < 10 ? `0${recorderTime}` : recorderTime }}</el-text
245245 >
246246 <el-button
247247 text
257257
258258 <template v-if =" recorderStatus === ' STOP' || mode === ' mobile' " >
259259 <span v-if =" props.applicationDetails.file_upload_enable" class =" flex align-center ml-4" >
260+ <!-- 如果URL地址 -->
261+ <!-- <el-button
262+ text
263+ :disabled="checkMaxFilesLimit() || loading"
264+ class="mt-4"
265+ @click="showURLSetting = true"
266+ >
267+ <el-icon><Paperclip /></el-icon>
268+ </el-button> -->
269+ <!-- 没有URL地址 -->
260270 <el-upload
261271 action =" #"
262272 multiple
275285 >
276286 <template #content >
277287 <div class =" break-all pre-wrap" >
278- {{ $t('chat.uploadFile.label') }}:{{
279- $t('chat.uploadFile.most')
280- }}{{
281- props.applicationDetails.file_upload_setting.maxFiles
288+ {{ $t('chat.uploadFile.label') }}:{{ $t('chat.uploadFile.most')
289+ }}{{ props.applicationDetails.file_upload_setting.maxFiles
282290 }}{{ $t('chat.uploadFile.limit') }}
283- {{ props.applicationDetails.file_upload_setting.fileLimit }}MB<br />{{
291+ {{ props.applicationDetails.file_upload_setting.fileLimit }}MB<br />{{
284292 $t('chat.uploadFile.fileType')
285293 }}:{{ getAcceptList().replace(/\./g, '').replace(/,/g, '、').toUpperCase() }}
286294 </div >
287295 </template >
288296 <el-button text :disabled =" checkMaxFilesLimit() || loading" class =" mt-4" >
289- <el-icon ><Paperclip /></el-icon >
297+ <el-icon ><Paperclip /></el-icon >
290298 </el-button >
291299 </el-tooltip >
292300 </el-upload >
309317 src =" @/assets/icon_send.svg"
310318 alt =" "
311319 />
312- <SendIcon v-show =" !isDisabledChat && !loading && !uploadLoading" />
320+ <SendIcon v-show =" !isDisabledChat && !loading && !uploadLoading" />
313321 </el-button >
314322 </template >
315323 </div >
323331 </auto-tooltip >
324332 </el-text >
325333 </div >
334+
335+ <!-- 弹出URL设置框 -->
336+ <div class =" popperURLSetting" v-if =" showURLSetting" >
337+ <el-card shadow =" always" class =" border-r-8" style =" --el-card-padding : 16px " >
338+ <el-form label-position =" top" ref =" urlFormRef" :model =" urlForm" >
339+ <el-form-item >
340+ <template #label >
341+ <div class =" flex-between" >
342+ <span >URL 地址</span >
343+ <el-select
344+ :teleported =" false"
345+ v-model =" urlForm.type"
346+ size =" small"
347+ style =" width : 85px "
348+ >
349+ <el-option :label =" $t('common.fileUpload.image')" value =" image" />
350+ <el-option :label =" $t('common.fileUpload.audio')" value =" audio" />
351+ </el-select >
352+ </div >
353+ </template >
354+ <el-input
355+ v-model =" urlForm.source_url"
356+ placeholder =" 请输入URL地址,每行一个地址"
357+ :rows =" 5"
358+ type =" textarea"
359+ />
360+ </el-form-item >
361+ </el-form >
362+ <div class =" text-right" >
363+ <el-button @click =" showURLSetting = false" >{{ $t('common.cancel') }}</el-button >
364+ <el-button type =" primary" @click =" showURLSetting = false" >{{
365+ $t('common.confirm')
366+ }}</el-button >
367+ </div >
368+ <el-divider style =" margin : 16px 0 " />
369+ <el-upload
370+ action =" #"
371+ multiple
372+ :auto-upload =" false"
373+ :show-file-list =" false"
374+ :accept =" getAcceptList()"
375+ :on-change =" (file: any, fileList: any) => uploadFile(file, fileList)"
376+ v-model:file-list =" fileAllList"
377+ ref =" upload"
378+ class =" import-button"
379+ >
380+ <el-button class =" w-full url-upload-button" >本地上传</el-button >
381+ </el-upload >
382+ </el-card >
383+ </div >
326384 </div >
327385</template >
328386<script setup lang="ts">
329- import {ref , computed , onMounted , nextTick , reactive , type Ref } from ' vue'
330- import {t } from ' @/locales'
387+ import { ref , computed , onMounted , nextTick , reactive , type Ref } from ' vue'
388+ import { t } from ' @/locales'
331389import Recorder from ' recorder-core'
332390import TouchChat from ' ./TouchChat.vue'
333391import applicationApi from ' @/api/application/application'
334- import {MsgAlert } from ' @/utils/message'
335- import {type chatType } from ' @/api/type/application'
336- import {useRoute , useRouter } from ' vue-router'
337- import {getImgUrl } from ' @/utils/common'
392+ import { MsgAlert } from ' @/utils/message'
393+ import { type chatType } from ' @/api/type/application'
394+ import { useRoute , useRouter } from ' vue-router'
395+ import { getImgUrl } from ' @/utils/common'
338396import bus from ' @/bus'
339397import ' recorder-core/src/engine/mp3'
340398import ' recorder-core/src/engine/mp3-engine'
341- import {MsgWarning } from ' @/utils/message'
399+ import { MsgWarning } from ' @/utils/message'
342400import chatAPI from ' @/api/chat/chat'
343401
344402const router = useRouter ()
345403const route = useRoute ()
346404const {
347- query : {mode, question},
405+ query : { mode, question },
348406} = route as any
349407const quickInputRef = ref ()
350408const props = withDefaults (
@@ -387,6 +445,12 @@ const localLoading = computed({
387445 },
388446})
389447
448+ const showURLSetting = ref (false )
449+ const urlForm = reactive ({
450+ source_url: ' ' ,
451+ type: ' ' ,
452+ })
453+
390454const uploadLoading = computed (() => {
391455 return Object .values (filePromisionDict .value ).length > 0
392456})
@@ -408,7 +472,7 @@ const audioExtensions = ['MP3', 'WAV', 'OGG', 'AAC', 'M4A']
408472const otherExtensions = ref ([' PPT' , ' DOC' ])
409473
410474const getAcceptList = () => {
411- const {image, document, audio, video, other} = props .applicationDetails .file_upload_setting
475+ const { image, document, audio, video, other } = props .applicationDetails .file_upload_setting
412476 let accepts: any = []
413477 if (image ) {
414478 accepts = [... imageExtensions ]
@@ -438,15 +502,15 @@ const checkMaxFilesLimit = () => {
438502 return (
439503 props .applicationDetails .file_upload_setting .maxFiles <=
440504 uploadImageList .value .length +
441- uploadDocumentList .value .length +
442- uploadAudioList .value .length +
443- uploadVideoList .value .length +
444- uploadOtherList .value .length
505+ uploadDocumentList .value .length +
506+ uploadAudioList .value .length +
507+ uploadVideoList .value .length +
508+ uploadOtherList .value .length
445509 )
446510}
447511const filePromisionDict: any = ref <any >({})
448512const uploadFile = async (file : any , fileList : any ) => {
449- const {maxFiles, fileLimit} = props .applicationDetails .file_upload_setting
513+ const { maxFiles, fileLimit } = props .applicationDetails .file_upload_setting
450514 // 单次上传文件数量限制
451515 const file_limit_once =
452516 uploadImageList .value .length +
@@ -612,8 +676,7 @@ const TouchEnd = (bool?: boolean) => {
612676 }
613677}
614678// 取消录音控制台日志
615- Recorder .CLog = function () {
616- }
679+ Recorder .CLog = function () {}
617680
618681class RecorderManage {
619682 recorder? : any
@@ -919,16 +982,16 @@ onMounted(() => {
919982 // 获取当前路由信息
920983 const route = router .currentRoute .value
921984 // 复制query对象
922- const query = {... route .query }
985+ const query = { ... route .query }
923986 // 删除特定的参数
924987 delete query .question
925988 const newRoute =
926989 Object .entries (query )?.length > 0
927990 ? route .path +
928- ' ?' +
929- Object .entries (query )
930- .map (([key , value ]) => ` ${key }=${value } ` )
931- .join (' &' )
991+ ' ?' +
992+ Object .entries (query )
993+ .map (([key , value ]) => ` ${key }=${value } ` )
994+ .join (' &' )
932995 : route .path
933996
934997 history .pushState (null , ' ' , ' /chat' + newRoute )
@@ -1026,14 +1089,21 @@ onMounted(() => {
10261089 }
10271090 }
10281091 }
1092+ .popperURLSetting {
1093+ right : 30px ;
1094+ }
10291095}
10301096
1031- .popperUserInput {
1097+ .popperURLSetting {
10321098 position : absolute ;
10331099 z-index : 999 ;
1034- left : 0 ;
1035- bottom : 50 px ;
1100+ right : 60 px ;
1101+ bottom : 65 px ;
10361102 width : calc (100% - 50px );
1037- max-width : 400px ;
1103+ max-width : 320px ;
1104+ .url-upload-button {
1105+ border-color : var (--el-color-primary );
1106+ color : var (--el-color-primary );
1107+ }
10381108}
10391109 </style >
0 commit comments