fix(auto-reply): preserve OpenRouter @preset model directives (#23769)

* Auto-reply: preserve OpenRouter @preset model directives

* Changelog: move OpenRouter preset fix into 2026.2.22 unreleased
This commit is contained in:
Vincent Koc
2026-02-22 12:46:04 -05:00
committed by GitHub
parent 91944ede4c
commit 24fd8cbdc8
3 changed files with 26 additions and 6 deletions

View File

@@ -33,10 +33,16 @@ export function extractModelDirective(
let rawModel = raw;
let rawProfile: string | undefined;
if (raw?.includes("@")) {
const parts = raw.split("@");
rawModel = parts[0]?.trim();
rawProfile = parts.slice(1).join("@").trim() || undefined;
if (raw) {
const atIndex = raw.lastIndexOf("@");
if (atIndex > 0) {
const candidateModel = raw.slice(0, atIndex).trim();
const candidateProfile = raw.slice(atIndex + 1).trim();
if (candidateModel && candidateProfile && !candidateProfile.includes("/")) {
rawModel = candidateModel;
rawProfile = candidateProfile;
}
}
}
const cleaned = match ? body.replace(match[0], " ").replace(/\s+/g, " ").trim() : body.trim();