8 Commits

Author SHA1 Message Date
86efefb490 refactor(libs): update imports to use extracted build_user_content 2025-10-31 21:54:21 +00:00
6172fb4f73 refactor(libs): extract build_user_content function to avoid duplication
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.
2025-10-31 16:08:12 +00:00
d8b8f14ba4 up wored to 20 2025-10-31 15:20:06 +00:00
e8ec30fc73 Secondary topic and config updates 2025-10-31 15:14:19 +00:00
bb4adbff2c feat(openrouter): add support for listing and using free OpenRouter models
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.
2025-10-30 17:15:59 +00:00
f15c83ebaa feat: add Qwen workflow support and enhance model validation
- 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
2025-10-30 16:38:52 +00:00
a63668cc93 No markdown formatting, no extra text.
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.
2025-09-04 08:58:24 +01:00
76e33ea523 initial openrouter support 2025-07-29 11:51:29 +01:00