mirror of
https://github.com/xtekky/gpt4free.git
synced 2024-11-15 06:13:01 +00:00
Filter not working provider from RetryProvider
This commit is contained in:
parent
993c9498c4
commit
012f40078a
@ -69,12 +69,15 @@ def get_model_and_provider(model : Union[Model, str],
|
|||||||
if isinstance(model, Model):
|
if isinstance(model, Model):
|
||||||
model = model.name
|
model = model.name
|
||||||
|
|
||||||
if ignored and isinstance(provider, BaseRetryProvider):
|
|
||||||
provider.providers = [p for p in provider.providers if p.__name__ not in ignored]
|
|
||||||
|
|
||||||
if not ignore_working and not provider.working:
|
if not ignore_working and not provider.working:
|
||||||
raise ProviderNotWorkingError(f'{provider.__name__} is not working')
|
raise ProviderNotWorkingError(f'{provider.__name__} is not working')
|
||||||
|
|
||||||
|
if not ignore_working and isinstance(provider, BaseRetryProvider):
|
||||||
|
provider.providers = [p for p in provider.providers if p.working]
|
||||||
|
|
||||||
|
if ignored and isinstance(provider, BaseRetryProvider):
|
||||||
|
provider.providers = [p for p in provider.providers if p.__name__ not in ignored]
|
||||||
|
|
||||||
if not ignore_stream and not provider.supports_stream and stream:
|
if not ignore_stream and not provider.supports_stream and stream:
|
||||||
raise StreamNotSupportedError(f'{provider.__name__} does not support "stream" argument')
|
raise StreamNotSupportedError(f'{provider.__name__} does not support "stream" argument')
|
||||||
|
|
||||||
|
@ -938,10 +938,10 @@ async function load_provider_models() {
|
|||||||
provider = providerSelect.options[providerSelect.selectedIndex].value;
|
provider = providerSelect.options[providerSelect.selectedIndex].value;
|
||||||
response = await fetch('/backend-api/v2/models/' + provider);
|
response = await fetch('/backend-api/v2/models/' + provider);
|
||||||
models = await response.json();
|
models = await response.json();
|
||||||
|
modelProvider.innerHTML = '';
|
||||||
if (models.length > 0) {
|
if (models.length > 0) {
|
||||||
modelSelect.classList.add("hidden");
|
modelSelect.classList.add("hidden");
|
||||||
modelProvider.classList.remove("hidden");
|
modelProvider.classList.remove("hidden");
|
||||||
modelProvider.innerHTML = '';
|
|
||||||
models.forEach((model) => {
|
models.forEach((model) => {
|
||||||
let option = document.createElement('option');
|
let option = document.createElement('option');
|
||||||
option.value = option.text = model.model;
|
option.value = option.text = model.model;
|
||||||
|
Loading…
Reference in New Issue
Block a user