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 }