Fix undefined reasoning append on continue

cc7355358db9879035080dfc86f0cf8d548d2c01

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +9 -0Showing whitespace changes
public/script.js+9 -0
@@ -5927,6 +5927,15 @@ export async function saveReply(type, getMessage, fromStreaming, title, swipes,
59275927 chat[chat.length - 1]['extra'] = {};
59285928 }
59295929
5930+ // Coerce null/undefined to empty string
5931+ if (!chat[chat.length - 1]['extra']['reasoning']) {
5932+ chat[chat.length - 1]['extra']['reasoning'] = '';
5933+ }
5934+
5935+ if (!reasoning) {
5936+ reasoning = '';
5937+ }
5938+
59305939 let oldMessage = '';
59315940 const generationFinished = new Date();
59325941 const img = extractImageFromMessage(getMessage);