|
@@ -19,15 +19,11 @@
|
|
|
<div class="message-list">
|
|
<div class="message-list">
|
|
|
<div v-for="(item, index) in imageAllList" :key="index">
|
|
<div v-for="(item, index) in imageAllList" :key="index">
|
|
|
|
|
|
|
|
- <!-- AI消息 -->
|
|
|
|
|
- <div class="ai-message" v-if="item.type !== 'user'">
|
|
|
|
|
- {{ item.content }}
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
<!-- 用户消息 -->
|
|
<!-- 用户消息 -->
|
|
|
<div class="user-message" v-if="item.type === 'user'">
|
|
<div class="user-message" v-if="item.type === 'user'">
|
|
|
{{ item.content }}
|
|
{{ item.content }}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+
|
|
|
<!-- AI生成图片对话框 -->
|
|
<!-- AI生成图片对话框 -->
|
|
|
<div class="ai-message" v-if="item.type !== 'user'">
|
|
<div class="ai-message" v-if="item.type !== 'user'">
|
|
|
|
|
|
|
@@ -125,7 +121,7 @@ const inputMessage = ref('')
|
|
|
// 发送消息函数
|
|
// 发送消息函数
|
|
|
const sendMessage = () => {
|
|
const sendMessage = () => {
|
|
|
if (inputMessage.value.trim()) {
|
|
if (inputMessage.value.trim()) {
|
|
|
- messages.value.push(inputMessage.value.trim())
|
|
|
|
|
|
|
+ // messages.value.push(inputMessage.value.trim())
|
|
|
inputMessage.value = ''
|
|
inputMessage.value = ''
|
|
|
|
|
|
|
|
let content = inputMessage.value.trim();
|
|
let content = inputMessage.value.trim();
|
|
@@ -142,7 +138,6 @@ const sendMessage = () => {
|
|
|
content: "正在为您生成图片,请稍等...",
|
|
content: "正在为您生成图片,请稍等...",
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
-
|
|
|
|
|
CreatePainting({
|
|
CreatePainting({
|
|
|
"modelId": 56,
|
|
"modelId": 56,
|
|
|
"prompt":content,
|
|
"prompt":content,
|
|
@@ -151,8 +146,8 @@ const sendMessage = () => {
|
|
|
}).then(res=>{
|
|
}).then(res=>{
|
|
|
console.log("生成图片",res)
|
|
console.log("生成图片",res)
|
|
|
//目前写死调用已生成的图片,全部通了后再改
|
|
//目前写死调用已生成的图片,全部通了后再改
|
|
|
- // inProgressImageMap.value[res.data] = {}
|
|
|
|
|
- inProgressImageMap.value[260] = {}
|
|
|
|
|
|
|
+ inProgressImageMap.value[res.data] = {id:res.data,status:AiImageStatusEnum.IN_PROGRESS}
|
|
|
|
|
+ // inProgressImageMap.value[260] = {id:260,status:AiImageStatusEnum.IN_PROGRESS}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -171,12 +166,6 @@ import {
|
|
|
ZoomOut,
|
|
ZoomOut,
|
|
|
} from '@element-plus/icons-vue'
|
|
} from '@element-plus/icons-vue'
|
|
|
|
|
|
|
|
-const url =
|
|
|
|
|
- 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
|
|
|
|
|
-const srcList = [
|
|
|
|
|
- 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
|
|
|
|
|
-]
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
const imageAllList = ref([]) // 对话的消息列表
|
|
const imageAllList = ref([]) // 对话的消息列表
|
|
|
const imageList = ref([]) // image 列表
|
|
const imageList = ref([]) // image 列表
|
|
@@ -187,11 +176,11 @@ const inProgressTimer = ref() // 生成中的 image 定时器,轮询生成进
|
|
|
|
|
|
|
|
/** 轮询生成中的 image 列表 */
|
|
/** 轮询生成中的 image 列表 */
|
|
|
const refreshWatchImages = async () => {
|
|
const refreshWatchImages = async () => {
|
|
|
- const imageIds = Object.keys(inProgressImageMap.value)
|
|
|
|
|
- if (imageIds.length == 0) {
|
|
|
|
|
|
|
+ const imageIds = Object.keys(inProgressImageMap.value).map(Number)
|
|
|
|
|
+ if (imageIds.length === 0) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- console.log("轮询生成中的 image 列表",imageIds)
|
|
|
|
|
|
|
+ console.log("轮询生成中的 image 列表",imageIds,imageIds.join(','))
|
|
|
const list = await PaintingGetMys(imageIds)
|
|
const list = await PaintingGetMys(imageIds)
|
|
|
console.log("轮询生成中的 image 列表",list)
|
|
console.log("轮询生成中的 image 列表",list)
|
|
|
const newWatchImages = {}
|
|
const newWatchImages = {}
|
|
@@ -199,18 +188,13 @@ const refreshWatchImages = async () => {
|
|
|
if (image.status === AiImageStatusEnum.IN_PROGRESS) {
|
|
if (image.status === AiImageStatusEnum.IN_PROGRESS) {
|
|
|
newWatchImages[image.id] = image
|
|
newWatchImages[image.id] = image
|
|
|
} else {
|
|
} else {
|
|
|
- // const index = imageList.value.findIndex((oldImage) => image.id === oldImage.id)
|
|
|
|
|
- // if (index >= 0) {
|
|
|
|
|
- // 更新 imageList
|
|
|
|
|
- // imageList.value[index] = image
|
|
|
|
|
|
|
|
|
|
- imageAllList.value.pop();
|
|
|
|
|
- imageAllList.value.push({
|
|
|
|
|
- type: 'ai',
|
|
|
|
|
- content: "已为您生成图片:",
|
|
|
|
|
- imageList: image.picUrl,
|
|
|
|
|
- })
|
|
|
|
|
- // }
|
|
|
|
|
|
|
+ imageAllList.value.pop();
|
|
|
|
|
+ imageAllList.value.push({
|
|
|
|
|
+ type: 'ai',
|
|
|
|
|
+ content: "已为您生成图片:",
|
|
|
|
|
+ imageList: image.picUrl,
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
console.log("================",imageAllList)
|
|
console.log("================",imageAllList)
|