文件上传的问题

This commit is contained in:
aixianling
2024-08-23 09:58:01 +08:00
parent 0ff3eaff97
commit 6ad47f207a
3 changed files with 33 additions and 7 deletions

View File

@@ -87,9 +87,11 @@ export default {
if (++i < content.length) setTimeout(() => concatenateStr(content, i, target), 50)
}
this.$debounce(() => {
const {currentConversation: conversationId, app, prompt: content, latlng} = this.$data
const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng}
const {currentConversation: conversationId, app, prompt: content, latlng, files} = this.$data
const {id: fileId, url: sdkFileUrl, name: fileName} = files[0] || {}
const message = {appType: "2", userType: 0, content, conversationId, ...app, supplementContent: latlng, fileId, sdkFileUrl, fileName}
this.history.push(message)
this.$refs.uploader?.clearFiles()
this.loading = true
this.prompt = ""
this.http.post("/app/appaicopilotinfo/add", message).then(res => {
@@ -190,7 +192,7 @@ export default {
<div class="topBar flex">
<div v-for="(btn,i) in btns" :key="i" class="btn pointer" :style="{backgroundImage: `url(${btn.icon})`}" v-text="btn.label" @click="btn.click"/>
</div>
<ai-uploader v-model="files" :instance="http" :limit="1" show-loading fileType="file">
<ai-uploader ref="uploader" v-model="files" :instance="http" :limit="1" show-loading fileType="file">
<div slot="trigger" ref="uploadTrigger"/>
</ai-uploader>
<div class="flex end">
@@ -202,7 +204,7 @@ export default {
</div>
</div>
</ai-drag>
<ai-locate-dialog dialogTitle="选择当前位置" v-model="locate" :ins="http" @confirm="v=>handleLocate(v)" :modal="false" :latlng="{lat:30.5395460128784,lng:114.271802902222}"/>
<ai-locate-dialog dialogTitle="选择当前位置" v-model="locate" :ins="http" @confirm="v=>handleLocate(v)" :modal="false"/>
<img class="icon" src="https://cdn.sinoecare.com/i/2024/08/22/66c6dfdc3766a.png" @click="show=!show"/>
</section>
</template>