This commit is contained in:
X1627315083
2025-05-20 16:59:13 +08:00
parent c235d0de4a
commit 2487e3dbbc

View File

@@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<div class="chatBox" v-show="chatOrSetting == 'chat'"> <div class="chatBox" v-show="chatOrSetting == 'chat'">
<textarea ref="textarea" @input="inputText($event)" placeholder="Write your message"></textarea> <textarea ref="textarea" @input="inputText($event)" @keydown.enter.prevent="sendChat" placeholder="Write your message"></textarea>
<div class="btn"> <div class="btn">
<div class="uploadBox"> <div class="uploadBox">
<div class="filList"> <div class="filList">
@@ -134,7 +134,10 @@ export default defineComponent({
const sendChat = ()=>{ const sendChat = ()=>{
if(!data.chatContent)return if(!data.chatContent)return
data.loadingShow = true data.loadingShow = true
Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value}}).then((rv)=>{ let fileList = JSON.parse(JSON.stringify(data.filList))
let fileUrl = (fileList.filter((item:any)=>item.type == 'file').length > 0) ? fileList.filter((item:any)=>item.type == 'file')[0].minioPath : ''
let imageUrlList = (fileList.filter((item:any)=>item.type == 'image').length > 0)? fileList.filter((item:any)=>item.type == 'image').map((item:any)=>item.minioPath).join(',') : ''
Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value,fileUrl:fileUrl,imageUrlList}}).then((rv)=>{
if(rv){ if(rv){
data.loadingShow = false data.loadingShow = false
router.push(`home?history=${rv}`) router.push(`home?history=${rv}`)
@@ -188,9 +191,13 @@ export default defineComponent({
} }
Https.axiosPost(Https.httpUrls.llmUploadFile,formData,config) Https.axiosPost(Https.httpUrls.llmUploadFile,formData,config)
.then((rv: any) => { .then((rv: any) => {
rv.name = event.target.files[0].name let obj = {
rv.type = type?'image':'file' name:event.target.files[0].name,
data.filList.push(rv) type:type?'image':'file',
minioPath:rv[0],
url:rv[1],
}
data.filList.push(obj)
data.loadingShow = false data.loadingShow = false
} }
).catch(rv=>{ ).catch(rv=>{