Skip to content

Conversation

@vvdbx
Copy link
Contributor

@vvdbx vvdbx commented Sep 11, 2025

Summary

Clean version of PR #1961

  • Honor the local-only AI policy setting (policies.ai === 2) by properly filtering models
  • Fix model selection persistence and reactivity issues
  • Ensure selected models remain valid when policy changes

Warning

I'm not a very talented programmer.
The majority of this PR was authored by Claude Code.
I've reviewed this code to the best of my human ability.
This change has been working for me for about a week.

Changes

  • Remove artificial model list emptying that broke the UI when local-only policy was enabled
  • Add filteredModelList property that filters to localhost endpoints when policy requires local-only
  • Fix currentModelId to be reactive to Persistent.states changes and validate against filtered list
  • Update setModel() function to validate against filtered model list instead of full list

Test plan

  • Test with policies.ai === 0 (no restrictions) - should show all models
  • Test with policies.ai === 2 (local only) - should show only localhost models
  • Test model selection persistence across app restarts
  • Test that invalid saved models fall back to first available filtered model
    -- Note: fallback doesn't occur until shell is restarted since the Ollama model list is cached at startup, see issue Installed Ollama models don’t load in Quickshell until manual reload #1803
  • Verify model switching works correctly in both policy modes

🤖 Generated with Claude Code

vvdbx and others added 2 commits September 11, 2025 17:17
- Remove artificial model list emptying when policies.ai === 2
- Add filteredModelList that properly filters to localhost endpoints for local-only policy
- Fix currentModelId to be reactive to Persistent.states changes
- Ensure selected model persists correctly and falls back to valid options
- Update setModel to use filteredModelList for validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
The chat interface was still using the unfiltered modelList for model
suggestions, bypassing the local-only policy filter.

- Update AiChat.qml to use Ai.filteredModelList instead of Ai.modelList
- Ensures model suggestions respect the policies.ai setting
- Local-only policy now properly hides online models from suggestions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@vvdbx
Copy link
Contributor Author

vvdbx commented Sep 12, 2025

identified a potentially serious issue in reactive updates, corrected in new commit (f029f85)

@vvdbx vvdbx marked this pull request as draft September 12, 2025 14:41
@vvdbx
Copy link
Contributor Author

vvdbx commented Sep 12, 2025

reverting to draft, experiencing some weird behavior after implenting fix in f029f85 that I need to look into

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant