fix: a stop sequence with a % sign no longer stops every message from sending (#32649)

This commit is contained in:
G30 2026-10-20 13:52:14 -04:00 • committed by GitHub
parent 07dffea1ef
commit fdb304be2f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4138,9 +4138,13 @@
const tokens = Array.isArray(stop) ? stop : stop.split(',').map((s) => s.trim());
return tokens
.filter(Boolean)
.map((token) => decodeURIComponent(JSON.parse(`"${token.replace(/"/g, '\\"')}"`)));
return tokens.filter(Boolean).map((token) => {
try {
return decodeURIComponent(JSON.parse(`"${token.replace(/"/g, '\\"')}"`));
} catch {
return token;
}
});
};
const sendMessageSocket = async (