diff options
| author | polwex <polwex@sortug.com> | 2025-10-19 10:30:47 +0700 |
|---|---|---|
| committer | polwex <polwex@sortug.com> | 2025-10-19 10:30:47 +0700 |
| commit | ba16ebcbe36c1a1cbdb1d1379cb3f9c3a086acdf (patch) | |
| tree | 7ba1f8bb59d0f25d1c6539865f82d8a4e0dbe4f8 /src/generic.ts | |
| parent | a23f430e2afd7d9ea462f71c2fd1568d8e1dba38 (diff) | |
checkpoint
Diffstat (limited to 'src/generic.ts')
| -rw-r--r-- | src/generic.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/generic.ts b/src/generic.ts index e8dfa13..c27f9f0 100644 --- a/src/generic.ts +++ b/src/generic.ts @@ -14,6 +14,7 @@ type Props = { model?: string; maxTokens?: number; tokenizer?: (text: string) => number; + allowBrowser?: boolean; }; export default class OpenAIAPI implements AIModelAPI { private apiKey; @@ -26,7 +27,11 @@ export default class OpenAIAPI implements AIModelAPI { constructor(props: Props) { this.apiKey = props.apiKey; this.baseURL = props.baseURL; - this.api = new OpenAI({ baseURL: this.baseURL, apiKey: this.apiKey }); + this.api = new OpenAI({ + baseURL: this.baseURL, + apiKey: this.apiKey, + dangerouslyAllowBrowser: props.allowBrowser || false, + }); this.model = props.model || ""; if (props.maxTokens) this.maxTokens = props.maxTokens; if (props.tokenizer) this.tokenizer = props.tokenizer; |
