mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-13 11:00:50 +00:00
21 lines
690 B
TypeScript
21 lines
690 B
TypeScript
import type { OpenClawConfig } from "../config/config.js";
|
|
|
|
export function buildModelAliasLines(cfg?: OpenClawConfig) {
|
|
const models = cfg?.agents?.defaults?.models ?? {};
|
|
const entries: Array<{ alias: string; model: string }> = [];
|
|
for (const [keyRaw, entryRaw] of Object.entries(models)) {
|
|
const model = String(keyRaw ?? "").trim();
|
|
if (!model) {
|
|
continue;
|
|
}
|
|
const alias = String((entryRaw as { alias?: string } | undefined)?.alias ?? "").trim();
|
|
if (!alias) {
|
|
continue;
|
|
}
|
|
entries.push({ alias, model });
|
|
}
|
|
return entries
|
|
.toSorted((a, b) => a.alias.localeCompare(b.alias))
|
|
.map((entry) => `- ${entry.alias}: ${entry.model}`);
|
|
}
|