#976 Return "Continue on send". Allow continuing the first chat message. Add debug function for i18n.
This commit is contained in:
parent
3e25c3f51c
commit
f5fd15ffd2
|
@ -129,6 +129,7 @@
|
|||
"prefer_character_prompt": true,
|
||||
"prefer_character_jailbreak": true,
|
||||
"quick_continue": false,
|
||||
"continue_on_send": false,
|
||||
"trim_spaces": true,
|
||||
"relaxed_api_urls": false,
|
||||
"default_instruct": "",
|
||||
|
|
|
@ -2827,6 +2827,12 @@
|
|||
<input id="prefer_character_jailbreak" type="checkbox" />
|
||||
<span data-i18n="Prefer Character Card Jailbreak">Prefer Char. JB</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="continue_on_send">
|
||||
<input id="continue_on_send" type="checkbox" />
|
||||
<span data-i18n="Press Send to continue">
|
||||
Press "Send" to continue
|
||||
</span>
|
||||
</label>
|
||||
<label class="checkbox_label" for="quick_continue">
|
||||
<input id="quick_continue" type="checkbox" />
|
||||
<span data-i18n="Press Send to continue">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"compilerOptions": {
|
||||
"checkJs": true,
|
||||
"target": "ESNext",
|
||||
"module": "commonjs",
|
||||
"module": "ESNext",
|
||||
"allowUmdGlobalAccess": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
|
|
|
@ -2320,6 +2320,10 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||
}
|
||||
}
|
||||
|
||||
if (!type && !textareaText && power_user.continue_on_send && !selected_group && chat.length && !chat[chat.length - 1]['is_user'] && !chat[chat.length - 1]['is_system']) {
|
||||
type = 'continue';
|
||||
}
|
||||
|
||||
const isContinue = type == 'continue';
|
||||
|
||||
if (!dryRun) {
|
||||
|
@ -2641,7 +2645,10 @@ async function Generate(type, { automatic_trigger, force_name2, resolve, reject,
|
|||
|
||||
console.debug('--setting Prompt string');
|
||||
mesExmString = pinExmString ?? mesExamplesArray.slice(0, count_exm_add).join('');
|
||||
mesSend[mesSend.length - 1] = modifyLastPromptLine(mesSend[mesSend.length - 1]);
|
||||
|
||||
if (mesSend.length) {
|
||||
mesSend[mesSend.length - 1] = modifyLastPromptLine(mesSend[mesSend.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
function modifyLastPromptLine(lastMesString) {
|
||||
|
@ -3799,6 +3806,10 @@ async function saveReply(type, getMessage, this_mes_is_name, title) {
|
|||
type = 'normal';
|
||||
}
|
||||
|
||||
if (chat.length && typeof chat[chat.length - 1]['extra'] !== 'object') {
|
||||
chat[chat.length - 1]['extra'] = {};
|
||||
}
|
||||
|
||||
let oldMessage = ''
|
||||
const generationFinished = new Date();
|
||||
const img = extractImageFromMessage(getMessage);
|
||||
|
@ -4356,9 +4367,11 @@ function getFirstMessage() {
|
|||
const message = {
|
||||
name: name2,
|
||||
is_user: false,
|
||||
is_system: false,
|
||||
is_name: true,
|
||||
send_date: getMessageTimeStamp(),
|
||||
mes: getRegexedString(firstMes, regex_placement.AI_OUTPUT),
|
||||
extra: {},
|
||||
};
|
||||
|
||||
if (Array.isArray(alternateGreetings) && alternateGreetings.length > 0) {
|
||||
|
|
|
@ -3,6 +3,55 @@ import { waitUntilCondition } from "./utils.js";
|
|||
const storageKey = "language";
|
||||
export const localeData = await fetch("i18n.json").then(response => response.json());
|
||||
|
||||
function getMissingTranslations() {
|
||||
const missingData = [];
|
||||
|
||||
for (const language of localeData.lang) {
|
||||
$(document).find("[data-i18n]").each(function () {
|
||||
const keys = $(this).data("i18n").split(';'); // Multi-key entries are ; delimited
|
||||
for (const key of keys) {
|
||||
const attributeMatch = key.match(/\[(\S+)\](.+)/); // [attribute]key
|
||||
if (attributeMatch) { // attribute-tagged key
|
||||
const localizedValue = localeData?.[language]?.[attributeMatch[2]];
|
||||
if (!localizedValue) {
|
||||
missingData.push({ key, language, value: $(this).attr(attributeMatch[1]) });
|
||||
}
|
||||
} else { // No attribute tag, treat as 'text'
|
||||
const localizedValue = localeData?.[language]?.[key];
|
||||
if (!localizedValue) {
|
||||
missingData.push({ key, language, value: $(this).text().trim() });
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Remove duplicates
|
||||
const uniqueMissingData = [];
|
||||
for (const { key, language, value } of missingData) {
|
||||
if (!uniqueMissingData.some(x => x.key === key && x.language === language && x.value === value)) {
|
||||
uniqueMissingData.push({ key, language, value });
|
||||
}
|
||||
}
|
||||
|
||||
// Sort by language, then key
|
||||
uniqueMissingData.sort((a, b) => a.language.localeCompare(b.language) || a.key.localeCompare(b.key));
|
||||
|
||||
// Map to { language: { key: value } }
|
||||
const missingDataMap = {};
|
||||
for (const { key, language, value } of uniqueMissingData) {
|
||||
if (!missingDataMap[language]) {
|
||||
missingDataMap[language] = {};
|
||||
}
|
||||
missingDataMap[language][key] = value;
|
||||
}
|
||||
|
||||
console.table(uniqueMissingData);
|
||||
console.log(missingDataMap);
|
||||
}
|
||||
|
||||
window["getMissingTranslations"] = getMissingTranslations;
|
||||
|
||||
export function applyLocale(root = document) {
|
||||
const overrideLanguage = localStorage.getItem("language");
|
||||
var language = overrideLanguage || navigator.language || navigator.userLanguage;
|
||||
|
|
|
@ -152,6 +152,7 @@ let power_user = {
|
|||
prefer_character_prompt: true,
|
||||
prefer_character_jailbreak: true,
|
||||
quick_continue: false,
|
||||
continue_on_send: false,
|
||||
trim_spaces: true,
|
||||
relaxed_api_urls: false,
|
||||
|
||||
|
@ -708,6 +709,7 @@ function loadPowerUserSettings(settings, data) {
|
|||
|
||||
$('#relaxed_api_urls').prop("checked", power_user.relaxed_api_urls);
|
||||
$('#trim_spaces').prop("checked", power_user.trim_spaces);
|
||||
$('#continue_on_send').prop("checked", power_user.continue_on_send);
|
||||
$('#quick_continue').prop("checked", power_user.quick_continue);
|
||||
$('#mes_continue').css('display', power_user.quick_continue ? '' : 'none');
|
||||
$('#auto_swipe').prop("checked", power_user.auto_swipe);
|
||||
|
@ -1968,6 +1970,12 @@ $(document).ready(() => {
|
|||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#continue_on_send").on("input", function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.continue_on_send = value;
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
$("#quick_continue").on("input", function () {
|
||||
const value = !!$(this).prop('checked');
|
||||
power_user.quick_continue = value;
|
||||
|
|
Loading…
Reference in New Issue