chore: update ChatGPTAPI constructor init for typedoc

chatgpt-api
Travis Fischer 2023-03-02 17:24:49 -06:00
rodzic c467ca36a1
commit 2b2b08ac9d
1 zmienionych plików z 15 dodań i 14 usunięć

Wyświetl plik

@ -7,7 +7,6 @@ import * as tokenizer from './tokenizer'
import * as types from './types' import * as types from './types'
import { fetch as globalFetch } from './fetch' import { fetch as globalFetch } from './fetch'
import { fetchSSE } from './fetch-sse' import { fetchSSE } from './fetch-sse'
import { ChatGPTAPIOptions } from './types'
const CHATGPT_MODEL = 'gpt-3.5-turbo' const CHATGPT_MODEL = 'gpt-3.5-turbo'
@ -47,7 +46,8 @@ export class ChatGPTAPI {
* @param upsertMessage - Optional function to insert or update a message. If not provided, the default implementation will be used (using an in-memory `messageStore`). * @param upsertMessage - Optional function to insert or update a message. If not provided, the default implementation will be used (using an in-memory `messageStore`).
* @param fetch - Optional override for the `fetch` implementation to use. Defaults to the global `fetch` function. * @param fetch - Optional override for the `fetch` implementation to use. Defaults to the global `fetch` function.
*/ */
constructor({ constructor(opts: types.ChatGPTAPIOptions) {
const {
apiKey, apiKey,
apiBaseUrl = 'https://api.openai.com', apiBaseUrl = 'https://api.openai.com',
debug = false, debug = false,
@ -59,7 +59,8 @@ export class ChatGPTAPI {
getMessageById, getMessageById,
upsertMessage, upsertMessage,
fetch = globalFetch fetch = globalFetch
}: ChatGPTAPIOptions) { } = opts
this._apiKey = apiKey this._apiKey = apiKey
this._apiBaseUrl = apiBaseUrl this._apiBaseUrl = apiBaseUrl
this._debug = !!debug this._debug = !!debug