From 6c309ce365faac573719015eaadec419ddd06aad Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Sun, 2 Apr 2023 11:33:54 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chatgpt-api.ts | 10 +++++----- src/types.ts | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/chatgpt-api.ts b/src/chatgpt-api.ts index b45f4a07e..0d5cea86c 100644 --- a/src/chatgpt-api.ts +++ b/src/chatgpt-api.ts @@ -145,7 +145,7 @@ export class ChatGPTAPI { onProgress, stream = onProgress ? true : false, completionParams, - conversationId = '' + conversationId } = opts let { abortSignal } = opts @@ -159,9 +159,9 @@ export class ChatGPTAPI { const message: types.ChatMessage = { role: 'user', id: messageId, + conversationId, parentMessageId, - text, - conversationId + text } const latestQuestion = message @@ -174,9 +174,9 @@ export class ChatGPTAPI { const result: types.ChatMessage = { role: 'assistant', id: uuidv4(), + conversationId, parentMessageId: messageId, - text: '', - conversationId + text: '' } const responseP = new Promise( diff --git a/src/types.ts b/src/types.ts index 5c44dcc14..16b64f21b 100644 --- a/src/types.ts +++ b/src/types.ts @@ -74,7 +74,8 @@ export interface ChatMessage { // relevant for both ChatGPTAPI and ChatGPTUnofficialProxyAPI parentMessageId?: string - // only relevant for ChatGPTUnofficialProxyAPI + + // only relevant for ChatGPTUnofficialProxyAPI (optional for ChatGPTAPI) conversationId?: string }