mirror of
https://github.com/earendil-works/pi.git
synced 2026-06-18 15:54:04 +08: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:
@@ -52,10 +52,16 @@ export class AnthropicLLM implements LLM<AnthropicLLMOptions> {
|
||||
if (typeof process !== "undefined" && process.env) {
|
||||
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;
|
||||
} else {
|
||||
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl });
|
||||
this.client = new Anthropic({ apiKey, baseURL: model.baseUrl, dangerouslyAllowBrowser: true });
|
||||
this.isOAuthToken = false;
|
||||
}
|
||||
this.modelInfo = model;
|
||||
|
||||
Reference in New Issue
Block a user