wip: use the first found apply model for subagent
This commit is contained in:
parent
bcdf0120b1
commit
85eb24913c
2 changed files with 26 additions and 2 deletions
|
|
@ -305,4 +305,28 @@ export class ModelService
|
|||
return nameMatches;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a subagent model
|
||||
*/
|
||||
getSubagentModel(): ModelServiceState | null {
|
||||
const state = this.getState();
|
||||
if (!state.assistant) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const subagentModel = state.assistant.models?.find((model) =>
|
||||
model?.roles?.includes("apply"),
|
||||
);
|
||||
if (!subagentModel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
llmApi: createLlmApi(subagentModel, state.authConfig),
|
||||
model: subagentModel,
|
||||
assistant: state.assistant,
|
||||
authConfig: state.authConfig,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ export async function executeSubAgent(
|
|||
const { services } = await import("../services/index.js");
|
||||
|
||||
// Get model and LLM API from model service
|
||||
const modelState = services.model.getState();
|
||||
const { model, llmApi } = modelState;
|
||||
const modelState = services.model.getSubagentModel();
|
||||
const { model, llmApi } = modelState ?? {};
|
||||
|
||||
if (!model || !llmApi) {
|
||||
throw new Error("Model or LLM API not available");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue