mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 06:41:22 +00:00
chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.
This commit is contained in:
@@ -64,7 +64,7 @@ export async function modelsListCommand(
|
||||
};
|
||||
|
||||
if (opts.all) {
|
||||
const sorted = [...models].sort((a, b) => {
|
||||
const sorted = [...models].toSorted((a, b) => {
|
||||
const p = a.provider.localeCompare(b.provider);
|
||||
if (p !== 0) return p;
|
||||
return a.id.localeCompare(b.id);
|
||||
|
||||
@@ -445,7 +445,7 @@ export function groupProbeResults(results: AuthProbeResult[]): Map<string, AuthP
|
||||
}
|
||||
|
||||
export function sortProbeResults(results: AuthProbeResult[]): AuthProbeResult[] {
|
||||
return results.slice().sort((a, b) => {
|
||||
return results.slice().toSorted((a, b) => {
|
||||
const provider = a.provider.localeCompare(b.provider);
|
||||
if (provider !== 0) return provider;
|
||||
const aLabel = a.label || a.profileId || "";
|
||||
|
||||
@@ -43,8 +43,8 @@ export async function loadModelRegistry(cfg: OpenClawConfig) {
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const registry = discoverModels(authStorage, agentDir);
|
||||
const models = registry.getAll() as Model<Api>[];
|
||||
const availableModels = registry.getAvailable() as Model<Api>[];
|
||||
const models = registry.getAll();
|
||||
const availableModels = registry.getAvailable();
|
||||
const availableKeys = new Set(availableModels.map((model) => modelKey(model.provider, model.id)));
|
||||
return { registry, models, availableKeys };
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export async function modelsStatusCommand(
|
||||
)
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean)
|
||||
.sort((a, b) => a.localeCompare(b));
|
||||
.toSorted((a, b) => a.localeCompare(b));
|
||||
|
||||
const applied = getShellEnvAppliedKeys();
|
||||
const shellFallbackEnabled =
|
||||
@@ -185,7 +185,7 @@ export async function modelsStatusCommand(
|
||||
const providerAuthMap = new Map(providerAuth.map((entry) => [entry.provider, entry]));
|
||||
const missingProvidersInUse = Array.from(providersInUse)
|
||||
.filter((provider) => !providerAuthMap.has(provider))
|
||||
.sort((a, b) => a.localeCompare(b));
|
||||
.toSorted((a, b) => a.localeCompare(b));
|
||||
|
||||
const probeProfileIds = (() => {
|
||||
if (!opts.probeProfile) return [];
|
||||
@@ -298,7 +298,7 @@ export async function modelsStatusCommand(
|
||||
remainingMs: unusableUntil - now,
|
||||
});
|
||||
}
|
||||
return out.sort((a, b) => a.remainingMs - b.remainingMs);
|
||||
return out.toSorted((a, b) => a.remainingMs - b.remainingMs);
|
||||
})();
|
||||
|
||||
const checkStatus = (() => {
|
||||
|
||||
@@ -33,7 +33,7 @@ const truncate = (value: string, max: number) => {
|
||||
};
|
||||
|
||||
function sortScanResults(results: ModelScanResult[]): ModelScanResult[] {
|
||||
return results.slice().sort((a, b) => {
|
||||
return results.slice().toSorted((a, b) => {
|
||||
const aImage = a.image.ok ? 1 : 0;
|
||||
const bImage = b.image.ok ? 1 : 0;
|
||||
if (aImage !== bImage) return bImage - aImage;
|
||||
@@ -55,7 +55,7 @@ function sortScanResults(results: ModelScanResult[]): ModelScanResult[] {
|
||||
}
|
||||
|
||||
function sortImageResults(results: ModelScanResult[]): ModelScanResult[] {
|
||||
return results.slice().sort((a, b) => {
|
||||
return results.slice().toSorted((a, b) => {
|
||||
const aLatency = a.image.latencyMs ?? Number.POSITIVE_INFINITY;
|
||||
const bLatency = b.image.latencyMs ?? Number.POSITIVE_INFINITY;
|
||||
if (aLatency !== bLatency) return aLatency - bLatency;
|
||||
@@ -255,7 +255,7 @@ export async function modelsScanCommand(
|
||||
runtime.exit(0);
|
||||
}
|
||||
|
||||
selected = selection as string[];
|
||||
selected = selection;
|
||||
if (imageSorted.length > 0) {
|
||||
const imageSelection = await multiselect({
|
||||
message: "Select image fallback models (ordered)",
|
||||
@@ -272,7 +272,7 @@ export async function modelsScanCommand(
|
||||
runtime.exit(0);
|
||||
}
|
||||
|
||||
selectedImages = imageSelection as string[];
|
||||
selectedImages = imageSelection;
|
||||
}
|
||||
} else if (!process.stdin.isTTY && !opts.yes && !noInput && !opts.json) {
|
||||
throw new Error("Non-interactive scan: pass --yes to apply defaults.");
|
||||
|
||||
Reference in New Issue
Block a user