UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

3 lines • 1.82 kB
import{r as isDeeplyFrozenPlainData}from"./immutable-data-CyaF4H_G.mjs";import{i as getPluginExecutionFrame}from"./plugin-instance-invocation-na_CYyUz.mjs";import{i as getPluginRegistryForContext}from"./gateway-request-scope-7deHmsb_.mjs";import"./model-ref-shared-T-aCqInj.mjs";import{o as getGatewayPluginMetadataSnapshot}from"./plugin-metadata-lifecycle-Bdt91XXL.mjs";import{a as getRuntimeConfigSnapshot}from"./runtime-snapshot-Bg5K4JNu.mjs";import{r as modelKey}from"./provider-registry-index-fv5AHL27.mjs";import{r as getPluginRuntimeLoadContext}from"./load-context-BgV8IMWg.mjs";import{o as resolveBundledStaticCatalogModel,s as resolveManifestModelCatalogProviderAliasMetadata}from"./model.static-catalog-DJ0BQBuH.mjs";import{t as normalizeConfiguredProviderModel}from"./model.registry-resolution-D0F2tm5v.mjs";import{i as resolveConfiguredProviderConfig}from"./model.configured-overrides-Dqnw5TO7.mjs"; //!src/agents/model-fallback-rate-limit-model.ts function resolveFallbackRateLimitModel(e){const t=e.cfg===getRuntimeConfigSnapshot()?getRuntimeConfigSnapshot({capture:true}):e.cfg&&isDeeplyFrozenPlainData(e.cfg)?e.cfg:void 0;const n=getPluginRuntimeLoadContext(getPluginRegistryForContext()??void 0);const r=getPluginExecutionFrame()?.metadataScope;const i=r?r.snapshot:getGatewayPluginMetadataSnapshot();const a=i&&i===n?.metadataSnapshot?n.fallbackRateLimitModels:void 0;let o=t&&a?.get(t);if(t&&a&&!o){o=/* @__PURE__ */ new Map;a.set(t,o)}const s=modelKey(e.provider,e.modelId);if(o?.has(s))return o.get(s);const c=normalizeConfiguredProviderModel({...e,providerConfig:resolveConfiguredProviderConfig(e.cfg,e.provider),discoveredModel:resolveBundledStaticCatalogModel(e),manifestAlias:resolveManifestModelCatalogProviderAliasMetadata(e)});o?.set(s,c);return c}export{resolveFallbackRateLimitModel as t};