Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Apply the team default model to creates that name none

klarkxy90117de6ff33
diff --git a/ds-bot/src/host/models.js b/ds-bot/src/host/models.js
index e217288d..dacd0366 100644
--- a/ds-bot/src/host/models.js
+++ b/ds-bot/src/host/models.js
@@ -99,6 +99,15 @@ export function install(rt) {
}
const defaultModel = async () => pickDefault(await catalog())
+ // The model a create that names none starts on: the team's pick while the catalog
+ // still serves it, else the DSH default. A create fixes the ref then, so a later
+ // change of either default leaves the Bot alone.
+ const defaultBotModel = async () => {
+ const entries = await catalog()
+ const preferred = state.prefs.defaultBotModel
+ return entries.some(entry => entry.ref === preferred) ? preferred : pickDefault(entries)
+ }
+
// A full `provider/model` ref, or a model id or name that only one provider serves.
async function resolveModel(text) {
const entries = await catalog({ fresh: true })
@@ -262,7 +271,7 @@ export function install(rt) {
Object.assign(rt, {
catalog, cachedCatalog: () => answerable(catalogCache.value), cachedDefault: () => pickDefault(catalogCache.value),
- defaultRef, defaultModel, defaultEffort, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,
+ defaultRef, defaultModel, defaultBotModel, defaultEffort, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,
selectSessionModel, applyModel, waitForModel, syncModels, routeRefused,
dropCatalog: () => { catalogCache = { at: 0, value: [] } },
})
diff --git a/ds-bot/src/host/roster.js b/ds-bot/src/host/roster.js
index 0aa22ea1..72796570 100644
--- a/ds-bot/src/host/roster.js
+++ b/ds-bot/src/host/roster.js
@@ -142,7 +142,7 @@ export function install(rt) {
async function buildBot(cleanName, { role = '', instructions = '', color, brief = '', createdBy, main = false, avatar, model, effort, workDir, copyOf, pickModel = false }) {
const cleanAvatarValue = cleanAvatar(avatar)
// The model is fixed at creation, so a later change of the DSH default leaves it alone.
- const modelRef = model ? await rt.resolveModel(model) : pickModel ? undefined : await rt.defaultModel()
+ const modelRef = model ? await rt.resolveModel(model) : pickModel ? undefined : await rt.defaultBotModel()
// A thinking level needs a model to resolve against; with none it would be dropped
// silently, so the create fails before a Session is made.
if (effort && modelRef === undefined) throw new Error('Pick a model before choosing a thinking level')
diff --git a/ds-bot/test/roster.test.js b/ds-bot/test/roster.test.js
index 2672f2f6..d15014c1 100644
--- a/ds-bot/test/roster.test.js
+++ b/ds-bot/test/roster.test.js
@@ -1049,3 +1049,27 @@ test('set-prefs stores a served default model, clears it, and refuses an unknown
assert.equal('defaultBotModel' in (await call('set-prefs', { defaultBotModel: null })).value, false)
assert.equal('defaultBotModel' in rt.state.prefs, false)
})
+
+test('a model-less create-bot starts the Bot on the saved team default model', async (t) => {
+ const { call, stop } = start(TEAM_MODEL, { models: ['deepseek-v4-flash', 'deepseek-v4-pro'] })
+ t.after(stop)
+ await call('set-prefs', { defaultBotModel: 'deepseek/deepseek-v4-pro' })
+
+ // The HTTP create names no model: the team's saved pick applies, not the DSH default.
+ const defaulted = (await call('create-bot', { name: 'Defaulted' })).value
+ assert.equal(defaulted.model, 'deepseek/deepseek-v4-pro')
+
+ // An explicit model still wins over the team default.
+ const named = (await call('create-bot', { name: 'Named', model: 'deepseek/deepseek-v4-flash' })).value
+ assert.equal(named.model, 'deepseek/deepseek-v4-flash')
+
+ // A saved pick the catalog no longer serves falls back to the DSH default…
+ rt.state.prefs.defaultBotModel = 'gone/model'
+ const stale = (await call('create-bot', { name: 'Stale' })).value
+ assert.equal(stale.model, 'deepseek/deepseek-v4-flash')
+
+ // …and so does a create once the pick is cleared.
+ await call('set-prefs', { defaultBotModel: null })
+ const plain = (await call('create-bot', { name: 'Plain' })).value
+ assert.equal(plain.model, 'deepseek/deepseek-v4-flash')
+})