🕒 feat: Add 5-second timeout for Fetching Model Lists (#4423)

* refactor: add 5 second timeout for fetching AI provider model lists

* ci: fix test due to recent changes
This commit is contained in:
Danny Avila 2024-10-15 19:37:41 -04:00 committed by GitHub
parent ef118009f6
commit c54a57019e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 16 additions and 9 deletions

View file

@ -60,7 +60,9 @@ class OllamaClient {
try {
const ollamaEndpoint = deriveBaseURL(baseURL);
/** @type {Promise<AxiosResponse<OllamaListResponse>>} */
const response = await axios.get(`${ollamaEndpoint}/api/tags`);
const response = await axios.get(`${ollamaEndpoint}/api/tags`, {
timeout: 5000,
});
models = response.data.models.map((tag) => tag.name);
return models;
} catch (error) {