Introducing the ability to remove specified Providers.

This commit is contained in:
Q.A.zh 2024-12-28 04:17:22 +00:00
parent 0c3d4462ca
commit b09f458aeb
2 changed files with 11 additions and 1 deletions

View File

@ -343,11 +343,14 @@ If you want to disable parse settings from url, set this to 1.
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.
User `-all` to disable all default models, `+all` to enable all default models.
Use `-all` to disable all default models, `+all` to enable all default models.
Use `-*provider` to disable specified models.
Current valid providers: `openai,azure,google,anthropic,baidu,bytedance,alibaba,tencent,moonshot,iflytek,xai,chatglm` and more to come.
For Azure: use `modelName@Azure=deploymentName` to customize model name and deployment name.
> Example: `+gpt-3.5-turbo@Azure=gpt35` will show option `gpt35(Azure)` in model list.
> If you only can use Azure model, `-all,+gpt-3.5-turbo@Azure=gpt35` will `gpt35(Azure)` the only option in model list.
> If you don't want to use Azure model, using `-*azure` will prevent Azure models from appearing in the model list.
For ByteDance: use `modelName@bytedance=deploymentName` to customize model name and deployment name.
> Example: `+Doubao-lite-4k@bytedance=ep-xxxxx-xxx` will show option `Doubao-lite-4k(ByteDance)` in model list.

View File

@ -88,6 +88,13 @@ export function collectModelTable(
Object.values(modelTable).forEach(
(model) => (model.available = available),
);
} else if (name.startsWith("*")) {
const modelId = name.substring(1).toLowerCase();
Object.values(modelTable).forEach((model) => {
if (model?.provider?.id === modelId) {
model.available = available;
}
});
} else {
// 1. find model by name, and set available value
const [customModelName, customProviderName] = getModelProvider(name);