ChatGPTNextWeb / ChatGPTNextWeb/NextChat

[Bug] Unable to switch between models when using Azure OpenAI service 使用 Azure 时无法切换模型

Open
#3,331 11 comments 5 reactions 0 assignees View on GitHub
planned
Dominant language
TypeScript
Stars
88.8k
Forks
59.1k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
The project currently requires the `AZURE_URL` environment variable in the format like `https://{azure-resource-url}/openai/deployments/{deploy-name}`, which enforces the inclusion of the deployment name.
However, according to the Azure OpenAI documentation [[1]](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model) and [[2]](https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line%2Cpython&pivots=rest-api#rest-api), it's not possible to send requests to different models using a URL that specifies the deployment name. The relationship between deployment names and models are 1-to-1 (i.e. models are specified with the deployment name). This is different from the OpenAI API, where the model is specified in the request body.

For instance, consider having two models, gpt-3.5 and gpt-4 from the Azure OpenAI service. They would each have distinct URLs, such as `https://{azure-resource-url}/openai/deployments/gpt35` and `https://{azure-resource-url}/openai/deployments/gpt4`. In the current project implementation, switching between models is accomplished by altering the `model` field within the request body. However, this approach is not compatible with the Azure OpenAI service, where the deployment name portion of the URL needs to be changed instead.

**Relevent Discussions**
https://github.com/Yidadaa/ChatGPT-Next-Web/pull/3206#issuecomment-1807525917
https://github.com/Yidadaa/ChatGPT-Next-Web/pull/3206#issuecomment-1807529197
https://github.com/Yidadaa/ChatGPT-Next-Web/pull/3260

**Expected behavior**
A potential solution is to include a model name to deployment name mapper in the environment variables. For reference, see https://github.com/stulzq/azure-openai-proxy.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.