mirror of
https://github.com/open-webui/open-webui
synced 2024-11-16 13:40:55 +00:00
Merge pull request #5319 from Liuzhch1/fix-openai_timeout
fix: get OpenAI models only if OpenAI API Enabled; timeout for querying OpenAI models
This commit is contained in:
commit
61ee4bd629
@ -443,7 +443,7 @@ def get_available_models() -> list[dict]:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(
|
response = requests.get(
|
||||||
"https://api.elevenlabs.io/v1/models", headers=headers
|
"https://api.elevenlabs.io/v1/models", headers=headers, timeout=5
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
models = response.json()
|
models = response.json()
|
||||||
|
@ -150,18 +150,20 @@
|
|||||||
})()
|
})()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
const ollamaConfig = await getOllamaConfig(localStorage.token);
|
||||||
|
const openaiConfig = await getOpenAIConfig(localStorage.token);
|
||||||
|
|
||||||
|
ENABLE_OPENAI_API = openaiConfig.ENABLE_OPENAI_API;
|
||||||
|
ENABLE_OLLAMA_API = ollamaConfig.ENABLE_OLLAMA_API;
|
||||||
|
|
||||||
|
if (ENABLE_OPENAI_API) {
|
||||||
OPENAI_API_BASE_URLS.forEach(async (url, idx) => {
|
OPENAI_API_BASE_URLS.forEach(async (url, idx) => {
|
||||||
const res = await getOpenAIModels(localStorage.token, idx);
|
const res = await getOpenAIModels(localStorage.token, idx);
|
||||||
if (res.pipelines) {
|
if (res.pipelines) {
|
||||||
pipelineUrls[url] = true;
|
pipelineUrls[url] = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
const ollamaConfig = await getOllamaConfig(localStorage.token);
|
|
||||||
const openaiConfig = await getOpenAIConfig(localStorage.token);
|
|
||||||
|
|
||||||
ENABLE_OPENAI_API = openaiConfig.ENABLE_OPENAI_API;
|
|
||||||
ENABLE_OLLAMA_API = ollamaConfig.ENABLE_OLLAMA_API;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user