Commit 4f6077d1 authored by Travis Fischer's avatar Travis Fischer Committed by GitHub

Merge pull request #473 from SmileSmith/v3

parents 168ab1fc 4f034784
...@@ -49,6 +49,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -49,6 +49,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
constructor(opts: { constructor(opts: {
email: string email: string
password: string password: string
model?: string
/** @defaultValue `false` **/ /** @defaultValue `false` **/
isProAccount?: boolean isProAccount?: boolean
...@@ -88,6 +89,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -88,6 +89,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
const { const {
email, email,
password, password,
model,
isProAccount = false, isProAccount = false,
markdown = true, markdown = true,
debug = false, debug = false,
...@@ -443,6 +445,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -443,6 +445,7 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
opts: types.SendMessageOptions = {} opts: types.SendMessageOptions = {}
): Promise<types.ChatResponse> { ): Promise<types.ChatResponse> {
const { const {
model,
conversationId, conversationId,
parentMessageId = uuidv4(), parentMessageId = uuidv4(),
messageId = uuidv4(), messageId = uuidv4(),
...@@ -464,9 +467,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI { ...@@ -464,9 +467,11 @@ export class ChatGPTAPIBrowser extends AChatGPTAPI {
} }
} }
], ],
model: this._isProAccount model: model
? model
: this._isProAccount
? 'text-davinci-002-render-paid' ? 'text-davinci-002-render-paid'
: 'text-davinci-002-render', : 'text-davinci-002-render-sha',
parent_message_id: parentMessageId parent_message_id: parentMessageId
} }
......
...@@ -212,7 +212,7 @@ export class ChatGPTAPI extends AChatGPTAPI { ...@@ -212,7 +212,7 @@ export class ChatGPTAPI extends AChatGPTAPI {
} }
} }
], ],
model: 'text-davinci-002-render', model: 'text-davinci-002-render-sha',
parent_message_id: parentMessageId parent_message_id: parentMessageId
} }
......
...@@ -283,6 +283,7 @@ export type SendMessageOptions = { ...@@ -283,6 +283,7 @@ export type SendMessageOptions = {
timeoutMs?: number timeoutMs?: number
onProgress?: (partialResponse: ChatResponse) => void onProgress?: (partialResponse: ChatResponse) => void
abortSignal?: AbortSignal abortSignal?: AbortSignal
model?: string
} }
export type SendConversationMessageOptions = Omit< export type SendConversationMessageOptions = Omit<
......
...@@ -155,7 +155,7 @@ export async function browserPostEventStream( ...@@ -155,7 +155,7 @@ export async function browserPostEventStream(
error: { error: {
message: `ChatGPTAPI error ${res.status || res.statusText}`, message: `ChatGPTAPI error ${res.status || res.statusText}`,
statusCode: res.status, statusCode: res.status,
statusText: res.statusText statusText: res.statusText || (await res.text())
}, },
conversationId, conversationId,
messageId messageId
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment