mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
don't try to parse empty qrJson on add from text
This commit is contained in:
@@ -241,6 +241,7 @@ export class QuickReplySet {
|
|||||||
}
|
}
|
||||||
addQuickReplyFromText(qrJson) {
|
addQuickReplyFromText(qrJson) {
|
||||||
let data;
|
let data;
|
||||||
|
if (qrJson) {
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(qrJson ?? '{}');
|
data = JSON.parse(qrJson ?? '{}');
|
||||||
delete data.id;
|
delete data.id;
|
||||||
@@ -258,6 +259,9 @@ export class QuickReplySet {
|
|||||||
// no JSON, use plaintext as QR message
|
// no JSON, use plaintext as QR message
|
||||||
data = { message: qrJson };
|
data = { message: qrJson };
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
data = {};
|
||||||
|
}
|
||||||
const newQr = this.addQuickReply(data);
|
const newQr = this.addQuickReply(data);
|
||||||
return newQr;
|
return newQr;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user