mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:04:32 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -46,8 +46,12 @@ function listSetupTokenProfiles(store: {
|
||||
}): string[] {
|
||||
return Object.entries(store.profiles)
|
||||
.filter(([, cred]) => {
|
||||
if (cred.type !== "token") return false;
|
||||
if (normalizeProviderId(cred.provider) !== "anthropic") return false;
|
||||
if (cred.type !== "token") {
|
||||
return false;
|
||||
}
|
||||
if (normalizeProviderId(cred.provider) !== "anthropic") {
|
||||
return false;
|
||||
}
|
||||
return isSetupToken(cred.token);
|
||||
})
|
||||
.map(([id]) => id);
|
||||
@@ -56,7 +60,9 @@ function listSetupTokenProfiles(store: {
|
||||
function pickSetupTokenProfile(candidates: string[]): string {
|
||||
const preferred = ["anthropic:setup-token-test", "anthropic:setup-token", "anthropic:default"];
|
||||
for (const id of preferred) {
|
||||
if (candidates.includes(id)) return id;
|
||||
if (candidates.includes(id)) {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
return candidates[0] ?? "";
|
||||
}
|
||||
@@ -124,7 +130,9 @@ function pickModel(models: Array<Model<Api>>, raw?: string): Model<Api> | null {
|
||||
const normalized = raw?.trim() ?? "";
|
||||
if (normalized) {
|
||||
const parsed = parseModelRef(normalized, "anthropic");
|
||||
if (!parsed) return null;
|
||||
if (!parsed) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
models.find(
|
||||
(model) =>
|
||||
@@ -141,7 +149,9 @@ function pickModel(models: Array<Model<Api>>, raw?: string): Model<Api> | null {
|
||||
];
|
||||
for (const id of preferred) {
|
||||
const match = models.find((model) => model.id === id);
|
||||
if (match) return match;
|
||||
if (match) {
|
||||
return match;
|
||||
}
|
||||
}
|
||||
return models[0] ?? null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user