Replace info popups with toasts

This commit is contained in:
SillyLossy
2023-05-20 23:59:39 +03:00
parent ba5f5c272a
commit 299b9a04bc
7 changed files with 16 additions and 21 deletions

View File

@ -1703,7 +1703,7 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
}
if (main_api == 'textgenerationwebui' && textgenerationwebui_settings.streaming && !textgenerationwebui_settings.streaming_url) {
callPopup('Streaming URL is not set. Look it up in the console window when starting TextGen Web UI', 'text');
toastr.error('Streaming URL is not set. Look it up in the console window when starting TextGen Web UI');
is_send_press = false;
return;
}
@ -2998,11 +2998,6 @@ function extractMessageFromData(data) {
if (main_api == 'textgenerationwebui') {
getMessage = data.results[0].text;
if (getMessage == null || data.error) {
activateSendButtons();
callPopup('<h3>Got empty response from Text generation web UI. Try restarting the API with recommended options.</h3>', 'text');
return;
}
}
if (main_api == 'novel') {
@ -4520,7 +4515,7 @@ function setGenerationProgress(progress) {
function isHordeGenerationNotAllowed() {
if (main_api == "kobold" && horde_settings.use_horde && preset_settings == "gui") {
callPopup('GUI Settings preset is not supported for Horde. Please select another preset.', 'text');
toastr.error('GUI Settings preset is not supported for Horde. Please select another preset.');
return true;
}
@ -5587,7 +5582,7 @@ $(document).ready(function () {
let value = formatKoboldUrl($.trim($("#api_url_text").val()));
if (!value) {
callPopup('Please enter a valid URL.', 'text');
toastr.error('Please enter a valid URL.');
return;
}

View File

@ -266,7 +266,7 @@ async function convertSoloToGroupChat() {
$(`.group_select[grid="${group.id}"]`).click();
await delay(1);
callPopup('The chat has been successfully converted!', 'text');
toastr.success('The chat has been successfully converted!');
}
$(document).ready(function () {

View File

@ -414,7 +414,7 @@ async function generatePicture(_, trigger, message, callback) {
}
if (!modules.includes('sd') && !extension_settings.sd.horde) {
callPopup("Extensions API is not connected or doesn't provide SD module. Enable Stable Horde to generate images.", 'text');
toastr.warning("Extensions API is not connected or doesn't provide SD module. Enable Stable Horde to generate images.");
return;
}
@ -545,7 +545,7 @@ async function generateHordeImage(prompt, callback) {
const base64Image = `data:image/webp;base64,${data}`;
callback ? callback(prompt, base64Image) : sendMessage(prompt, base64Image);
} else {
callPopup('Image generation has failed. Please try again.', 'text');
toastr.error('Image generation has failed. Please try again.');
}
}

View File

@ -480,7 +480,7 @@ async function generateGroupWrapper(by_auto_mode, type = null, params = {}) {
activatedMembers = activateSwipe(group.members);
if (activatedMembers.length === 0) {
callPopup('<h3>Deleted group member swiped. To get a reply, add them back to the group.</h3>', 'text');
toastr.warning('Deleted group member swiped. To get a reply, add them back to the group.');
throw new Error('Deleted group member swiped');
}
}
@ -961,7 +961,7 @@ function select_group_chats(groupId, skipAnimation) {
$("#rm_group_delete").off();
$("#rm_group_delete").on("click", function () {
if (is_group_generating) {
callPopup('<h3>Not so fast! Wait for the characters to stop typing before deleting the group.</h3>', 'text');
toastr.warning('Not so fast! Wait for the characters to stop typing before deleting the group.');
return;
}

View File

@ -41,7 +41,7 @@ function validateHordeModel() {
let selectedModels = models.filter(m => horde_settings.models.includes(m.name));
if (selectedModels.length === 0) {
callPopup('No Horde model selected or the selected models are no longer available. Please choose another model', 'text');
toastr.warning('No Horde model selected or the selected models are no longer available. Please choose another model');
throw new Error('No Horde model available');
}

View File

@ -146,7 +146,7 @@ function validateReverseProxy() {
new URL(oai_settings.reverse_proxy);
}
catch (err) {
callPopup('Entered reverse proxy address is not a valid URL', 'text');
toastr.error('Entered reverse proxy address is not a valid URL');
setOnlineStatus('no_connection');
resultCheckStatusOpen();
throw err;
@ -930,7 +930,7 @@ async function showApiKeyUsage() {
}
catch (err) {
console.error(err);
callPopup('Invalid API key', 'text');
toastr.error('Invalid API key');
}
}
@ -995,7 +995,7 @@ async function createNewLogitBiasPreset() {
}
if (name in oai_settings.bias_presets) {
callPopup('Preset name should be unique.', 'text');
toastr.error('Preset name should be unique.');
return;
}
@ -1032,12 +1032,12 @@ async function onLogitBiasPresetImportFileChange(e) {
e.target.value = '';
if (name in oai_settings.bias_presets) {
callPopup('Preset name should be unique.', 'text');
toastr.error('Preset name should be unique.');
return;
}
if (!Array.isArray(importedFile)) {
callPopup('Invalid logit bias preset file.', 'text');
toastr.error('Invalid logit bias preset file.');
return;
}
@ -1341,7 +1341,7 @@ $(document).ready(function () {
$("#update_oai_preset").on('click', async function () {
const name = oai_settings.preset_settings_openai;
await saveOpenAIPreset(name, oai_settings);
callPopup('Preset updated', 'text');
toastr.success('Preset updated');
});
$("#main_prompt_restore").on('click', function () {

View File

@ -80,7 +80,7 @@ function setWorldInfoSettings(settings, data) {
// World Info Editor
async function showWorldEditor() {
if (!world_info) {
callPopup("<h3>Select a world info first!</h3>", "text");
toastr.warning("Select a world info first!");
return;
}