UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

22 lines (21 loc) • 763 B
//#region src/agents/model-context-window.ts /** * Resolves a session's selectable context-window choice against the model's * catalog-declared options: explicit selection, else the declared default, * else the model's scalar window. */ function resolveModelContextWindowProfile(e) { const t = e.catalogEntry?.contextWindows ?? []; const n = e.catalogEntry?.contextWindowDefault; const r = e.selected ? t.find((t) => t.id === e.selected) : void 0; const i = n ? t.find((e) => e.id === n) : void 0; const a = r ?? i; return { contextWindow: a?.id, contextWindows: t.length > 0 ? t : void 0, contextWindowDefault: n, contextTokens: a?.contextWindow ?? e.catalogEntry?.contextWindow }; } //#endregion export { resolveModelContextWindowProfile as t };