mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:51:24 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -23,7 +23,9 @@ export async function modelsFallbacksListCommand(
|
||||
return;
|
||||
}
|
||||
if (opts.plain) {
|
||||
for (const entry of fallbacks) runtime.log(entry);
|
||||
for (const entry of fallbacks) {
|
||||
runtime.log(entry);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -32,7 +34,9 @@ export async function modelsFallbacksListCommand(
|
||||
runtime.log("- none");
|
||||
return;
|
||||
}
|
||||
for (const entry of fallbacks) runtime.log(`- ${entry}`);
|
||||
for (const entry of fallbacks) {
|
||||
runtime.log(`- ${entry}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function modelsFallbacksAddCommand(modelRaw: string, runtime: RuntimeEnv) {
|
||||
@@ -40,7 +44,9 @@ export async function modelsFallbacksAddCommand(modelRaw: string, runtime: Runti
|
||||
const resolved = resolveModelTarget({ raw: modelRaw, cfg });
|
||||
const targetKey = modelKey(resolved.provider, resolved.model);
|
||||
const nextModels = { ...cfg.agents?.defaults?.models };
|
||||
if (!nextModels[targetKey]) nextModels[targetKey] = {};
|
||||
if (!nextModels[targetKey]) {
|
||||
nextModels[targetKey] = {};
|
||||
}
|
||||
const aliasIndex = buildModelAliasIndex({
|
||||
cfg,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
@@ -57,7 +63,9 @@ export async function modelsFallbacksAddCommand(modelRaw: string, runtime: Runti
|
||||
.filter((entry): entry is NonNullable<typeof entry> => Boolean(entry))
|
||||
.map((entry) => modelKey(entry.ref.provider, entry.ref.model));
|
||||
|
||||
if (existingKeys.includes(targetKey)) return cfg;
|
||||
if (existingKeys.includes(targetKey)) {
|
||||
return cfg;
|
||||
}
|
||||
|
||||
const existingModel = cfg.agents?.defaults?.model as
|
||||
| { primary?: string; fallbacks?: string[] }
|
||||
@@ -98,7 +106,9 @@ export async function modelsFallbacksRemoveCommand(modelRaw: string, runtime: Ru
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
aliasIndex,
|
||||
});
|
||||
if (!resolvedEntry) return true;
|
||||
if (!resolvedEntry) {
|
||||
return true;
|
||||
}
|
||||
return modelKey(resolvedEntry.ref.provider, resolvedEntry.ref.model) !== targetKey;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user