mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Tool Calling: Implement stealth tool defintions (#3192)
* Tool Calling: Implement stealth tool defintions
* Move isStealth check up
* Always stop generation on stealth tool calls
* Image Generation: use stealth flag for tool registration
* Update stealth property description to clarify no follow-up generation will be performed
* Revert "Image Generation: use stealth flag for tool registration"
This reverts commit 8d13445c0b
.
This commit is contained in:
@ -4579,9 +4579,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor?.result);
|
||||
hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
|
||||
const invocationResult = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
|
||||
const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;
|
||||
if (hasToolCalls) {
|
||||
if (!invocationResult.invocations.length && shouldDeleteMessage) {
|
||||
ToolManager.showToolCallError(invocationResult.errors);
|
||||
if (shouldStopGeneration) {
|
||||
if (Array.isArray(invocationResult.errors) && invocationResult.errors.length) {
|
||||
ToolManager.showToolCallError(invocationResult.errors);
|
||||
}
|
||||
unblockGeneration(type);
|
||||
generatedPromptCache = '';
|
||||
streamingProcessor = null;
|
||||
@ -4681,9 +4684,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
||||
const shouldDeleteMessage = type !== 'swipe' && ['', '...'].includes(getMessage);
|
||||
hasToolCalls && shouldDeleteMessage && await deleteLastMessage();
|
||||
const invocationResult = await ToolManager.invokeFunctionTools(data);
|
||||
const shouldStopGeneration = (!invocationResult.invocations.length && shouldDeleteMessage) || invocationResult.stealthCalls.length;
|
||||
if (hasToolCalls) {
|
||||
if (!invocationResult.invocations.length && shouldDeleteMessage) {
|
||||
ToolManager.showToolCallError(invocationResult.errors);
|
||||
if (shouldStopGeneration) {
|
||||
if (Array.isArray(invocationResult.errors) && invocationResult.errors.length) {
|
||||
ToolManager.showToolCallError(invocationResult.errors);
|
||||
}
|
||||
unblockGeneration(type);
|
||||
generatedPromptCache = '';
|
||||
return;
|
||||
|
Reference in New Issue
Block a user