-
Notifications
You must be signed in to change notification settings - Fork 60k
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
support azure deployment name #4930
Conversation
@lloydzhou is attempting to deploy a commit to the NextChat Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis update refines how the system handles Azure deployments, streamlining authentication and URL construction based on request paths. It introduces Azure-specific request handling, augments model configurations with provider names, and consolidates model API usage for both Azure and OpenAI. These enhancements ensure a smooth, integrated experience for handling various AI model providers within the application's ecosystem. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Auth
participant Common
participant AzureRoute
participant OpenAI
Client->>Auth: Request authentication
Auth->>Common: Forward request
Common->>AzureRoute: Check if Azure deployment
AzureRoute-->>Common: Confirm Azure deployment
Common->>AzureRoute: Construct Azure-specific URL
AzureRoute->>OpenAI: Request data from OpenAI service
OpenAI-->>AzureRoute: Send response to AzureRoute
AzureRoute-->>Common: Return response
Common-->>Auth: Return authentication response
Auth-->>Client: Send response to client
Poem
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 (
|
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: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- app/api/auth.ts (1 hunks)
- app/api/common.ts (2 hunks)
- app/client/api.ts (5 hunks)
- app/client/platforms/openai.ts (5 hunks)
- app/components/chat.tsx (4 hunks)
- app/components/exporter.tsx (2 hunks)
- app/components/home.tsx (3 hunks)
- app/components/model-config.tsx (3 hunks)
- app/constant.ts (3 hunks)
- app/store/access.ts (2 hunks)
- app/store/chat.ts (4 hunks)
- app/store/config.ts (2 hunks)
- app/utils/hooks.ts (1 hunks)
- next.config.mjs (1 hunks)
Additional context used
Biome
app/api/auth.ts
[error] 76-76: Useless case clause.
because the default clause is present:
Unsafe fix: Remove the useless case.
(lint/complexity/noUselessSwitchCase)
Additional comments not posted (28)
app/utils/hooks.ts (1)
14-19
: LGTM!The useMemo dependency array correctly includes all the relevant variables.
next.config.mjs (1)
72-76
: Ensure correct Azure API URL construction.The Azure API URL construction looks correct, but verify the placeholders
{resource_name}
and{deploy_name}
are properly replaced in actual usage.app/api/auth.ts (1)
78-78
: Remove the redundant case clause.The case clause for
ModelProvider.GPT
is redundant due to the default clause being present.- case ModelProvider.GPT:
Likely invalid or redundant comment.
app/store/access.ts (2)
36-38
: LGTM!The default Azure API version is correctly set.
20-23
: Verify Azure URL configuration.Ensure that the Azure URL configuration correctly handles the
{resource_name}
placeholder in actual usage.app/store/config.ts (1)
8-8
: LGTM! But verify the usage ofproviderName
in the codebase.The addition of the
providerName
field to themodelConfig
object is appropriate for handling multiple service providers.However, ensure that all references to
modelConfig
are updated to handleproviderName
.Also applies to: 52-52
Verification successful
LGTM! The
providerName
field is correctly handled throughout the codebase.The addition of the
providerName
field to themodelConfig
object is consistent and appropriately integrated into the codebase.
- The field is used in conditional checks and assignments.
- It is referenced in multiple files, ensuring comprehensive integration.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `providerName` in the codebase. # Test: Search for the usage of `modelConfig` to ensure `providerName` is handled correctly. rg --type-add 'ts' --type ts 'modelConfig'Length of output: 100
Script:
#!/bin/bash # Description: Verify the usage of `providerName` in the codebase. # Test: Search for the usage of `modelConfig` to ensure `providerName` is handled correctly. rg --type-add 'ts:*.ts' 'modelConfig'Length of output: 12120
app/api/common.ts (2)
60-66
: LGTM! But verify the correctness of the constructed paths and URLs.The logic for constructing the Azure-specific path and base URL is appropriate for handling Azure deployment requests.
However, ensure that the constructed paths and URLs are correct and there are no edge cases that need to be handled.
16-17
: LGTM! But verify the sufficiency of theisAzure
check.The addition of the
isAzure
variable and its usage in the authentication logic is appropriate for handling Azure-specific requests.However, ensure that the
isAzure
check is sufficient and there are no edge cases that need to be handled.Also applies to: 20-20
app/client/api.ts (3)
33-33
: LGTM! But verify the usage ofproviderName
in the codebase.The addition of the
providerName
field to theLLMConfig
interface is appropriate for handling multiple service providers.However, ensure that all references to
LLMConfig
are updated to handleproviderName
.Verification successful
Verified the usage of
providerName
in the codebase.The addition of the
providerName
field to theLLMConfig
interface is consistently used across the codebase, ensuring proper handling of multiple service providers.
app/client/api.ts
app/constant.ts
app/utils/model.ts
app/store/chat.ts
app/store/config.ts
app/client/platforms/openai.ts
app/client/platforms/anthropic.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `providerName` in the codebase. # Test: Search for the usage of `LLMConfig` to ensure `providerName` is handled correctly. rg --type-add 'ts' --type ts 'LLMConfig'Length of output: 98
Script:
#!/bin/bash # Description: Verify the usage of `providerName` in the codebase. # Test: Search for the usage of `LLMConfig` to ensure `providerName` is handled correctly. rg 'LLMConfig' --glob '*.ts' # Test: Search for the usage of `providerName` to ensure it is being used correctly. rg 'providerName' --glob '*.ts'Length of output: 1911
Line range hint
165-195
:
LGTM! But verify the correctness of the authentication logic.The modifications to the
getHeaders
function to handle the newproviderName
field and adjust the authentication headers based on the provider type are appropriate.However, ensure that the logic for determining the authentication header and API key is correct and there are no edge cases that need to be handled.
Verification successful
Authentication Logic Verified
The modifications to the
getHeaders
function handle the newproviderName
field and adjust the authentication headers based on the provider type. The logic for determining the authentication header and API key appears to be consistent and correctly implemented across different contexts.
app/store/access.ts
: The headers are correctly applied for fetching configuration.app/client/platforms/google.ts
: The headers are correctly applied for Google API requests.app/client/platforms/openai.ts
: The headers are correctly applied for OpenAI API requests.app/client/platforms/anthropic.ts
: The headers are correctly applied for Anthropic API requests.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the authentication logic. # Test: Search for all occurrences of `getHeaders` to ensure the authentication logic is correct. rg --type-add 'ts' --type ts 'getHeaders'Length of output: 99
Script:
#!/bin/bash # Description: Verify the correctness of the authentication logic. # Test: Search for all occurrences of `getHeaders` to ensure the authentication logic is correct. rg 'getHeaders'Length of output: 830
Script:
#!/bin/bash # Extract the relevant code snippets from the files where `getHeaders` is used. # Define the files to search. files=( "app/store/access.ts" "app/client/platforms/google.ts" "app/client/platforms/openai.ts" "app/client/platforms/anthropic.ts" ) # Loop through the files and extract lines around `getHeaders` usage. for file in "${files[@]}"; do echo "File: $file" rg -C 5 'getHeaders' "$file" echo doneLength of output: 4061
58-58
: LGTM! But verify the usage ofdisplayName
in the codebase.The addition of the
displayName
field to theLLMModel
interface is appropriate for providing a user-friendly name for models.However, ensure that all references to
LLMModel
are updated to handledisplayName
.Verification successful
The
displayName
field is correctly integrated and used across the codebase.The references in various files such as
app/utils/model.ts
,app/client/platforms/openai.ts
,app/components/model-config.tsx
, andapp/components/chat.tsx
confirm thatdisplayName
is appropriately handled.
app/utils/model.ts
:displayName
is set and accessed.app/client/platforms/openai.ts
:displayName
is referenced.app/components/model-config.tsx
andapp/components/chat.tsx
:displayName
is used for display purposes.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `displayName` in the codebase. # Test: Search for the usage of `LLMModel` to ensure `displayName` is handled correctly. rg --type-add 'ts' --type ts 'LLMModel'Length of output: 97
Script:
#!/bin/bash # Description: Verify the usage of `displayName` in the codebase. # Test: Search for the usage of `LLMModel` to ensure `displayName` is handled correctly. rg --type ts 'LLMModel'Length of output: 1129
Script:
#!/bin/bash # Description: Verify the usage of `displayName` in the codebase by inspecting the relevant lines. # Extract and display the relevant lines from the identified files. rg --type ts 'LLMModel' -A 5 -B 5Length of output: 7319
Script:
#!/bin/bash # Description: Verify the usage of the `displayName` field in the codebase. # Search for the usage of the `displayName` field in the codebase. rg --type ts 'displayName'Length of output: 797
app/components/home.tsx (2)
15-15
: LGTM! But verify the usage ofServiceProvider
in the codebase.The addition of the
ServiceProvider
constant in the import statement is appropriate for handling multiple service providers.However, ensure that all references to
ServiceProvider
are updated to handle it correctly.Verification successful
Let's correct the
rg
command to search forServiceProvider
directly in TypeScript files.
The usage of
ServiceProvider
is verified and consistent across the codebase.The import of
ServiceProvider
inhome.tsx
aligns with its usage in other parts of the code, confirming that it is handled correctly.
app/constant.ts
app/store/config.ts
app/store/access.ts
app/components/home.tsx
app/components/model-config.tsx
app/components/settings.tsx
app/components/exporter.tsx
app/components/chat.tsx
app/store/chat.ts
app/client/api.ts
app/client/platforms/openai.ts
app/api/common.ts
app/api/anthropic/[...path]/route.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `ServiceProvider` in the codebase. # Test: Search for the usage of `ServiceProvider` to ensure it is handled correctly. rg --type-add 'ts' --type ts 'ServiceProvider'Length of output: 104
Script:
#!/bin/bash # Description: Verify the usage of `ServiceProvider` in the codebase. # Test: Search for the usage of `ServiceProvider` to ensure it is handled correctly. rg 'ServiceProvider' --glob '*.ts' --glob '*.tsx'Length of output: 3756
174-176
: LGTM! But verify the correctness of the logic for selectingClientApi
.The modifications to the logic for selecting
ClientApi
based onconfig.modelConfig.providerName
are appropriate.However, ensure that the logic for selecting the
ClientApi
is correct and there are no edge cases that need to be handled.app/constant.ts (2)
28-30
: LGTM!The added
ApiPath
enum values for Azure, OpenAI, and Anthropic are appropriate and consistent with the existing enum structure.
97-98
: LGTM!The added
ServiceProvider
andModelProvider
enum values, as well as the constants for Azure, Google, and Anthropic API paths and models, are appropriate and consistent with the existing structure.app/components/model-config.tsx (2)
14-26
: LGTM!The changes to include the provider name in the
value
andonChange
logic for theSelect
component are logical and ensure the correct handling of the provider name in the configuration.
96-96
: LGTM!The conditional rendering based on
providerName
is appropriate and ensures that certain settings are only shown for specific providers, improving configurability and user experience.app/client/platforms/openai.ts (3)
67-67
: LGTM!The added
isAzure
logic in thepath
method appropriately determines Azure paths. The error handling for incomplete Azure configuration is useful for guiding the user.
80-91
: LGTM!The conditional path construction logic ensures that the correct base URL is used for Azure and OpenAI paths.
144-169
: LGTM!The added Azure-specific logic in the
chat
method appropriately handles Azure paths and configurations. The use ofcollectModelsWithDefaultModel
to find the correct model is useful for flexibility.app/components/exporter.tsx (1)
320-322
: LGTM!The added logic for selecting the
ClientApi
instance based on theproviderName
ensures that the correct API is used for different providers.app/store/chat.ts (4)
Line range hint
452-454
: Verify the logic forproviderName
in model selector.Ensure that all possible values of
providerName
are correctly handled when switching models.Verification successful
Line range hint
452-454
: Verified the logic forproviderName
in model selector.The code correctly handles all possible values for
providerName
when switching models, ensuring the correct provider is associated with each model.
- Valid
providerName
values: "OpenAI", "Azure", "Google", "Anthropic", "Custom"Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all possible values for `providerName` are handled correctly. # Test: Search for all possible values of `providerName`. Expect: Only valid values are used. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'providerName'Length of output: 135
Script:
#!/bin/bash # Description: Verify all possible values for `providerName` are handled correctly. # Test: Search for all possible values of `providerName`. Expect: Only valid values are used. rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type-add 'js:*.js' --type-add 'jsx:*.jsx' 'providerName'Length of output: 3612
Line range hint
486-492
: Ensure correct model and provider assignment.The logic for updating the session with the new model and provider should be verified to ensure correctness.
Verification successful
Ensure correct model and provider assignment.
The logic for updating the session with the new model and provider appears to be correctly implemented in the
app/components/chat.tsx
file. Thesession.mask.modelConfig.model
andsession.mask.modelConfig.providerName
are being assigned appropriately.
app/components/chat.tsx
:
session.mask.modelConfig.model = nextModel.name;
session.mask.modelConfig.providerName = nextModel?.provider?.providerName as ServiceProvider;
session.mask.modelConfig.model = model as ModelType;
session.mask.modelConfig.providerName = providerName as ServiceProvider;
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the logic for updating the session with the new model and provider. # Test: Search for the update logic. Expect: Correct assignment of model and provider. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'updateCurrentSession'Length of output: 143
Script:
#!/bin/bash # Correctly define types and search for the updateCurrentSession function rg --type-add 'typescript:*.ts' --type-add 'typescriptreact:*.tsx' --type-add 'javascript:*.js' --type-add 'javascriptreact:*.jsx' 'updateCurrentSession'Length of output: 1777
Script:
#!/bin/bash # Extract the implementation details of updateCurrentSession from the relevant files rg --type-add 'typescript:*.ts' --type-add 'typescriptreact:*.tsx' --type-add 'javascript:*.js' --type-add 'javascriptreact:*.jsx' -A 10 'updateCurrentSession' app/store/chat.ts app/components/chat.tsxLength of output: 13214
367-369
: Verify the conditional logic forproviderName
.Ensure that all possible values of
providerName
are correctly handled. Missing values can lead to incorrectClientApi
instantiation.
Line range hint
580-599
: Ensure correct handling of model selection and provider assignment.The logic for handling model selection and provider assignment should be verified to ensure correctness.
Verification successful
Handling of model selection and provider assignment is correctly implemented.
The code correctly handles model selection and provider assignment by setting the appropriate API client based on the
providerName
and using the model configuration for various parameters and defaults.
app/store/chat.ts
: Multiple instances show correct usage ofmodelConfig
for setting model properties and checking provider names.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of model selection and provider assignment. # Test: Search for the handling logic. Expect: Correct handling of model selection and provider assignment. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'modelConfig'Length of output: 134
Script:
#!/bin/bash # Description: Verify the handling of model selection and provider assignment. # Test: Search for the handling logic. Expect: Correct handling of model selection and provider assignment. rg 'modelConfig' --type ts --type tsx --type js --type jsxLength of output: 86
Script:
#!/bin/bash # Description: Verify the handling of model selection and provider assignment. # Test: Search for the handling logic. Expect: Correct handling of model selection and provider assignment. rg 'modelConfig' -g '*.ts' -g '*.tsx' -g '*.js' -g '*.jsx'Length of output: 12141
Script:
#!/bin/bash # Description: Extract and review relevant code snippets from app/store/chat.ts to ensure the correct handling of model selection and provider assignment. # Extract lines where modelConfig is used in app/store/chat.ts rg 'modelConfig' app/store/chat.ts -nLength of output: 2572
Script:
#!/bin/bash # Description: Extract relevant code snippets from app/store/chat.ts for detailed review. # Extract relevant code snippets around identified lines sed -n -e '117,130p' -e '220,230p' -e '313,323p' -e '346,356p' -e '367,379p' -e '442,454p' -e '476,488p' -e '501,511p' -e '548,560p' -e '578,590p' -e '600,630p' -e '640,650p' -e '698,710p' -e '719,730p' app/store/chat.tsLength of output: 7170
app/components/chat.tsx (3)
580-599
: Ensure correct handling of model selection and provider assignment.The logic for handling model selection and provider assignment should be verified to ensure correctness.
Verification successful
The handling of model selection and provider assignment appears to be correctly implemented.
The logic for updating the
modelConfig
with the selected model and provider name is present and used consistently throughout the codebase.
app/components/chat.tsx
: ThemodelConfig
is updated with the selected model and provider name.- Other files also show consistent usage and updates to the
modelConfig
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the handling of model selection and provider assignment. # Test: Search for the handling logic. Expect: Correct handling of model selection and provider assignment. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'modelConfig'Length of output: 134
Script:
#!/bin/bash # Description: Verify the handling of model selection and provider assignment. # Test: Search for the handling logic. Expect: Correct handling of model selection and provider assignment. rg --glob '*.ts' --glob '*.tsx' --glob '*.js' --glob '*.jsx' 'modelConfig'Length of output: 12157
452-454
: Verify the logic forproviderName
in model selector.Ensure that all possible values of
providerName
are correctly handled when switching models.Verification successful
The logic for
providerName
in the model selector is correctly implemented.The codebase consistently handles all possible values of
providerName
("OpenAI", "Azure", "Google", "Anthropic", and "Custom") across various files.
app/constant.ts
app/components/chat.tsx
app/components/model-config.tsx
app/components/home.tsx
app/components/exporter.tsx
app/utils/model.ts
app/store/config.ts
app/store/chat.ts
app/client/api.ts
app/client/platforms/openai.ts
app/client/platforms/anthropic.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all possible values for `providerName` are handled correctly. # Test: Search for all possible values of `providerName`. Expect: Only valid values are used. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'providerName'Length of output: 135
Script:
#!/bin/bash # Description: Verify all possible values for `providerName` are handled correctly. # Correcting the --type-add syntax to search for providerName across relevant files. rg --type-add 'ts:*.ts' --type-add 'tsx:*.tsx' --type-add 'js:*.js' --type-add 'jsx:*.jsx' 'providerName'Length of output: 3612
486-492
: Ensure correct model and provider assignment.The logic for updating the session with the new model and provider should be verified to ensure correctness.
Verification successful
The logic for updating the session with the new model and provider is correctly implemented.
- The assignment of
nextModel.name
tosession.mask.modelConfig.model
andnextModel?.provider?.providerName
tosession.mask.modelConfig.providerName
ensures that both the model and provider are updated correctly.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the logic for updating the session with the new model and provider. # Test: Search for the update logic. Expect: Correct assignment of model and provider. rg --type-add 'ts' --type-add 'tsx' --type-add 'js' --type-add 'jsx' 'updateCurrentSession'Length of output: 143
Script:
#!/bin/bash # Description: Verify the logic for updating the session with the new model and provider. # Test: Search for the update logic. Expect: Correct assignment of model and provider. rg --type ts --type tsx --type js --type jsx 'updateCurrentSession'Length of output: 95
Script:
#!/bin/bash # Description: Verify the logic for updating the session with the new model and provider. # Test: Search for the update logic. Expect: Correct assignment of model and provider. rg --type ts --type js 'updateCurrentSession'Length of output: 1669
Script:
#!/bin/bash # Description: Extract relevant lines from app/components/chat.tsx to verify the logic for updating the session with the new model and provider. # Extract lines around the instances of updateCurrentSession in app/components/chat.tsx rg --type ts --type js -A 5 -B 5 'updateCurrentSession' app/components/chat.tsxLength of output: 5267
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/api/common.ts (2 hunks)
- app/client/platforms/openai.ts (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- app/api/common.ts
Additional comments not posted (4)
app/client/platforms/openai.ts (4)
8-8
: Imports look good.The new imports for
Azure
andServiceProvider
are necessary for the added logic.
144-172
: LGTM!The changes in the
fetchEventSource
logic correctly handle Azure's text moderation results. The logic looks sound.
67-91
: LGTM! Ensure Azure configuration is correct.The changes in the
path
method correctly identify and handle Azure requests. Verify that the Azure configuration is complete and valid.Verification successful
LGTM! Ensure Azure configuration is correct.
The changes in the
path
method correctly identify and handle Azure requests. TheisValidAzure
method validates the presence of essential Azure configuration properties (azureUrl
,azureApiKey
,azureApiVersion
). Ensure that these properties are correctly set in your settings.
app/store/access.ts
:isValidAzure
method implementation.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that Azure configuration is complete and valid. # Test: Search for the Azure configuration validation. Expect: Proper validation logic. rg --type python 'isValidAzure'Length of output: 62
Script:
#!/bin/bash # Description: Verify that Azure configuration is complete and valid. # Test: Search for the Azure configuration validation in TypeScript files. Expect: Proper validation logic. rg --type ts 'isValidAzure'Length of output: 202
Script:
#!/bin/bash # Description: Extract the implementation of the isValidAzure method. # Extract the isValidAzure method implementation from app/store/access.ts rg --type ts --context 10 'isValidAzure()' app/store/access.tsLength of output: 1006
Line range hint
116-170
:
LGTM! Verify model collection logic.The changes in the
chat
method correctly handle the provider-specific API paths. Verify that the model collection logic is accurate and complete.Verification successful
LGTM! Verify model collection logic.
The changes in the
chat
method correctly handle the provider-specific API paths. The model collection logic, as implemented incollectModelsWithDefaultModel
,collectModelTableWithDefaultModel
, andcollectModelTable
, is accurate and complete.
collectModelsWithDefaultModel
is located inapp/utils/model.ts
(lines 107-119).collectModelTableWithDefaultModel
is located inapp/utils/model.ts
(lines 77-92).collectModelTable
is located inapp/utils/model.ts
(lines 10-75).Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the model collection logic is accurate and complete. # Test: Search for the model collection function. Expect: Proper model collection logic. rg --type python 'collectModelsWithDefaultModel'Length of output: 79
Script:
#!/bin/bash # Description: Verify that the model collection logic is accurate and complete. # Test: Search for the model collection function. Expect: Proper model collection logic. rg --type ts 'function collectModelsWithDefaultModel'Length of output: 121
Script:
#!/bin/bash # Extract the implementation of the collectModelsWithDefaultModel function from app/utils/model.ts ast-grep --lang typescript --pattern 'function collectModelsWithDefaultModel($$$) { $$$ }'Length of output: 725
Script:
#!/bin/bash # Extract the implementation of the collectModelTableWithDefaultModel function from app/utils/model.ts ast-grep --lang typescript --pattern 'function collectModelTableWithDefaultModel($$$) { $$$ }'Length of output: 893
Script:
#!/bin/bash # Extract the implementation of the collectModelTable function from app/utils/model.ts ast-grep --lang typescript --pattern 'function collectModelTable($$$) { $$$ }'Length of output: 3516
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 (1)
- app/api/azure/[...path]/route.ts (1 hunks)
Additional comments not posted (5)
app/api/azure/[...path]/route.ts (5)
1-6
: Imports look good.The imported modules and utilities appear necessary and relevant for the functionality provided.
8-18
: Initial part of the handle function looks good.The function correctly logs parameters, handles OPTIONS method, and constructs the subpath.
20-25
: Authentication and error handling look good.The function correctly performs authentication and handles errors appropriately.
27-32
: Request handling and error logging look good.The function correctly makes a request using
requestOpenai
and handles errors appropriately.
35-57
: Export statements and runtime configuration look good.The file correctly exports the
handle
function for GET and POST methods, specifies runtime as "edge", and lists preferred regions.
app/client/platforms/openai.ts
Outdated
@@ -140,7 +141,33 @@ export class ChatGPTApi implements LLMApi { | |||
options.onController?.(controller); | |||
|
|||
try { | |||
const chatPath = this.path(OpenaiPath.ChatPath); | |||
let chatPath = ""; | |||
if (modelConfig.providerName == ServiceProvider.Azure) { |
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.
那么这里最新的azure 配置是什么样 需要更新一下readme
|
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 (3)
- app/client/api.ts (5 hunks)
- app/client/platforms/openai.ts (5 hunks)
- app/constant.ts (4 hunks)
Files skipped from review as they are similar to previous changes (3)
- app/client/api.ts
- app/client/platforms/openai.ts
- app/constant.ts
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/api/common.ts (2 hunks)
- app/client/platforms/openai.ts (5 hunks)
Files skipped from review as they are similar to previous changes (2)
- app/api/common.ts
- app/client/platforms/openai.ts
|
理解。 我同意你的看法,我考虑的做法是用CUSTOM_MODELS做文章,具体的,你可以新增一个parser,目前的语法是 此外 我理解这个做法对目前的侵入性是比较低的,可以考虑一下。 |
understand. I agree with you. The approach I am considering is to use CUSTOM_MODELS. Specifically, you can add a new parser. The current syntax is In addition, other parameters can be expanded in the form of key-value pairs in I understand that this approach is relatively less intrusive at present, and I might consider it. |
其实中间和另一个开发者讨论过使用 关于你提到的 |
In fact, I discussed with another developer about using Regarding the syntax of |
我没理解“最后的这个等于没有存在的必要”这句话。是指不需要
或者是我在本地部署的ollama或者其他openai api兼容的provider, 或者说考虑向上兼容的问题,正在使用的许多用户可能已经指定了 |
I don't understand the sentence "The last one means there is no need to exist." Does it mean that I think Or my locally deployed ollama or other openai api compatible provider, In other words, considering the issue of upward compatibility, many users who are currently using it may have specified |
确实。我一段时间deployment_name一般会跟model_name一样,因为如果用其他工具,这俩不一样,有时候会不识别,nextweb 算是最早开始解决这个问题的产品了。 |
really. For a while, deployment_name is usually the same as model_name, because if I use other tools, the two are different and sometimes they are not recognized. Nextweb is the first product to solve this problem. |
我的意思是:使用 |
What I mean is: after using the |
注意到 #4930 (comment) 这里最后一点提及的
绝大部分用户是希望或者默认普通的升级是无感知的,或者至少不会带来兼容性问题(例如python2 -> python 3)的灾难。当然不向前兼容也可以提前几个大版本标记这个写法 |
Note the last point mentioned here at #4930 (comment)
Most users hope or default that ordinary upgrades will be imperceptible, or at least will not cause disasters such as compatibility issues (such as python2 -> python 3). Of course, if you are not forward-compatible, you can also mark it several major versions in advance. This writing method |
或许前面提到的
另外:
这个可能再扩展一下也能处理(不过感觉改动有点多):
|
Perhaps the
in addition:
This may be able to be handled by expanding it (but I feel like the changes are a bit too much):
|
使用这里的CUSTOM_PROVIDER模式,应该可以通过配置的方式解决像one-api这种中转平台的问题:
|
Using the CUSTOM_PROVIDER mode here, you should be able to solve the problem of a transit platform like one-api through configuration:
|
@lloydzhou 已经明确是 azure_url 的时候,还出现 gpt-4o(openai)这个 bug 找到原因了吗?大概多久可以发布。 |
@lloydzhou When it is clear that it is azure_url, the gpt-4o (openai) bug still appears. Have you found the reason? How long will it take to publish. |
Summary by CodeRabbit
New Features
providerName
anddisplayName
in model configurations.Bug Fixes
Refactor
providerName
for configuration and model selection.Chores