mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 03:32:43 +00:00
fix(model): land #30932 auth-profile @ parsing for /model (@haosenwang1018)
Landed from contributor PR #30932 by @haosenwang1018. Co-authored-by: haosenwang1018 <haosenwang1018@users.noreply.github.com>
This commit is contained in:
@@ -46,4 +46,11 @@ describe("splitTrailingAuthProfile", () => {
|
||||
model: "provider/foo@bar/baz",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses first @ after last slash for email-based auth profiles", () => {
|
||||
expect(splitTrailingAuthProfile("flash@google-gemini-cli:test@gmail.com")).toEqual({
|
||||
model: "flash",
|
||||
profile: "google-gemini-cli:test@gmail.com",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,9 +7,9 @@ export function splitTrailingAuthProfile(raw: string): {
|
||||
return { model: "" };
|
||||
}
|
||||
|
||||
const profileDelimiter = trimmed.lastIndexOf("@");
|
||||
const lastSlash = trimmed.lastIndexOf("/");
|
||||
if (profileDelimiter <= 0 || profileDelimiter <= lastSlash) {
|
||||
const profileDelimiter = trimmed.indexOf("@", lastSlash + 1);
|
||||
if (profileDelimiter <= 0) {
|
||||
return { model: trimmed };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user