mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 10:57:45 +01:00
Delete empty message before tool invocations
This commit is contained in:
parent
c3e9d25307
commit
2dad86e076
@ -4409,14 +4409,12 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canPerformToolCalls && Array.isArray(streamingProcessor.toolCalls) && streamingProcessor.toolCalls.length) {
|
if (canPerformToolCalls && Array.isArray(streamingProcessor.toolCalls) && streamingProcessor.toolCalls.length) {
|
||||||
const invocations = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
|
|
||||||
if (Array.isArray(invocations) && invocations.length) {
|
|
||||||
const lastMessage = chat[chat.length - 1];
|
const lastMessage = chat[chat.length - 1];
|
||||||
const shouldDeleteMessage = ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor.result);
|
const shouldDeleteMessage = ['', '...'].includes(lastMessage?.mes) && ['', '...'].includes(streamingProcessor.result);
|
||||||
if (shouldDeleteMessage) {
|
shouldDeleteMessage && await deleteLastMessage();
|
||||||
await deleteLastMessage();
|
const invocations = await ToolManager.invokeFunctionTools(streamingProcessor.toolCalls);
|
||||||
|
if (Array.isArray(invocations) && invocations.length) {
|
||||||
streamingProcessor = null;
|
streamingProcessor = null;
|
||||||
}
|
|
||||||
ToolManager.saveFunctionToolInvocations(invocations);
|
ToolManager.saveFunctionToolInvocations(invocations);
|
||||||
return Generate(type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage, quietName }, dryRun);
|
return Generate(type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage, quietName }, dryRun);
|
||||||
}
|
}
|
||||||
@ -4497,10 +4495,10 @@ export async function Generate(type, { automatic_trigger, force_name2, quiet_pro
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (canPerformToolCalls) {
|
if (canPerformToolCalls) {
|
||||||
const invocations = await ToolManager.invokeFunctionTools(data);
|
|
||||||
if (Array.isArray(invocations) && invocations.length) {
|
|
||||||
const shouldDeleteMessage = ['', '...'].includes(getMessage);
|
const shouldDeleteMessage = ['', '...'].includes(getMessage);
|
||||||
shouldDeleteMessage && await deleteLastMessage();
|
shouldDeleteMessage && await deleteLastMessage();
|
||||||
|
const invocations = await ToolManager.invokeFunctionTools(data);
|
||||||
|
if (Array.isArray(invocations) && invocations.length) {
|
||||||
ToolManager.saveFunctionToolInvocations(invocations);
|
ToolManager.saveFunctionToolInvocations(invocations);
|
||||||
return Generate(type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage, quietName }, dryRun);
|
return Generate(type, { automatic_trigger, force_name2, quiet_prompt, quietToLoud, skipWIAN, force_chid, signal, quietImage, quietName }, dryRun);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user