Merge pull request #16600 from NousResearch/austin/fix/model-provider

fix(models): consolidate provider and model into /model command
This commit is contained in:
Austin Pickett
2026-04-27 08:14:27 -07:00
committed by GitHub
7 changed files with 92 additions and 34 deletions

View File

@@ -1,6 +1,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { createSlashHandler } from '../app/createSlashHandler.js'
import { TUI_SESSION_MODEL_FLAG } from '../domain/slash.js'
import { getOverlayState, resetOverlayState } from '../app/overlayStore.js'
import { getUiState, patchUiState, resetUiState } from '../app/uiStore.js'
@@ -43,6 +44,28 @@ describe('createSlashHandler', () => {
})
})
it('honors TUI picker session scope without adding --global', async () => {
patchUiState({ sid: 'sid-abc' })
const ctx = buildCtx({
gateway: {
...buildGateway(),
rpc: vi.fn(() => Promise.resolve({ value: 'anthropic/claude-sonnet-4.6' }))
}
})
expect(
createSlashHandler(ctx)(
`/model anthropic/claude-sonnet-4.6 --provider openrouter ${TUI_SESSION_MODEL_FLAG}`
)
).toBe(true)
expect(ctx.gateway.rpc).toHaveBeenCalledWith('config.set', {
key: 'model',
session_id: 'sid-abc',
value: 'anthropic/claude-sonnet-4.6 --provider openrouter'
})
})
it('does not duplicate --global for explicit persistent model switches', () => {
patchUiState({ sid: 'sid-abc' })
const ctx = buildCtx()