openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
9 lines (8 loc) • 402 B
JavaScript
//#region src/agents/model-catalog-json.ts
/** Parses the JSON-with-comments syntax accepted by root model catalogs. */
function parseModelCatalogJson(e) {
const t = e.replace(/"(?:\\.|[^"\\])*"|\/\/[^\n]*/g, (e) => e[0] === "\"" ? e : "").replace(/"(?:\\.|[^"\\])*"|,(\s*[}\]])/g, (e, t) => t ?? (e[0] === "\"" ? e : ""));
return JSON.parse(t);
}
//#endregion
export { parseModelCatalogJson as t };