mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Make "send message from chat box" into a function
Right now all it does is handle returning if there's already a message being generated, but I'll extend it with more logic that I want to move out of Generate().
This commit is contained in:
@@ -1472,6 +1472,14 @@ export async function reloadCurrentChat() {
|
||||
showSwipeButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the message currently typed into the chat box.
|
||||
*/
|
||||
export function sendTextareaMessage() {
|
||||
if (is_send_press) return;
|
||||
Generate();
|
||||
}
|
||||
|
||||
function messageFormatting(mes, ch_name, isSystem, isUser) {
|
||||
if (!mes) {
|
||||
return '';
|
||||
@@ -7971,12 +7979,7 @@ jQuery(async function () {
|
||||
});
|
||||
|
||||
$('#send_but').on('click', function () {
|
||||
if (is_send_press == false) {
|
||||
// This prevents from running /trigger command with a send button
|
||||
// But send on Enter doesn't set is_send_press (it is done by the Generate itself)
|
||||
// is_send_press = true;
|
||||
Generate();
|
||||
}
|
||||
sendTextareaMessage();
|
||||
});
|
||||
|
||||
//menu buttons setup
|
||||
|
Reference in New Issue
Block a user