fix: allow setting model type when adding custom models, preserve on restart#284
Open
octo-patch wants to merge 2 commits into
Open
fix: allow setting model type when adding custom models, preserve on restart#284octo-patch wants to merge 2 commits into
octo-patch wants to merge 2 commits into
Conversation
When the Jaaz API is blocked by Cloudflare or other intermediaries, the OpenAI SDK raises a PermissionDeniedError whose string contains the full HTML page. This gets forwarded to the frontend, showing users raw HTML markup instead of a helpful error message. - In _handle_error: detect HTML responses (starting with '<') and replace with a clear, actionable message; truncate strings over 1000 chars - In StreamProcessor.process_stream: remove the redundant 'done' event since chat_service.py already sends it in the finally block Fixes 11cafe#258
…ge/video types on restart When adding a new model via the settings dialog, the model type was hardcoded to 'text', making it impossible to configure image or video models for custom providers (e.g. OpenRouter). Additionally, if a user edited config.toml directly to set model type to 'image' or 'video' for a custom provider, those models were silently dropped on app restart because config_service.initialize() only preserved text-type models for all providers. - Add a Model Type selector (text/image/video) to the Add Model dialog in AddModelsList, defaulting to 'text' to preserve existing behavior - Fix config_service.initialize() to preserve all model types for custom providers (not in DEFAULT_PROVIDERS_CONFIG); built-in provider behavior is unchanged - Use dict() copy when reading DEFAULT_PROVIDERS_CONFIG models to avoid mutating the module-level default on each initialization Fixes 11cafe#271 Co-Authored-By: Octopus <liyuan851277048@icloud.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #271
Problem
When users add a new model via the settings dialog, the model type is hardcoded to
text, making it impossible to configure image or video models for custom providers (such as OpenRouter). Additionally, if a user manually editedconfig.tomlto set a model's type toimageorvideofor a custom provider, those models were silently dropped on app restart becauseconfig_service.initialize()only preservedtext-type user-added models for all providers.Solution
Frontend (
AddModelsList.tsx)textto preserve existing behavior for LLM models.Backend (
config_service.py)initialize(), distinguish between built-in providers (inDEFAULT_PROVIDERS_CONFIG) and custom providers (e.g. OpenRouter, any user-added provider).textmodels are preserved (image/video are hardcoded per-provider).dict()copy when readingDEFAULT_PROVIDERS_CONFIGmodels to avoid mutating the module-level default on repeatedinitialize()calls.Testing
textor disappear entirely on restart