Skip to content

Conversation

@urmauur
Copy link
Member

@urmauur urmauur commented Aug 19, 2025

Describe Your Changes

This pull request refactors the model selection logic in the DropdownModelProvider component to improve reliability and maintainability. The main change is the introduction of a helper function to verify model existence, which simplifies and centralizes the logic for checking if a selected or last-used model is available. Additionally, the default model selection behavior has been adjusted to avoid hardcoded fallbacks.

Model selection logic improvements:

  • Added a checkModelExists helper function to centralize and simplify the verification of model existence within active providers.
  • Updated the initialization logic to use checkModelExists for both the current model and the last-used model, ensuring only valid models are selected and falling back to an empty selection if not found.
  • Removed hardcoded default model selection (llamacpp, llama3.2:3b) in favor of a more flexible fallback to an empty selection when no valid model is available.

Code style and formatting:

  • Minor formatting adjustments for readability in the provider filtering logic, without changing behavior.

Fixes Issues

Screen.Recording.2025-08-19.at.14.43.10.mp4

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Refactor DropdownModelProvider.tsx to improve model selection logic by centralizing model existence checks and removing hardcoded defaults.

  • Model Selection Logic:
    • Introduce checkModelExists in DropdownModelProvider.tsx to centralize model existence checks.
    • Update initialization to use checkModelExists for current and last-used models, defaulting to empty selection if invalid.
    • Remove hardcoded defaults (llamacpp, llama3.2:3b), using empty selection as fallback.
  • Code Style:
    • Minor formatting changes for readability in provider filtering logic.

This description was created by Ellipsis for cedf42d. You can customize this summary. It will automatically update as commits are pushed.

@urmauur urmauur added this to the v0.6.9 milestone Aug 19, 2025
@urmauur urmauur self-assigned this Aug 19, 2025
@urmauur urmauur added this to Jan Aug 19, 2025
@urmauur urmauur moved this to Needs Review in Jan Aug 19, 2025
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to cedf42d in 1 minute and 23 seconds. Click for details.
  • Reviewed 78 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. web-app/src/containers/DropdownModelProvider.tsx:81
  • Draft comment:
    The new helper function 'checkModelExists' centralizes the model existence check. Consider renaming it (e.g. to 'modelExists') or having it return a boolean to more clearly represent its intended use.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. web-app/src/containers/DropdownModelProvider.tsx:92
  • Draft comment:
    In the useEffect for initializing the model, the code first calls 'selectModelProvider' with the provided model and then checks its existence to potentially reset the selection. This leads to two consecutive calls. Consider checking the model’s validity before calling 'selectModelProvider' to avoid unnecessary updates.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. web-app/src/containers/DropdownModelProvider.tsx:98
  • Draft comment:
    For the 'useLastUsedModel' branch, the fallback has been changed from hardcoded values to an empty selection. Ensure that this empty selection aligns with the intended default behavior for new chats when the last-used model is invalid.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. web-app/src/containers/DropdownModelProvider.tsx:158
  • Draft comment:
    The formatting change in the provider filtering condition improves readability by splitting the conditions across lines. This is stylistically sound; no functional issues detected.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_Tqz0QOb5Rvk9zKN4

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@github-actions
Copy link
Contributor

Copy link
Contributor

@dinhlongviolin1 dinhlongviolin1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@urmauur urmauur merged commit f26d78d into dev Aug 19, 2025
17 checks passed
@urmauur urmauur deleted the fix/hide-model-provider-disabled branch August 19, 2025 09:33
@github-project-automation github-project-automation bot moved this from Needs Review to QA in Jan Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

bug: Disable provider still show up as option in old thread

4 participants