fix: API3 conversation bug

This commit is contained in:
ikechan8370 2023-02-15 00:49:48 +08:00
parent b342e47e8a
commit 4ba1c80cc0
2 changed files with 5 additions and 2 deletions

View file

@ -234,7 +234,7 @@ export class chatgpt extends plugin {
// await this.reply('chatgpt初始化出错' + e.msg, true) // await this.reply('chatgpt初始化出错' + e.msg, true)
// } // }
let previousConversation = await redis.get(`CHATGPT:CONVERSATIONS:${e.sender.user_id}`) let previousConversation = await redis.get(`CHATGPT:CONVERSATIONS:${e.sender.user_id}`)
let conversation = null let conversation = {}
if (!previousConversation) { if (!previousConversation) {
let ctime = new Date() let ctime = new Date()
previousConversation = { previousConversation = {
@ -256,6 +256,9 @@ export class chatgpt extends plugin {
} }
const use = await redis.get('CHATGPT:USE') const use = await redis.get('CHATGPT:USE')
try { try {
if (Config.debug) {
logger.mark(conversation)
}
let chatMessage = await this.sendMessage(prompt, conversation, use) let chatMessage = await this.sendMessage(prompt, conversation, use)
previousConversation.conversation = { previousConversation.conversation = {
conversationId: chatMessage.conversationId conversationId: chatMessage.conversationId

View file

@ -40,7 +40,7 @@ export class OfficialChatGPTClient {
} }
} }
], ],
conversationId, conversation_id: conversationId,
model: Config.plus ? 'text-davinci-002-render-sha' : 'text-davinci-002-render-sha', model: Config.plus ? 'text-davinci-002-render-sha' : 'text-davinci-002-render-sha',
parent_message_id: parentMessageId parent_message_id: parentMessageId
} }