feat: assorted small changes (#244)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Kian Jones
2025-12-16 17:20:31 -05:00
committed by GitHub
parent 562246d022
commit 322ab19f11
2 changed files with 35 additions and 13 deletions

View File

@@ -259,17 +259,25 @@ export async function handleHeadlessCommand(
// If resuming and a model or system prompt was specified, apply those changes
if (isResumingAgent && (model || specifiedSystem)) {
if (model) {
const { updateAgentLLMConfig } = await import("./agent/modify");
const { resolveModel } = await import("./agent/model");
const modelHandle = resolveModel(model);
if (!modelHandle) {
console.error(`Error: Invalid model "${model}"`);
process.exit(1);
}
const updateArgs = getModelUpdateArgs(model);
await updateAgentLLMConfig(agent.id, modelHandle, updateArgs);
// Refresh agent state after model update
agent = await client.agents.retrieve(agent.id);
// Optimization: Skip update if agent is already using the specified model
const currentModel = agent.llm_config?.model;
const currentEndpointType = agent.llm_config?.model_endpoint_type;
const currentHandle = `${currentEndpointType}/${currentModel}`;
if (currentHandle !== modelHandle) {
const { updateAgentLLMConfig } = await import("./agent/modify");
const updateArgs = getModelUpdateArgs(model);
await updateAgentLLMConfig(agent.id, modelHandle, updateArgs);
// Refresh agent state after model update
agent = await client.agents.retrieve(agent.id);
}
}
if (specifiedSystem) {