feat(deskclaw): rebrand + vibe presets + chat model picker
This commit is contained in:
@@ -681,6 +681,31 @@ export async function updateAgentModel(agentId: string, modelRef: string | null)
|
||||
});
|
||||
}
|
||||
|
||||
export async function updateDefaultModel(modelRef: string | null): Promise<AgentsSnapshot> {
|
||||
return withConfigLock(async () => {
|
||||
const config = await readOpenClawConfig() as AgentConfigDocument;
|
||||
const { agentsConfig } = normalizeAgentsConfig(config);
|
||||
const normalizedModelRef = typeof modelRef === 'string' ? modelRef.trim() : '';
|
||||
const nextAgentsConfig: AgentsConfig = { ...(agentsConfig || {}) };
|
||||
const nextDefaults: AgentDefaultsConfig = { ...(nextAgentsConfig.defaults || {}) };
|
||||
|
||||
if (!normalizedModelRef) {
|
||||
delete nextDefaults.model;
|
||||
} else {
|
||||
if (!isValidModelRef(normalizedModelRef)) {
|
||||
throw new Error('modelRef must be in "provider/model" format');
|
||||
}
|
||||
nextDefaults.model = { primary: normalizedModelRef };
|
||||
}
|
||||
|
||||
nextAgentsConfig.defaults = nextDefaults;
|
||||
config.agents = nextAgentsConfig;
|
||||
await writeOpenClawConfig(config);
|
||||
logger.info('Updated default model', { modelRef: normalizedModelRef || null });
|
||||
return buildSnapshotFromConfig(config);
|
||||
});
|
||||
}
|
||||
|
||||
export async function deleteAgentConfig(agentId: string): Promise<{ snapshot: AgentsSnapshot; removedEntry: AgentListEntry }> {
|
||||
return withConfigLock(async () => {
|
||||
if (agentId === MAIN_AGENT_ID) {
|
||||
|
||||
Reference in New Issue
Block a user