UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

25 lines (24 loc) • 979 B
//#region src/agents/model-ref-profile.ts /** Split an auth profile suffix without consuming model-version or quantization suffixes. */ function splitTrailingAuthProfile(raw) { const trimmed = raw.trim(); if (!trimmed) return { model: "" }; const lastSlash = trimmed.lastIndexOf("/"); let profileDelimiter = trimmed.indexOf("@", lastSlash + 1); if (profileDelimiter <= 0) return { model: trimmed }; for (const suffix of [/^\d{8}(?:@|$)/, /^(?:i?q\d+(?:_[a-z0-9]+)*|\d+bit)(?:@|$)/i]) { if (!suffix.test(trimmed.slice(profileDelimiter + 1))) continue; const nextDelimiter = trimmed.indexOf("@", profileDelimiter + 1); if (nextDelimiter < 0) return { model: trimmed }; profileDelimiter = nextDelimiter; } const model = trimmed.slice(0, profileDelimiter).trim(); const profile = trimmed.slice(profileDelimiter + 1).trim(); if (!model || !profile) return { model: trimmed }; return { model, profile }; } //#endregion export { splitTrailingAuthProfile as t };