diff --git a/package.json b/package.json index 350afefbb2ec..ea07d95b135e 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,7 @@ "dependencies": { "@ant-design/icons": "^5.4.0", "@ant-design/pro-components": "^2.7.10", - "@anthropic-ai/sdk": "^0.24.3", + "@anthropic-ai/sdk": "^0.27.0", "@auth/core": "0.28.0", "@aws-sdk/client-bedrock-runtime": "^3.637.0", "@aws-sdk/client-s3": "^3.637.0", diff --git a/src/config/modelProviders/anthropic.ts b/src/config/modelProviders/anthropic.ts index 9d36c761bda8..dd3505d8c334 100644 --- a/src/config/modelProviders/anthropic.ts +++ b/src/config/modelProviders/anthropic.ts @@ -67,7 +67,6 @@ const Anthropic: ModelProviderCard = { }, ], checkModel: 'claude-3-haiku-20240307', - disableBrowserRequest: true, id: 'anthropic', name: 'Anthropic', proxyUrl: { diff --git a/src/libs/agent-runtime/anthropic/index.ts b/src/libs/agent-runtime/anthropic/index.ts index 0f02bf9700aa..0a99fb3bc61e 100644 --- a/src/libs/agent-runtime/anthropic/index.ts +++ b/src/libs/agent-runtime/anthropic/index.ts @@ -20,10 +20,10 @@ export class LobeAnthropicAI implements LobeRuntimeAI { baseURL: string; - constructor({ apiKey, baseURL = DEFAULT_BASE_URL }: ClientOptions = {}) { + constructor({ apiKey, baseURL = DEFAULT_BASE_URL, ...res }: ClientOptions = {}) { if (!apiKey) throw AgentRuntimeError.createError(AgentRuntimeErrorType.InvalidProviderAPIKey); - this.client = new Anthropic({ apiKey, baseURL }); + this.client = new Anthropic({ apiKey, baseURL, ...res }); this.baseURL = this.client.baseURL; } diff --git a/src/services/chat.ts b/src/services/chat.ts index 3c9cb45ed155..cb4cf282375d 100644 --- a/src/services/chat.ts +++ b/src/services/chat.ts @@ -134,12 +134,14 @@ export function initializeWithClientStore(provider: string, payload: any) { case ModelProvider.Qwen: { break; } + case ModelProvider.Anthropic: { providerOptions = { baseURL: providerAuthPayload?.endpoint, }; break; } + case ModelProvider.Mistral: { break; }