|
@@ -22,6 +22,7 @@
|
|
|
<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'">
|
|
|
{{ item.content }}
|
|
{{ item.content }}
|
|
@@ -133,7 +134,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()
|
|
@@ -157,8 +158,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}
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -177,12 +178,14 @@ import {
|
|
|
ZoomOut
|
|
ZoomOut
|
|
|
} from '@element-plus/icons-vue'
|
|
} from '@element-plus/icons-vue'
|
|
|
|
|
|
|
|
|
|
+
|
|
|
// const url =
|
|
// const url =
|
|
|
// 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
|
|
// 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg'
|
|
|
// const srcList = [
|
|
// const srcList = [
|
|
|
// 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
|
|
// 'https://fuss10.elemecdn.com/0/6f/e35ff375812e6b0020b6b4e8f9583jpeg.jpeg',
|
|
|
// ]
|
|
// ]
|
|
|
|
|
|
|
|
|
|
+
|
|
|
const imageAllList = ref([]) // 对话的消息列表
|
|
const imageAllList = ref([]) // 对话的消息列表
|
|
|
const imageList = ref([]) // image 列表
|
|
const imageList = ref([]) // image 列表
|
|
|
// 图片轮询相关的参数(正在生成中的)
|
|
// 图片轮询相关的参数(正在生成中的)
|
|
@@ -191,14 +194,16 @@ 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)
|
|
|
|
|
+ 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 = {}
|
|
|
|
|
+
|
|
|
// 添加空值检查
|
|
// 添加空值检查
|
|
|
if (list.data) {
|
|
if (list.data) {
|
|
|
list.data.forEach(image => {
|
|
list.data.forEach(image => {
|
|
@@ -220,6 +225,21 @@ const refreshWatchImages = async () => {
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
console.log('================', imageAllList)
|
|
console.log('================', imageAllList)
|
|
|
|
|
+
|
|
|
|
|
+ list.data.forEach((image) => {
|
|
|
|
|
+ if (image.status === AiImageStatusEnum.IN_PROGRESS) {
|
|
|
|
|
+ newWatchImages[image.id] = image
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ imageAllList.value.pop();
|
|
|
|
|
+ imageAllList.value.push({
|
|
|
|
|
+ type: 'ai',
|
|
|
|
|
+ content: "已为您生成图片:",
|
|
|
|
|
+ imageList: image.picUrl,
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log("================",imageAllList)
|
|
|
inProgressImageMap.value = newWatchImages
|
|
inProgressImageMap.value = newWatchImages
|
|
|
}
|
|
}
|
|
|
|
|
|