ChatGPTNextWeb / ChatGPTNextWeb/NextChat

[Feature Request]: 基于模型服务商+模型名选择请求格式,而不是简单地依靠模型名

Open
#4,804 3 comments 0 reactions 0 assignees View on GitHub
duplicate enhancement
Dominant language
TypeScript
Stars
88.8k
Forks
59.1k
PR merge metrics
No merged PRs in 30d

Description

### Problem Description

有如下情景:
经过 one-api 得到 openai 请求格式的 gemini-pro 模型,即请求格式类似:
~~~http
POST {{one_base}}/v1/chat/completions
Content-Type: application/json
Authorization: Bearer {{one_key}}

{
"model": "gemini-pro",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "hello"
}
],
"stream": true
}
~~~

如果填入one_base作为 openai 的自定义端点,填入one_key、自定义模型gemini-pro,仍然提示需要配置 Google 作为模型服务商。
![](https://cdn.jsdelivr.net/gh/takestairs/PicsBed@main/2024_05/202405312059561.png)

![image](https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web/assets/124553004/1df74cec-c852-4408-a5bc-a2517362192d)

类似的情景我相信还有很多。其实如果通过one_api来中转api,这边以 openai API 的客户端,完全可以轻松地实现多端点、多key的轮询。只需要让发起请求的api格式不简单地通过模型名称来分别。

### Solution Description

对于这个问题,我的解决思路是:
1. 区分自定义模型设置,各个模型服务商可以配置对应的自定义模型
2. 使用`模型服务商+模型名`,唯一描述一个模型允许的请求格式
3. 现有的识图功能可以基于模型名进行区分,模型服务商仅区别请求格式
4. 基于用户选定的 `模型名(服务商)` 确定模型名和请求格式(OpenAI/Google/Azure等)

### Alternatives Considered

_No response_

### Additional Context

_No response_

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.