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

This commit is contained in:
G30 authored and GitHub committed 2026-10-21 02:52:14 +09:00
1 parent 07dffea1ef
commit fdb304be2f
1 file changed
+7 -3
+7 -3
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 (