|
@@ -89,11 +89,9 @@ const generateProject = async () => {
|
|
forbidClick: true,
|
|
forbidClick: true,
|
|
duration: 0
|
|
duration: 0
|
|
})
|
|
})
|
|
- crtProject.value?.msgList.push({
|
|
|
|
- role: 'user',
|
|
|
|
- content: msg.value
|
|
|
|
- })
|
|
|
|
|
|
+
|
|
const params: any = {}
|
|
const params: any = {}
|
|
|
|
+ params.prompt = msg.value
|
|
for (let i = crtProject.value!.msgList.length - 1; i >= 0; i--) {
|
|
for (let i = crtProject.value!.msgList.length - 1; i >= 0; i--) {
|
|
if (crtProject.value!.msgList[i].role === 'assistant' && crtProject.value!.msgList[i].session_id !== '') {
|
|
if (crtProject.value!.msgList[i].role === 'assistant' && crtProject.value!.msgList[i].session_id !== '') {
|
|
const timeDiff = Date.now() - crtProject.value!.msgList[i].timestamp!
|
|
const timeDiff = Date.now() - crtProject.value!.msgList[i].timestamp!
|
|
@@ -104,11 +102,14 @@ const generateProject = async () => {
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
params.session_id = crtProject.value!.msgList[i].session_id
|
|
params.session_id = crtProject.value!.msgList[i].session_id
|
|
- params.prompt = msg.value
|
|
|
|
}
|
|
}
|
|
break
|
|
break
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ crtProject.value?.msgList.push({
|
|
|
|
+ role: 'user',
|
|
|
|
+ content: msg.value
|
|
|
|
+ })
|
|
msg.value = ''
|
|
msg.value = ''
|
|
const res = await fetch('https://plceditor.worldflying.cn/api/ai/chat', {
|
|
const res = await fetch('https://plceditor.worldflying.cn/api/ai/chat', {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
@@ -118,7 +119,7 @@ const generateProject = async () => {
|
|
body: JSON.stringify(params)
|
|
body: JSON.stringify(params)
|
|
}).then((res) => res.json())
|
|
}).then((res) => res.json())
|
|
console.log(res)
|
|
console.log(res)
|
|
- if (res.errcode === '1001') {
|
|
|
|
|
|
+ if (res.errcode === 3000) {
|
|
showFailToast('操作失败!')
|
|
showFailToast('操作失败!')
|
|
} else {
|
|
} else {
|
|
if (res.output.text === '请正确描述您要编程的内容。' || res.output.text === '请正确描述您要编程的内容') {
|
|
if (res.output.text === '请正确描述您要编程的内容。' || res.output.text === '请正确描述您要编程的内容') {
|