mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-31 00:10:22 +08:00
fix: Chat does not work properly when configuring multiple API keys (#7385)
* refactor(openai): 使用getApiKey方法替代直接访问apiKey属性 * refactor(openai): 使用getApiKey方法替代直接访问provider.apiKey * refactor(api客户端): 直接使用apiKey属性替代getApiKey方法
This commit is contained in:
parent
1915ba5bfb
commit
a813df993c
@ -90,7 +90,7 @@ export class AnthropicAPIClient extends BaseApiClient<
|
||||
return this.sdkInstance
|
||||
}
|
||||
this.sdkInstance = new Anthropic({
|
||||
apiKey: this.getApiKey(),
|
||||
apiKey: this.apiKey,
|
||||
baseURL: this.getBaseURL(),
|
||||
dangerouslyAllowBrowser: true,
|
||||
defaultHeaders: {
|
||||
|
||||
@ -135,7 +135,7 @@ export abstract class OpenAIBaseClient<
|
||||
return this.sdkInstance
|
||||
}
|
||||
|
||||
let apiKeyForSdkInstance = this.provider.apiKey
|
||||
let apiKeyForSdkInstance = this.apiKey
|
||||
|
||||
if (this.provider.id === 'copilot') {
|
||||
const defaultHeaders = store.getState().copilot.defaultHeaders
|
||||
|
||||
@ -78,7 +78,7 @@ export class OpenAIResponseAPIClient extends OpenAIBaseClient<
|
||||
|
||||
return new OpenAI({
|
||||
dangerouslyAllowBrowser: true,
|
||||
apiKey: this.provider.apiKey,
|
||||
apiKey: this.apiKey,
|
||||
baseURL: this.getBaseURL(),
|
||||
defaultHeaders: {
|
||||
...this.defaultHeaders()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user