Fix claude get headers#4903
Fix claude get headers#4903lloydzhou merged 2 commits intoChatGPTNextWeb:mainfrom ConnectAI-E:fix-claude-get-headers
Conversation
…thorization` header send access code
|
@lloydzhou is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThe recent update to the application introduces enhanced support for multiple providers (Azure, Google, and the new Anthropic provider) within the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Api as API
participant AccessStore
participant ClaudeApi
Client->>Api: Call getHeaders()
Api->>AccessStore: Retrieve API keys based on provider
Api-->>Client: Return headers
Client->>ClaudeApi: Initialize with headers
ClaudeApi->>Api: Import getHeaders
ClaudeApi-->>Client: ClaudeApi instance ready
Poem
Tip Early access features: enabledWe are currently testing the following features in early access:
Note:
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
|
Your build has completed! |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- app/client/api.ts (2 hunks)
- app/client/platforms/anthropic.ts (3 hunks)
Files not summarized due to errors (1)
- app/client/platforms/anthropic.ts: Error: Server error. Please try again later.
Files not reviewed due to errors (2)
- app/client/api.ts (Error: Server error. Please try again later.)
- app/client/platforms/anthropic.ts (Error: Server error. Please try again later.)
There was a problem hiding this comment.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- app/client/api.ts (2 hunks)
- app/client/platforms/anthropic.ts (3 hunks)
Files not reviewed due to errors (1)
- app/client/platforms/anthropic.ts (no review received)
Additional comments not posted (2)
app/client/api.ts (2)
165-165: Add a comment explaining the newisAnthropicflag.Consider adding a comment explaining what the
isAnthropicflag is used for to improve code readability.const isAnthropic = accessStore.provider === ServiceProvider.Anthropic; // Check if the provider is Anthropic
187-188: Ensure theAuthorizationheader is correctly set for access codes.The
Authorizationheader should always be used to send the access code, even for theAnthropicprovider.Verification successful
Ensure the
Authorizationheader is correctly set for access codes.The
Authorizationheader is correctly set for access codes in theapp/client/api.tsfile. The code snippet shows that theAuthorizationheader is set using themakeBearerfunction, which includes theaccessStore.accessCode.
app/client/api.ts:headers['Authorization'] = makeBearer( ACCESS_CODE_PREFIX + accessStore.accessCode, );Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the `Authorization` header is correctly set for access codes. # Test: Search for the usage of accessStore.accessCode. Expect: Occurrences in the `getHeaders` function. rg --type python $'accessStore.accessCode'Length of output: 72
Script:
#!/bin/bash # Description: Verify that the `Authorization` header is correctly set for access codes in TypeScript files. # Test: Search for the usage of accessStore.accessCode in TypeScript files. rg --type ts 'accessStore.accessCode'Length of output: 306
Script:
#!/bin/bash # Description: Extract context around the usage of accessStore.accessCode in app/client/api.ts to verify if it is correctly set in the Authorization header. # Test: Extract lines around accessStore.accessCode in app/client/api.ts to check header setting. rg --context 10 'accessStore.accessCode' app/client/api.tsLength of output: 763
anthropicApiKeyin browser!!!Authorizationheader send access codeSummary by CodeRabbit
New Features
Azure,Google, andAnthropicproviders.Bug Fixes
Refactor