Replace multigen with auto-continue

This commit is contained in:
Cohee
2023-09-15 21:34:41 +03:00
parent eaca6ddaf0
commit d34f7d3e1a
8 changed files with 120 additions and 241 deletions

View File

@@ -1,4 +1,4 @@
import { callPopup, cancelTtsPlay, eventSource, event_types, isMultigenEnabled, is_send_press, saveSettingsDebounced } from '../../../script.js'
import { callPopup, cancelTtsPlay, eventSource, event_types, saveSettingsDebounced } from '../../../script.js'
import { ModuleWorkerWrapper, doExtrasFetch, extension_settings, getApiUrl, getContext, modules } from '../../extensions.js'
import { escapeRegex, getStringHash } from '../../utils.js'
import { EdgeTtsProvider } from './edge.js'
@@ -117,11 +117,6 @@ async function moduleWorker() {
return
}
// Multigen message is currently being generated
if (is_send_press && isMultigenEnabled()) {
return;
}
// Chat changed
if (
context.chatId !== lastChatId

View File

@@ -51,7 +51,6 @@ import {
menu_type,
select_selected_character,
cancelTtsPlay,
isMultigenEnabled,
displayPastChats,
sendMessageAsUser,
getBiasStrings,
@@ -577,7 +576,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
await Generate(generateType, { automatic_trigger: by_auto_mode, ...(params || {}) });
if (type !== "swipe" && type !== "impersonate" && !isMultigenEnabled() && !isStreamingEnabled()) {
if (type !== "swipe" && type !== "impersonate" && !isStreamingEnabled()) {
// update indicator and scroll down
typingIndicator
.find(".typing_indicator_name")
@@ -593,7 +592,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
}
// if not swipe - check if message generated already
if (generateType === "group_chat" && !isMultigenEnabled() && chat.length == messagesBefore) {
if (generateType === "group_chat" && chat.length == messagesBefore) {
await delay(100);
}
// if swipe - see if message changed
@@ -606,13 +605,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
break;
}
}
else if (isMultigenEnabled()) {
if (isGenerationDone) {
break;
} else {
await delay(100);
}
}
else {
if (lastMessageText === chat[chat.length - 1].mes) {
await delay(100);
@@ -631,13 +623,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
break;
}
}
else if (isMultigenEnabled()) {
if (isGenerationDone) {
break;
} else {
await delay(100);
}
}
else {
if (!$("#send_textarea").val() || $("#send_textarea").val() == userInput) {
await delay(100);
@@ -654,14 +639,6 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
await delay(100);
}
}
else if (isMultigenEnabled()) {
if (isGenerationDone) {
messagesBefore++;
break;
} else {
await delay(100);
}
}
else if (isStreamingEnabled()) {
if (streamingProcessor && !streamingProcessor.isFinished) {
await delay(100);

View File

@@ -93,9 +93,11 @@ let power_user = {
always_force_name2: false,
user_prompt_bias: '',
show_user_prompt_bias: true,
multigen: false,
multigen_first_chunk: 50,
multigen_next_chunks: 30,
auto_continue: {
enabled: false,
allow_chat_completions: false,
target_length: 400,
},
markdown_escape_strings: '',
ui_mode: ui_mode.POWER,
@@ -848,9 +850,9 @@ function loadPowerUserSettings(settings, data) {
$("#noShadowsmode").prop("checked", power_user.noShadows);
$("#start_reply_with").val(power_user.user_prompt_bias);
$("#chat-show-reply-prefix-checkbox").prop("checked", power_user.show_user_prompt_bias);
$("#multigen").prop("checked", power_user.multigen);
$("#multigen_first_chunk").val(power_user.multigen_first_chunk);
$("#multigen_next_chunks").val(power_user.multigen_next_chunks);
$("#auto_continue_enabled").prop("checked", power_user.auto_continue.enabled);
$("#auto_continue_allow_chat_completions").prop("checked", power_user.auto_continue.allow_chat_completions);
$("#auto_continue_target_length").val(power_user.auto_continue.target_length);
$("#play_message_sound").prop("checked", power_user.play_message_sound);
$("#play_sound_unfocused").prop("checked", power_user.play_sound_unfocused);
$("#never_resize_avatars").prop("checked", power_user.never_resize_avatars);
@@ -1816,8 +1818,18 @@ $(document).ready(() => {
saveSettingsDebounced();
})
$("#multigen").change(function () {
power_user.multigen = $(this).prop("checked");
$("#auto_continue_enabled").on('change', function () {
power_user.auto_continue.enabled = $(this).prop("checked");
saveSettingsDebounced();
});
$("#auto_continue_allow_chat_completions").on('change', function () {
power_user.auto_continue.allow_chat_completions = !!$(this).prop('checked');
saveSettingsDebounced();
});
$("#auto_continue_target_length").on('input', function () {
power_user.auto_continue.target_length = Number($(this).val());
saveSettingsDebounced();
});
@@ -1986,16 +1998,6 @@ $(document).ready(() => {
saveSettingsDebounced();
});
$("#multigen_first_chunk").on('input', function () {
power_user.multigen_first_chunk = Number($(this).val());
saveSettingsDebounced();
});
$("#multigen_next_chunks").on('input', function () {
power_user.multigen_next_chunks = Number($(this).val());
saveSettingsDebounced();
});
$('#auto_swipe').on('input', function () {
power_user.auto_swipe = !!$(this).prop('checked');
saveSettingsDebounced();