Skip to content

Commit d681d2f

Browse files
Yidadaalovely
authored and
lovely
committed
feat: close ChatGPTNextWeb#3301 enable or diable default models with -all / +all
1 parent d090e82 commit d681d2f

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,11 @@ If you want to disable parse settings from url, set this to 1.
216216
### `CUSTOM_MODELS` (optional)
217217

218218
> Default: Empty
219-
> Example: `+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview:gpt-4-turbo` means add `llama, claude-2` to model list, and remove `gpt-3.5-turbo` from list, and display `gpt-4-1106-preview` as `gpt-4-turbo`.
219+
> Example: `+llama,+claude-2,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo` means add `llama, claude-2` to model list, and remove `gpt-3.5-turbo` from list, and display `gpt-4-1106-preview` as `gpt-4-turbo`.
220220
221-
To control custom models, use `+` to add a custom model, use `-` to hide a model, use `name:displayName` to customize model name, separated by comma.
221+
To control custom models, use `+` to add a custom model, use `-` to hide a model, use `name=displayName` to customize model name, separated by comma.
222+
223+
User `-all` to disable all default models, `+all` to enable all default models.
222224

223225
## Requirements
224226

README_CN.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,10 @@ Azure Api 版本,你可以在这里找到:[Azure 文档](https://learn.micro
122122

123123
### `CUSTOM_MODELS` (可选)
124124

125-
> 示例:`+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-1106-preview:gpt-4-turbo` 表示增加 `qwen-7b-chat``glm-6b` 到模型列表,而从列表中删除 `gpt-3.5-turbo`,并将 `gpt-4-1106-preview` 模型名字展示为 `gpt-4-turbo`
125+
> 示例:`+qwen-7b-chat,+glm-6b,-gpt-3.5-turbo,gpt-4-1106-preview=gpt-4-turbo` 表示增加 `qwen-7b-chat``glm-6b` 到模型列表,而从列表中删除 `gpt-3.5-turbo`,并将 `gpt-4-1106-preview` 模型名字展示为 `gpt-4-turbo`
126+
> 如果你想先禁用所有模型,再启用指定模型,可以使用 `-all,+gpt-3.5-turbo`,则表示仅启用 `gpt-3.5-turbo`
126127
127-
用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名:展示名` 来自定义模型的展示名,用英文逗号隔开。
128+
用来控制模型列表,使用 `+` 增加一个模型,使用 `-` 来隐藏一个模型,使用 `模型名=展示名` 来自定义模型的展示名,用英文逗号隔开。
128129

129130
## 开发
130131

app/utils/model.ts

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ export function collectModelTable(
2727
const nameConfig =
2828
m.startsWith("+") || m.startsWith("-") ? m.slice(1) : m;
2929
const [name, displayName] = nameConfig.split(":");
30+
31+
// enable or disable all models
32+
if (name === "all") {
33+
Object.values(modelTable).forEach((m) => (m.available = available));
34+
}
35+
3036
modelTable[name] = {
3137
name,
3238
displayName: displayName || name,

0 commit comments

Comments
 (0)