danny-avila / LibreChat

Enhanced ChatGPT Clone: Features Anthropic, AWS, OpenAI, Assistants API, Azure, Groq, o1, GPT-4o, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, langchain, DALL-E-3, ChatGPT Plugins, OpenAI Functions, Secure Multi-User System, Presets, completely open-source for self-hosting. Actively in public development.
https://librechat.ai/
MIT License
19.16k stars 3.19k forks source link

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

Closed danny-avila closed 1 month ago

danny-avila commented 1 month ago

Summary

I implemented a 5-second timeout for fetching AI provider model lists to improve reliability and performance. This change affects the OllamaClient and ModelService, preventing model fetching operations from hanging indefinitely.

The UI currently waits for all model fetching to finish before loading the main chat, and improved UX should be considered for this as it currently only shows a blank screen.

Other Changes

Testing

To test these changes:

  1. Ensure that all AI provider endpoints (OpenAI, Ollama, etc.) are properly configured.
  2. Attempt to fetch model lists from various providers.
  3. Verify that requests timeout after 5 seconds if no response is received.
  4. Check that error handling correctly captures and logs timeout errors.

Test Configuration:

Checklist