-
Notifications
You must be signed in to change notification settings - Fork 60.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix claude get headers #4903
Fix claude get headers #4903
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 newisAnthropic
flag.Consider adding a comment explaining what the
isAnthropic
flag is used for to improve code readability.const isAnthropic = accessStore.provider === ServiceProvider.Anthropic; // Check if the provider is Anthropic
187-188
: Ensure theAuthorization
header is correctly set for access codes.The
Authorization
header should always be used to send the access code, even for theAnthropic
provider.Verification successful
Ensure the
Authorization
header is correctly set for access codes.The
Authorization
header is correctly set for access codes in theapp/client/api.ts
file. The code snippet shows that theAuthorization
header is set using themakeBearer
function, 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
anthropicApiKey
in browser!!!Authorization
header send access codeSummary by CodeRabbit
New Features
Azure
,Google
, andAnthropic
providers.Bug Fixes
Refactor