mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 23:02:02 +03:00
refactor(commands): dedupe model scan sorting
This commit is contained in:
@@ -50,19 +50,7 @@ function sortScanResults(results: ModelScanResult[]): ModelScanResult[] {
|
|||||||
return aToolLatency - bToolLatency;
|
return aToolLatency - bToolLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
const aCtx = a.contextLength ?? 0;
|
return compareScanMetadata(a, b);
|
||||||
const bCtx = b.contextLength ?? 0;
|
|
||||||
if (aCtx !== bCtx) {
|
|
||||||
return bCtx - aCtx;
|
|
||||||
}
|
|
||||||
|
|
||||||
const aParams = a.inferredParamB ?? 0;
|
|
||||||
const bParams = b.inferredParamB ?? 0;
|
|
||||||
if (aParams !== bParams) {
|
|
||||||
return bParams - aParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
return a.modelRef.localeCompare(b.modelRef);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +62,11 @@ function sortImageResults(results: ModelScanResult[]): ModelScanResult[] {
|
|||||||
return aLatency - bLatency;
|
return aLatency - bLatency;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return compareScanMetadata(a, b);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function compareScanMetadata(a: ModelScanResult, b: ModelScanResult): number {
|
||||||
const aCtx = a.contextLength ?? 0;
|
const aCtx = a.contextLength ?? 0;
|
||||||
const bCtx = b.contextLength ?? 0;
|
const bCtx = b.contextLength ?? 0;
|
||||||
if (aCtx !== bCtx) {
|
if (aCtx !== bCtx) {
|
||||||
@@ -87,7 +80,6 @@ function sortImageResults(results: ModelScanResult[]): ModelScanResult[] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return a.modelRef.localeCompare(b.modelRef);
|
return a.modelRef.localeCompare(b.modelRef);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildScanHint(result: ModelScanResult): string {
|
function buildScanHint(result: ModelScanResult): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user