Allow tool registration on swipes

89bad2188185af9c95f27bd0bc6e066d8001e868

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

2 files changed, +3 -3Ignore whitespace
public/script.js+2 -2
@@ -4472,7 +4472,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
4472 if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) {4472 if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) {
4473 const lastMessage = chat[chat.length - 1];4473 const lastMessage = chat[chat.length - 1];
4474 const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls);4474 const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls);
4475 const shouldDeleteMessage = ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result);4475 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result);
4476 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();4476 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
4477 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);4477 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
4478 if (hasToolCalls) {4478 if (hasToolCalls) {
@@ -4566,7 +4566,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
45664566
4567 if (canPerformToolCalls) {4567 if (canPerformToolCalls) {
4568 const hasToolCalls = ToolManager.hasToolCalls(data);4568 const hasToolCalls = ToolManager.hasToolCalls(data);
4569 const shouldDeleteMessage = ['', '...'].includes(getMessage);4569 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage);
4570 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();4570 hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
4571 const invocationResult = await ToolManager.invokeFunctionTools(data);4571 const invocationResult = await ToolManager.invokeFunctionTools(data);
4572 if (hasToolCalls) {4572 if (hasToolCalls) {
public/scripts/tool-calling.js+1 -1
@@ -487,7 +487,7 @@ export class ToolManager {
487 * @returns {boolean} Whether tool calls can be performed for the given type487 * @returns {boolean} Whether tool calls can be performed for the given type
488 */488 */
489 static canPerformToolCalls(type) {489 static canPerformToolCalls(type) {
490 const noToolCallTypes = ['swipe', 'impersonate', 'quiet', 'continue'];490 const noToolCallTypes = ['impersonate', 'quiet', 'continue'];
491 const isSupported = ToolManager.isToolCallingSupported();491 const isSupported = ToolManager.isToolCallingSupported();
492 return isSupported && !noToolCallTypes.includes(type);492 return isSupported && !noToolCallTypes.includes(type);
493 }493 }