Fix auto-parsing of continue from reasoning

Continues #3606
This commit is contained in:
Cohee
2025-03-08 12:58:26 +02:00
parent 91fe2841e3
commit 980ed76cc3
2 changed files with 82 additions and 17 deletions

View File

@ -3287,7 +3287,7 @@ class StreamingProcessor {
chat[messageId]['extra']['time_to_first_token'] = this.timeToFirstToken;
// Update reasoning
await this.reasoningHandler.process(messageId, mesChanged);
await this.reasoningHandler.process(messageId, mesChanged, this.promptReasoning);
processedText = chat[messageId]['mes'];
// Token count update.
@ -5953,7 +5953,7 @@ export function cleanUpMessage(getMessage, isImpersonate, isContinue, displayInc
getMessage = trimToEndSentence(getMessage);
}
if (power_user.trim_spaces) {
if (power_user.trim_spaces && !PromptReasoning.getLatestPrefix()) {
getMessage = getMessage.trim();
}
@ -6147,13 +6147,17 @@ export function syncMesToSwipe(messageId = null) {
}
const targetMessageId = messageId ?? chat.length - 1;
if (chat.length > targetMessageId || targetMessageId < 0) {
if (targetMessageId >= chat.length || targetMessageId < 0) {
console.warn(`[syncMesToSwipe] Invalid message ID: ${messageId}`);
return false;
}
const targetMessage = chat[targetMessageId];
if (!targetMessage) {
return false;
}
// No swipe data there yet, exit out
if (typeof targetMessage.swipe_id !== 'number') {
return false;