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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user