Skip to content

feat(models): add /model manager#83

Merged
remarkablemark merged 20 commits into
masterfrom
feat/models
May 17, 2026
Merged

feat(models): add /model manager#83
remarkablemark merged 20 commits into
masterfrom
feat/models

Conversation

@remarkablemark

@remarkablemark remarkablemark commented May 17, 2026

Copy link
Copy Markdown
Member

What is the motivation for this pull request?

Add a /model command that opens a model manager TUI, allowing users to switch, download, and delete Ollama models from within the chat interface.

What is the current behavior?

There is no way to manage models from within the CLI. Users must run separate ollama commands outside the tool.

What is the new behavior?

  • /model opens a ModelManager component with three views:
    • Switch – select an installed model to use
    • Download – pull a new model by name (with suggestions)
    • Delete – remove an installed model
  • Current model is always indicated in the switcher
  • Installed models are filtered out of the download suggestions
  • Current model is excluded from the delete options

plan.md

What is the test strategy?

Download and delete model:

smollm:135m

Checklist:

Summary:

- Turn `/model` into a model-management flow instead of a simple switcher.
- Support three actions: switch installed models, download models, and delete installed models.
- Keep navigation explicit with parent/sub-screens, `Back`, and keyboard shortcuts.

Implemented Behavior:

- Parent menu:
  - `Switch model`
  - `Download model`
  - `Delete model`
  - `Cancel`
- Switch flow:
  - List installed models from Ollama.
  - Keep the current model first.
  - Selecting a model updates config/session and returns to chat.
- Download flow:
  - Show curated local model options plus `Enter custom model…`.
  - Support typed custom entry with inline suggestions.
  - Suggestion rows render raw model ids only, for example `gemma4:latest`.
  - Start downloads with Ollama pull streaming.
  - Show status text, numeric progress, and a progress bar when total/completed data is available.
  - `Esc` or `Ctrl+C` cancels an active download.
  - Show explicit `Cancel download` while pulling.
  - Do not auto-switch after download completes.
- Delete flow:
  - List installed models.
  - Block deleting the active model.
  - Require a confirmation step before deletion.

Shared Components:

- Reuse `Suggestions` component for keyboard navigation and selection in:
  - model suggestions

Curated Model List:

- Keep the curated list local in `src/constants/models.ts`.
- Current curated entries are:
  - `gemma4:latest`
  - `granite4.1:8b`
  - `qwen2.5-coder:latest`
  - `deepseek-coder-v2:latest`
- Order models by recommendation rather than alphabetically.

Verification:

- Manual test modal `smollm:135m`
- Remove optional includeCurrentModelNote parameter
- Always append (current model) to current model label
- Remove defaultValue from SelectPrompt in ModelSwitchView
- src/components/ModelManager/utils.ts
    - buildDownloadOptions(installedModels) now filters curated entries when
      installedModels contains the entry’s exact value or exact alias.
- src/components/ModelManager/ModelDownloadView.tsx
    - now accepts installedModels and passes them into buildDownloadOptions(...).
- src/components/ModelManager/ModelManager.tsx
    - now passes installedModels into ModelDownloadView.
Error:

```
Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn't have a dependency array, or one of the dependencies changes on every render.
```

Fixed in `src/components/ModelManager/ModelDeleteView.tsx` by removing
the current model from the delete Select entirely.

The delete screen now shows it as informational text and only renders
actually deletable models as options.

That avoids the update loop you were hitting when the active model
stayed in the selectable list.
@remarkablemark remarkablemark changed the title feat(models): add /model manager feat(models): add /model manager May 17, 2026
@remarkablemark remarkablemark self-assigned this May 17, 2026
@remarkablemark remarkablemark added the enhancement New feature or request label May 17, 2026
@remarkablemark remarkablemark force-pushed the feat/models branch 2 times, most recently from ab331ab to 681ca95 Compare May 17, 2026 19:14
@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/components/App/App.tsx 100.00% <100.00%> (ø)
src/components/App/constants.ts 100.00% <100.00%> (ø)
src/components/App/hooks/useScreenRouter.ts 100.00% <100.00%> (ø)
src/components/App/hooks/useSessionManager.ts 100.00% <ø> (ø)
src/components/App/hooks/useThemeSettings.ts 100.00% <ø> (ø)
src/components/Header.tsx 100.00% <ø> (ø)
...omponents/ModelManager/ModelCustomDownloadView.tsx 100.00% <100.00%> (ø)
...components/ModelManager/ModelDeleteConfirmView.tsx 100.00% <100.00%> (ø)
src/components/ModelManager/ModelDeleteView.tsx 100.00% <100.00%> (ø)
src/components/ModelManager/ModelDownloadView.tsx 100.00% <100.00%> (ø)
... and 12 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@remarkablemark remarkablemark force-pushed the feat/models branch 6 times, most recently from c1bea24 to badb110 Compare May 17, 2026 19:27
@remarkablemark remarkablemark force-pushed the feat/models branch 9 times, most recently from ede2377 to ebf338a Compare May 17, 2026 20:52
@remarkablemark remarkablemark enabled auto-merge May 17, 2026 21:07
@remarkablemark remarkablemark merged commit 3206086 into master May 17, 2026
16 checks passed
@remarkablemark remarkablemark deleted the feat/models branch May 17, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant