From ba16ebcbe36c1a1cbdb1d1379cb3f9c3a086acdf Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 19 Oct 2025 10:30:47 +0700 Subject: checkpoint --- src/generic.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/generic.ts') 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; -- cgit v1.2.3