diff --git a/apps/chat.js b/apps/chat.js index a93c517..7252fef 100644 --- a/apps/chat.js +++ b/apps/chat.js @@ -1012,7 +1012,7 @@ export class chatgpt extends plugin { clientId: response.clientId, invocationId: response.invocationId, conversationSignature: response.conversationSignature, - parentMessageId: response.messageId + parentMessageId: response.apology ? conversation.parentMessageId : response.messageId } } } diff --git a/utils/SydneyAIClient.js b/utils/SydneyAIClient.js index 17f4db3..f836c37 100644 --- a/utils/SydneyAIClient.js +++ b/utils/SydneyAIClient.js @@ -444,7 +444,7 @@ export default class SydneyAIClient { reject('Request aborted') } }) - let apology = false + // let apology = false ws.on('message', (data) => { const objects = data.toString().split('') const events = objects.map((object) => { @@ -507,7 +507,7 @@ export default class SydneyAIClient { const difference = updatedText.substring(replySoFar.length) onProgress(difference) if (updatedText.trim().endsWith(stopToken)) { - apology = true + // apology = true // remove stop token from updated text replySoFar = updatedText.replace(stopToken, '').trim() return @@ -618,9 +618,8 @@ export default class SydneyAIClient { if (!apology) { conversation.messages.push(userMessage) conversation.messages.push(replyMessage) - - await this.conversationsCache.set(conversationKey, conversation) } + await this.conversationsCache.set(conversationKey, conversation) return { conversationSignature, conversationId,