Do not delete tool call messages containing just the reasoning
| @@ -2787,7 +2787,7 @@ class StreamingProcessor { | |||
| 2787 | 2787 | ||
| 2788 | #updateMessageBlockVisibility() { | 2788 | #updateMessageBlockVisibility() { |
| 2789 | if (this.messageDom instanceof HTMLElement && Array.isArray(this.toolCalls) && this.toolCalls.length > 0) { | 2789 | if (this.messageDom instanceof HTMLElement && Array.isArray(this.toolCalls) && this.toolCalls.length > 0) { |
| 2790 | const shouldHide = ['', '...'].includes(this.result); | 2790 | const shouldHide = ['', '...'].includes(this.result) && !this.reasoningHandler.reasoning; |
| 2791 | this.messageDom.classList.toggle('displayNone', shouldHide); | 2791 | this.messageDom.classList.toggle('displayNone', shouldHide); |
| 2792 | } | 2792 | } |
| 2793 | } | 2793 | } |
| @@ -4517,7 +4517,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 4517 | if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) { | 4517 | if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) { |
| 4518 | const lastMessage = chat[chat.length - 1]; | 4518 | const lastMessage = chat[chat.length - 1]; |
| 4519 | const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls); | 4519 | const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls); |
| 4520 | const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result); | 4520 | const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && !lastMessage?.extra?.reasoning && ['', '...'].includes(streamingProcessor?.result); |
| 4521 | hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); | 4521 | hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); |
| 4522 | const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls); | 4522 | const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls); |
| 4523 | const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length; | 4523 | const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length; |
| @@ -4648,7 +4648,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||
| 4648 | 4648 | ||
| 4649 | if (canPerformToolCalls) { | 4649 | if (canPerformToolCalls) { |
| 4650 | const hasToolCalls = ToolManager.hasToolCalls(data); | 4650 | const hasToolCalls = ToolManager.hasToolCalls(data); |
| 4651 | const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage); | 4651 | const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage) && !reasoning; |
| 4652 | hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); | 4652 | hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); |
| 4653 | const invocationResult = await ToolManager.invokeFunctionTools(data); | 4653 | const invocationResult = await ToolManager.invokeFunctionTools(data); |
| 4654 | const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length; | 4654 | const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length; |