mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 18:54:58 +00:00
fix(models): normalize trailing @profile parsing across resolver paths
Co-authored-by: Vincent Koc <vincentkoc@ieee.org> Co-authored-by: Marcus Castro <mcaxtr@gmail.com> Co-authored-by: Brandon Wise <brandonawise@gmail.com>
This commit is contained in:
23
src/agents/model-ref-profile.ts
Normal file
23
src/agents/model-ref-profile.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
export function splitTrailingAuthProfile(raw: string): {
|
||||
model: string;
|
||||
profile?: string;
|
||||
} {
|
||||
const trimmed = raw.trim();
|
||||
if (!trimmed) {
|
||||
return { model: "" };
|
||||
}
|
||||
|
||||
const profileDelimiter = trimmed.lastIndexOf("@");
|
||||
const lastSlash = trimmed.lastIndexOf("/");
|
||||
if (profileDelimiter <= 0 || profileDelimiter <= lastSlash) {
|
||||
return { model: trimmed };
|
||||
}
|
||||
|
||||
const model = trimmed.slice(0, profileDelimiter).trim();
|
||||
const profile = trimmed.slice(profileDelimiter + 1).trim();
|
||||
if (!model || !profile) {
|
||||
return { model: trimmed };
|
||||
}
|
||||
|
||||
return { model, profile };
|
||||
}
|
||||
Reference in New Issue
Block a user