refactor(askOpenAI.js): rename gptResponse to response, fixes titling error

This commit is contained in:
Daniel Avila 2023-04-04 18:17:23 -04:00
parent 56e02f4968
commit 3ab9b7f736

View file

@ -133,7 +133,7 @@ const ask = async ({
userMessage.conversationId = conversationId;
userMessage.messageId = responseMessage.parentMessageId;
// If gptResponse has parentMessageId, the fake userMessage.messageId should be updated to the real one.
// If response has parentMessageId, the fake userMessage.messageId should be updated to the real one.
if (!overrideParentMessageId) {
const oldUserMessageId = userMessageId;
await saveMessage({ ...userMessage, messageId: oldUserMessageId, newMessageId: userMessage.messageId });
@ -150,7 +150,7 @@ const ask = async ({
res.end();
if (userParentMessageId == '00000000-0000-0000-0000-000000000000') {
const title = await titleConvo({ endpoint: endpointOption?.endpoint, text, response: gptResponse });
const title = await titleConvo({ endpoint: endpointOption?.endpoint, text, response });
await updateConvo(req?.session?.user?.username, {
conversationId: conversationId,
title