mirror of
				https://github.com/SillyTavern/SillyTavern.git
				synced 2025-06-05 21:59:27 +02:00 
			
		
		
		
	Allow tool registration on swipes
This commit is contained in:
		| @@ -4472,7 +4472,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||||||
|             if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) { |             if (canPerformToolCalls && isStreamFinished && isStreamWithToolCalls) { | ||||||
|                 const lastMessage = chat[chat.length - 1]; |                 const lastMessage = chat[chat.length - 1]; | ||||||
|                 const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls); |                 const hasToolCalls = ToolManager.hasToolCalls(streamingProcessor.toolCalls); | ||||||
|                 const shouldDeleteMessage = ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result); |                 const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result); | ||||||
|                 hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); |                 hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); | ||||||
|                 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls); |                 const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls); | ||||||
|                 if (hasToolCalls) { |                 if (hasToolCalls) { | ||||||
| @@ -4566,7 +4566,7 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro | |||||||
|  |  | ||||||
|         if (canPerformToolCalls) { |         if (canPerformToolCalls) { | ||||||
|             const hasToolCalls = ToolManager.hasToolCalls(data); |             const hasToolCalls = ToolManager.hasToolCalls(data); | ||||||
|             const shouldDeleteMessage = ['', '...'].includes(getMessage); |             const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage); | ||||||
|             hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); |             hasToolCalls && shouldDeleteMessage && await deleteLastMessage(); | ||||||
|             const invocationResult = await ToolManager.invokeFunctionTools(data); |             const invocationResult = await ToolManager.invokeFunctionTools(data); | ||||||
|             if (hasToolCalls) { |             if (hasToolCalls) { | ||||||
|   | |||||||
| @@ -487,7 +487,7 @@ export class ToolManager { | |||||||
|      * @returns {boolean} Whether tool calls can be performed for the given type |      * @returns {boolean} Whether tool calls can be performed for the given type | ||||||
|      */ |      */ | ||||||
|     static canPerformToolCalls(type) { |     static canPerformToolCalls(type) { | ||||||
|         const noToolCallTypes = ['swipe', 'impersonate', 'quiet', 'continue']; |         const noToolCallTypes = ['impersonate', 'quiet', 'continue']; | ||||||
|         const isSupported = ToolManager.isToolCallingSupported(); |         const isSupported = ToolManager.isToolCallingSupported(); | ||||||
|         return isSupported && !noToolCallTypes.includes(type); |         return isSupported && !noToolCallTypes.includes(type); | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user