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
@@ -4926,25 +4926,32 @@ async function discordAgentApplyModel(ctx, modelId) {
const id = String(modelId || '').trim()
if (!id) throw new Error('model id required')
const cfg = (await discordAgentLoadConfig(ctx)) || {}
const backend = discordAgentBackend(cfg)
if (backend === 'qvac') {
cfg.backend = 'qvac'
cfg.provider = 'qvac'
cfg.qvac_model = id
cfg.model = id
const hit = discordQvacModelForProfile('')
for (let i = 0; i < BARE_OS_DISCORD_QVAC_MODELS.length; i++) {
if (BARE_OS_DISCORD_QVAC_MODELS[i].id === id && BARE_OS_DISCORD_QVAC_MODELS[i].profile) {
cfg.qvac_profile = BARE_OS_DISCORD_QVAC_MODELS[i].profile
break
}
}
void hit
} else {
cfg.backend = 'rest'
cfg.model = id
}
const clean = discordSanitizeAgentConfig(cfg)
const next =
typeof bareAgentApplyLiveModel === 'function'
? bareAgentApplyLiveModel(cfg, id)
: (function () {
const backend = discordAgentBackend(cfg)
if (backend === 'qvac') {
cfg.backend = 'qvac'
cfg.provider = 'qvac'
cfg.qvac_model = id
cfg.model = id
for (let i = 0; i < BARE_OS_DISCORD_QVAC_MODELS.length; i++) {
if (
BARE_OS_DISCORD_QVAC_MODELS[i].id === id &&
BARE_OS_DISCORD_QVAC_MODELS[i].profile
) {
cfg.qvac_profile = BARE_OS_DISCORD_QVAC_MODELS[i].profile
break
}
}
} else {
cfg.backend = 'rest'
cfg.model = id
}
return cfg
})()
const clean = discordSanitizeAgentConfig(next)
await discordWriteJsonFile(ctx, '~/.agent/config.json', clean)
return clean
}
@@ -5534,6 +5541,7 @@ async function discordAgentAsk(ctx, interaction, prompt, flags) {
const modelOverride = flags && flags.model ? String(flags.model).trim() : ''
const cfg = await discordAgentLoadConfig(ctx)
const ready = discordAgentReady(ctx, cfg)
const usedModel = modelOverride || ready.model
if (!ready.ok) {
return discordAgentHud(ctx, interaction, ready.reason)
}
@@ -5582,7 +5590,7 @@ async function discordAgentAsk(ctx, interaction, prompt, flags) {
const proc = discordAgentFormatProcess(parsed, 8)
const fields = [
discordField('Status', rec.stop ? 'stopping' : '**working**', true),
discordField('Backend', ready.backend + ' · `' + (ready.model || 'model') + '`', true),
discordField('Backend', ready.backend + ' · `' + (usedModel || 'model') + '`', true),
discordField('Elapsed', String(elapsed) + 's', true),
discordField(
'Current',
@@ -5656,7 +5664,7 @@ async function discordAgentAsk(ctx, interaction, prompt, flags) {
const elapsed = Math.round((Date.now() - rec.started) / 1000)
const proc = discordAgentFormatProcess(parsed, 10)
const leadParts = [
'**' + ready.backend + '** · `' + (ready.model || 'model') + '` · ' + elapsed + 's',
'**' + ready.backend + '** · `' + (usedModel || 'model') + '` · ' + elapsed + 's',
'_' + task.slice(0, 240) + '_'
]
if (proc) leadParts.push('', proc, '')