mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 17:02:11 +00:00
fix(ai): Add dangerouslyAllowBrowser flag for Anthropic client
- Enables browser support for Anthropic SDK - Required for browser-based applications using the AI library
This commit is contained in:
parent
3caa3af8fc
commit
da43e625f8
1 changed files with 8 additions and 2 deletions
|
|
@ -52,10 +52,16 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
|
||||||
if (typeof process !== "undefined" && process.env) {
|
if (typeof process !== "undefined" && process.env) {
|
||||||
process.env.ANTHROPIC_API_KEY = undefined;
|
process.env.ANTHROPIC_API_KEY = undefined;
|
||||||
}
|
}
|
||||||
this.client = new Anthropic({ apiKey: null, authToken: apiKey, baseURL: model.baseUrl, defaultHeaders });
|
this.client = new Anthropic({
|
||||||
|
apiKey: null,
|
||||||
|
authToken: apiKey,
|
||||||
|
baseURL: model.baseUrl,
|
||||||
|
defaultHeaders,
|
||||||
|
dangerouslyAllowBrowser: true,
|
||||||
|
});
|
||||||
this.isOAuthToken = true;
|
this.isOAuthToken = true;
|
||||||
} else {
|
} else {
|
||||||
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl });
|
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl, dangerouslyAllowBrowser: true });
|
||||||
this.isOAuthToken = false;
|
this.isOAuthToken = false;
|
||||||
}
|
}
|
||||||
this.modelInfo = model;
|
this.modelInfo = model;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue