Skip to content

feat(model-database): copy or switch model on Enter (#1310) - #1356

Merged
akramcodez merged 2 commits into
Nano-Collective:mainfrom
rohanshrma222:modeldatabase
Sep 22, 2026
Merged

akramcodez merged 2 commits into
Nano-Collective:mainfrom
rohanshrma222:modeldatabase

Conversation

@rohanshrma222

Copy link
Copy Markdown
Contributor

Description

Pressing Enter on a highlighted model in /model-database now does something useful instead of just closing the panel: it copies the model's ID to the clipboard, and if the active provider is OpenRouter, it also switches the session to that model immediately (reusing the same handleModelSelect path as /model, including its confirmation toast). The footer hint updates to show Copy & Switch vs Copy ID depending on context. Closes #1310.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Tested MCP integration (if applicable)

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md (../CONTRIBUTING.md#logging))

@github-actions

Copy link
Copy Markdown
Contributor

nc-review: comments — 1 nit

@rohanshrma222 — a few things worth a look, none blocking.

The PR wires Enter on a highlighted model in /model-database to either copy the model ID or copy+switch (when on OpenRouter), reusing isOpenRouterProvider, the existing onModelSelect handler, and clipboardy the same way other commands do. The author correctly passes through the configured provider casing so handleModelSelect's strict-equality sameProvider check still triggers the same-provider branch. Tests cover the empty-list, default-copy, non-OpenRouter-copy, OpenRouter-switch, casing-pass-through, and both footer-hint paths, using the same clipboardy stub pattern as copy.spec.tsx. One small fidelity gap: issue #1310 explicitly asks for a Copied model ID to clipboard: <id> confirmation toast, but the OpenRouter-switch branch suppresses that toast and only emits handleModelSelect's Model changed to: ....

⚪ nit · completeness · source/commands/model-database.tsx:118

Issue #1310 lists Display a confirmation toast/notification: Copied model ID to clipboard: <id> as a separate requirement from the OpenRouter auto-switch. The else-branch (non-OpenRouter / no onModelSelect) queues this toast via addToMessageQueue(successMsg(...)), but the OpenRouter branch deliberately skips it — the user pressing Enter on OpenRouter only ever sees handleModelSelect's Model changed to: <model> toast, with no explicit confirmation that the ID was also copied. A second addToMessageQueue(successMsg(\Copied model ID to clipboard: ${model.id}`, 'model-database-copy'))in theswitchProviderbranch (after the existingclipboard.write(model.id).catch(reportClipboardError)) would make the copy action explicit on both paths and match the issue text more literally. Worth doing but not blocking — the footer hint already says Copy & Switch`.


🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional

Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with /re-review.

@github-actions github-actions Bot added the agent:comments nc-review left non-blocking findings label Sep 16, 2026
@akramcodez
akramcodez merged commit 8c87ead into Nano-Collective:main Sep 22, 2026
16 checks passed
@akramcodez

Copy link
Copy Markdown
Member

Thanks for the PR @rohanshrma222

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

Labels

agent:comments nc-review left non-blocking findings area:tui Terminal UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Copy or apply selected model directly from /model-database on Enter

2 participants