mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-18 06:17:06 +00:00
修复bing绘图第三方调用错误
This commit is contained in:
parent
fed2fd8dd4
commit
7c45b050ca
1 changed files with 5 additions and 2 deletions
|
|
@ -1669,6 +1669,7 @@ export class chatgpt extends plugin {
|
||||||
// 调用第三方API进行绘图
|
// 调用第三方API进行绘图
|
||||||
const drawOption = {
|
const drawOption = {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
headers: {'content-type': 'application/json'},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
prompt: response.details.imageTag,
|
prompt: response.details.imageTag,
|
||||||
width: 512,
|
width: 512,
|
||||||
|
|
@ -1677,11 +1678,13 @@ export class chatgpt extends plugin {
|
||||||
}
|
}
|
||||||
const drawData = await fetch(Config.bingDrawApi, drawOption)
|
const drawData = await fetch(Config.bingDrawApi, drawOption)
|
||||||
if (drawData.ok) {
|
if (drawData.ok) {
|
||||||
let draw = await cacheres.json()
|
let draw = await drawData.json()
|
||||||
if (draw.images) {
|
if (draw.images?.length > 0) {
|
||||||
for(let image of draw.images) {
|
for(let image of draw.images) {
|
||||||
this.reply(segment.image(`base64://${image}`), true)
|
this.reply(segment.image(`base64://${image}`), true)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
await e.reply('绘图失败:未产生图片')
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await e.reply('绘图失败:第三方绘图服务器错误')
|
await e.reply('绘图失败:第三方绘图服务器错误')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue