kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
chore: update ChatGPTAPI constructor init for typedoc
rodzic
c467ca36a1
commit
2b2b08ac9d
|
@ -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,19 +46,21 @@ 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) {
|
||||||
apiKey,
|
const {
|
||||||
apiBaseUrl = 'https://api.openai.com',
|
apiKey,
|
||||||
debug = false,
|
apiBaseUrl = 'https://api.openai.com',
|
||||||
messageStore,
|
debug = false,
|
||||||
completionParams,
|
messageStore,
|
||||||
systemMessage,
|
completionParams,
|
||||||
maxModelTokens = 4096,
|
systemMessage,
|
||||||
maxResponseTokens = 1000,
|
maxModelTokens = 4096,
|
||||||
getMessageById,
|
maxResponseTokens = 1000,
|
||||||
upsertMessage,
|
getMessageById,
|
||||||
fetch = globalFetch
|
upsertMessage,
|
||||||
}: ChatGPTAPIOptions) {
|
fetch = globalFetch
|
||||||
|
} = opts
|
||||||
|
|
||||||
this._apiKey = apiKey
|
this._apiKey = apiKey
|
||||||
this._apiBaseUrl = apiBaseUrl
|
this._apiBaseUrl = apiBaseUrl
|
||||||
this._debug = !!debug
|
this._debug = !!debug
|
||||||
|
|
Ładowanie…
Reference in New Issue