- Modify load_config function to copy user_config.cfg from user_config.cfg.sample if it doesn't exist
- Update README.md to reflect new features and configuration options, including web-based settings and job queue management
Move the logic for building user content, including topic selection and recent prompts avoidance, into a shared function in generic.py. Update openrouter.py and openwebui.py to use this new function instead of duplicating code.
Add a new configuration option `list_all_free_models` to enable fetching and displaying free models from OpenRouter. Enhance model loading functions to include free models when enabled, and implement fallback logic in prompt generation to try alternative models if the primary one fails. Update the UI to display free models in a separate optgroup.
- Add extraction logic for Qwen workflow metadata in PNG files
- Improve OpenRouter model selection with validation and fallback to free/configured models
- Remove outdated Flux workflow file
- Update Qwen workflow configuration with new parameters and simplified structure
fix(openrouter): handle rate limit errors with OpenWebUI fallback
When OpenRouter returns a 429 error due to rate limiting, the application now attempts to fall back to using an OpenWebUI model instead of returning a default prompt. This provides better resilience when external API limits are exceeded while maintaining functionality through local models.
The changes include:
- Adding RateLimitError import from openai
- Implementing fallback logic in create_prompt_on_openrouter function
- Using OpenWebUI as secondary source for prompts when rate limiting occurs
- Proper error handling and logging for both primary and fallback scenarios
This change improves the robustness of prompt generation by ensuring that users receive generated content even when external services are temporarily unavailable due to rate limits. The fallback mechanism prioritizes configured local models if available, with a final default prompt as backup.
The implementation follows the existing pattern of using random selection from configured OpenWebUI models and includes comprehensive error handling for both primary and fallback operations. This ensures that all failure modes are gracefully handled while maintaining backward compatibility.
Refactor `get_available_models` to handle multiple models and improve error handling. Adjust `select_model` to support configurable workflows and fallbacks.
Add retry logic and fallback mechanism to prompt generation. When OpenWebUI
fails, the system now attempts a second try before falling back to OpenRouter.
Proper error handling and logging have been added throughout the prompt
generation flow to ensure more reliable operation.