Bypass generation for QR slash commands

This commit is contained in:
Cohee
2023-11-09 03:19:57 +02:00
parent f2a96427a8
commit d9d61e479d

View File

@@ -1,7 +1,7 @@
import { saveSettingsDebounced, callPopup, getRequestHeaders, substituteParams } from "../../../script.js"; import { saveSettingsDebounced, callPopup, getRequestHeaders, substituteParams } from "../../../script.js";
import { getContext, extension_settings } from "../../extensions.js"; import { getContext, extension_settings } from "../../extensions.js";
import { initScrollHeight, resetScrollHeight } from "../../utils.js"; import { initScrollHeight, resetScrollHeight } from "../../utils.js";
import { registerSlashCommand } from "../../slash-commands.js"; import { executeSlashCommands, registerSlashCommand } from "../../slash-commands.js";
export { MODULE_NAME }; export { MODULE_NAME };
@@ -152,14 +152,19 @@ async function sendQuickReply(index) {
newText = substituteParams(newText); newText = substituteParams(newText);
// the prompt starts with '/' - execute slash commands natively
if (prompt.startsWith('/')) {
await executeSlashCommands(newText);
return;
}
$("#send_textarea").val(newText); $("#send_textarea").val(newText);
// Set the focus back to the textarea // Set the focus back to the textarea
$("#send_textarea").trigger('focus'); $("#send_textarea").trigger('focus');
// Only trigger send button if quickActionEnabled is not checked or // Only trigger send button if quickActionEnabled is not checked or
// the prompt starts with '/' if (!extension_settings.quickReply.quickActionEnabled) {
if (!extension_settings.quickReply.quickActionEnabled || prompt.startsWith('/')) {
$("#send_but").trigger('click'); $("#send_but").trigger('click');
} }
} }