refactor(agent): own model selection on each agent
This commit is contained in:
1 parent
639602e63a
commit
a9c006f9c3
237 files changed
+1051
-1734
No files matched your search
@@ -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)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ export class SessionCommandController {
|
||||
? {}
|
||||
: { reasoningEffort: resolved.reasoningEffort }),
|
||||
}
|
||||
this.ctx.agentModel.select(agent, selected)
|
||||
agent.model.select(selected)
|
||||
void this.ctx.agentDefaultModel.saveSelection(selected).catch((error: unknown) => {
|
||||
this.ctx.logger.warn(
|
||||
`session-controller: model selection changed for the Session but the default was not saved: ${String(error)}`,
|
||||
@@ -323,7 +323,7 @@ export class SessionCommandController {
|
||||
const admit = async (): Promise<SessionPromptValue> => {
|
||||
try {
|
||||
if (hasImage) {
|
||||
const current = this.ctx.agentModel.resolveForNextStep(agent)
|
||||
const current = agent.model.current()
|
||||
if (current !== undefined) {
|
||||
const model = await this.ctx.llm.resolveModelInfo(current.provider, current.model)
|
||||
if (model.inputModalities !== undefined && !model.inputModalities.includes('image')) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import { hostname } from 'node:os'
|
||||
import { resolve } from 'node:path'
|
||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||
import type {} from '@deepseek-ai/dsh-agent-model'
|
||||
import type {} from '@deepseek-ai/dsh-fs'
|
||||
import { Context, Service } from '@deepseek-ai/cordis'
|
||||
import z from '@deepseek-ai/schemastery'
|
||||
@@ -127,7 +126,6 @@ export class SessionController extends TypertRemoteService {
|
||||
'remoteAccess',
|
||||
'sessions',
|
||||
'sessionProjections',
|
||||
'agentModel',
|
||||
'sessionQuery',
|
||||
'typert',
|
||||
'workspaceRegistry',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/** Browser-safe request, result, and lifecycle vocabulary for the Session Remote service. */
|
||||
|
||||
import type {} from '@deepseek-ai/dsh-agent-model/types'
|
||||
import type {} from '@deepseek-ai/dsh-agent/types'
|
||||
import type { NativeFileApplication } from '@deepseek-ai/dsh-native-command/types'
|
||||
import type {
|
||||
AttachmentIdType, ImageAttachmentLimits, ImageAttachmentRef, ImageMediaType,
|
||||
|
||||
Reference in new issue
Block a user