Do not delete tool call messages containing just the reasoning

a88afde22ed63c1d4ad02e837845cbdf01bd4ae9

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

1 files changed, +3 -3Showing whitespace changes
public/script.js+3 -3
@@ -2787,7 +2787,7 @@ class StreamingProcessor {
27872787
27882788 #updateMessageBlockVisibility() {
27892789 if (this.messageDom instanceof HTMLElement && Array.isArray(this.toolCalls) && this.toolCalls.length > 0) {
27902790 const shouldHide = ['', '...'].includes(this.result) && !this.reasoningHandler.reasoning;
27912791 this.messageDom.classList.toggle('displayNone', shouldHide);
27922792 }
27932793 }
@@ -4517,7 +4517,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
45174517 if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) {
45184518 const lastMessage = chat[chat.length - 1];
45194519 const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls);
45204520 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && !lastMessage?.extra?.reasoning && ['', '...'].includes(streamingProcessor?.result);
45214521 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
45224522 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
45234523 const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;
@@ -4648,7 +4648,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
46484648
46494649 if (canPerformToolCalls) {
46504650 const hasToolCalls = ToolManager.hasToolCalls(data);
46514651 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage) && !reasoning;
46524652 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
46534653 const invocationResult = await ToolManager.invokeFunctionTools(data);
46544654 const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;