Update Model Selection
Release rolling / release (push) Successful in 15m21s

This commit is contained in:
2026-08-18 18:59:14 -04:00
parent db6dfa22e3
commit 4eb767d65e
12 changed files with 312 additions and 39 deletions
@@ -0,0 +1,74 @@
import test from 'brittle'
import { readFileSync } from 'node:fs'
import vm from 'node:vm'
const QVAC_SRC = readFileSync(new URL('../lib/agent/agent-qvac.js', import.meta.url), 'utf8')
const MODELS_SRC = readFileSync(
new URL('../lib/agent/agent-models.js', import.meta.url),
'utf8'
)
const TUI_SRC = readFileSync(new URL('../lib/agent/agent-tui.js', import.meta.url), 'utf8')
function load() {
const sandbox = { console }
vm.createContext(sandbox)
vm.runInContext(
QVAC_SRC +
'\n' +
MODELS_SRC +
'\n' +
TUI_SRC +
'\n;this.__exports = { bareAgentHonorExplicitQvacModel, bareAgentApplyLiveModel, bareAgentApplyProviderProfile, bareAgentQvacGetProfile, bareAgentQvacFindChatModel }',
sandbox
)
return sandbox.__exports
}
test('explicit QVAC model survives profile apply (live Discord/CLI switch)', async (t) => {
const { bareAgentApplyProviderProfile } = load()
const next = bareAgentApplyProviderProfile({
backend: 'qvac',
qvac_profile: 'recommended',
qvac_model: 'QWEN3_8B_INST_Q4_K_M',
model: 'QWEN3_8B_INST_Q4_K_M'
})
t.is(next.qvac_model, 'QWEN3_8B_INST_Q4_K_M')
t.is(next.model, 'QWEN3_8B_INST_Q4_K_M')
})
test('empty QVAC model fills from profile', async (t) => {
const { bareAgentApplyProviderProfile, bareAgentQvacGetProfile } = load()
const next = bareAgentApplyProviderProfile({
backend: 'qvac',
qvac_profile: 'strong'
})
t.is(next.qvac_model, bareAgentQvacGetProfile('strong').chatModel)
})
test('apply live model on QVAC sets both keys and profile when catalog-known', async (t) => {
const { bareAgentApplyLiveModel } = load()
const next = bareAgentApplyLiveModel(
{ backend: 'qvac', qvac_profile: 'recommended', qvac_model: 'QWEN3_1_7B_INST_Q4' },
'QWEN3_600M_INST_Q4'
)
t.is(next.qvac_model, 'QWEN3_600M_INST_Q4')
t.is(next.model, 'QWEN3_600M_INST_Q4')
t.is(next.qvac_profile, 'lite')
})
test('apply live model on REST only changes model', async (t) => {
const { bareAgentApplyLiveModel } = load()
const next = bareAgentApplyLiveModel(
{
backend: 'rest',
provider: 'groq',
rest_api_key: 'gsk',
rest_base_url: 'https://api.groq.com/openai/v1',
model: 'old'
},
'llama-3.1-8b-instant'
)
t.is(next.backend, 'rest')
t.is(next.model, 'llama-3.1-8b-instant')
t.absent(next.qvac_model)
})