refactor(agent): own model selection on each agent

This commit is contained in:
_Kerman committed 2026-10-20 21:09:09 +08:00
1 parent 639602e63a
commit a9c006f9c3
237 files changed
+1051 -1734

No files matched your search

+3 -3
View File
@@ -5,7 +5,7 @@ import { mkdir } from 'node:fs/promises'
import type { Context } from '@deepseek-ai/cordis'
import type { Agent, AgentOptions, AgentSetup } from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-agent-default-model'
import * as ModelSwitchNotice from '@deepseek-ai/dsh-agent-model/notice'
import { installModelSelection } from '@deepseek-ai/dsh-agent'
import type {} from '@deepseek-ai/dsh-agent-preset-registry'
import { brandString } from '@deepseek-ai/dsh-brand'
import type { Session, SessionId } from '@deepseek-ai/dsh-session'
@@ -306,13 +306,13 @@ export class ApiSessionAgentController {
async composeAgent(presetId: string | undefined): Promise<ApiSessionComposition> {
const presets = this.ctx.get('agentPresets')
if (presets === undefined) {
return { setup: async (agentCtx) => { await agentCtx.plugin(ModelSwitchNotice) } }
return { setup: (agentCtx) => { installModelSelection(agentCtx) } }
}
const resolvedId = (await presets.resolve(presetId)).id
return {
agentPreset: resolvedId,
setup: async (agentCtx) => {
await agentCtx.plugin(ModelSwitchNotice)
installModelSelection(agentCtx)
await presets.mount(agentCtx, resolvedId)
},
}