Skip to content

Commit

Permalink
💄 style: support anthropic browser request (lobehub#3798)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Sep 6, 2024
1 parent b4f3512 commit 743df51
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion src/config/modelProviders/anthropic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const Anthropic: ModelProviderCard = {
},
],
checkModel: 'claude-3-haiku-20240307',
disableBrowserRequest: true,
id: 'anthropic',
name: 'Anthropic',
proxyUrl: {
Expand Down
4 changes: 2 additions & 2 deletions src/libs/agent-runtime/anthropic/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/services/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 743df51

Please sign in to comment.