ci: auto build & obfuscate [2026-04-11 18:45:22] (Jenkins #14)

This commit is contained in:
Jenkins CI
2026-04-11 18:45:22 +08:00
parent 2291a871eb
commit c50e1a9425
14 changed files with 169 additions and 29 deletions

View File

@@ -1035,8 +1035,8 @@ export function bindModalEvents() {
});
container
.off("change.amily2.text")
.on("change.amily2.text", "#amily2_api_url, #amily2_api_key, #amily2_optimization_target_tag", function () {
.off("input.amily2.text change.amily2.text")
.on("input.amily2.text change.amily2.text", "#amily2_api_url, #amily2_api_key, #amily2_optimization_target_tag", function () {
if (!pluginAuthStatus.authorized) return;
const key = snakeToCamel(this.id.replace("amily2_", ""));
// apiKey 是敏感字段,必须经 configManager 写入 localStorage
@@ -1082,6 +1082,25 @@ export function bindModalEvents() {
},
);
container
.off("input.amily2.number change.amily2.number")
.on(
"input.amily2.number change.amily2.number",
"#amily2_max_tokens, #amily2_temperature, #amily2_context_messages",
function () {
if (!pluginAuthStatus.authorized) return;
const key = snakeToCamel(this.id.replace("amily2_", ""));
const value = this.id.includes("temperature")
? parseFloat(this.value)
: parseInt(this.value, 10);
if (Number.isNaN(value)) return;
$(`#${this.id}_value`).text(value);
updateAndSaveSetting(key, value);
},
);
const promptMap = {
mainPrompt: "#amily2_main_prompt",
systemPrompt: "#amily2_system_prompt",
@@ -1103,6 +1122,14 @@ export function bindModalEvents() {
.off("change.amily2.prompt_selector")
.on("change.amily2.prompt_selector", selector, updateEditorView);
container
.off("input.amily2.unified_editor change.amily2.unified_editor")
.on("input.amily2.unified_editor change.amily2.unified_editor", editor, function () {
const selectedKey = $(selector).val();
if (!selectedKey) return;
updateAndSaveSetting(selectedKey, $(this).val());
});
container
.off("click.amily2.unified_save")
.on("click.amily2.unified_save", unifiedSaveButton, function () {
@@ -1125,8 +1152,8 @@ export function bindModalEvents() {
});
container
.off("change.amily2.lore_settings")
.on("change.amily2.lore_settings",
.off("input.amily2.lore_settings change.amily2.lore_settings")
.on("input.amily2.lore_settings change.amily2.lore_settings",
'select[id^="amily2_lore_"], input#amily2_lore_depth_input',
function () {
if (!pluginAuthStatus.authorized) return;

View File

@@ -184,6 +184,25 @@ function opt_getMergedSettings() {
return { ...globalSettings, ...characterSettings };
}
function bindInputLikeSave(element, handler) {
if (!element) return;
element.oninput = handler;
element.onchange = handler;
}
function syncModelMirror(inputElement, selectElement) {
if (!inputElement || !selectElement) return;
const value = inputElement.value || '';
if (!value) return;
let option = Array.from(selectElement.options || []).find(item => item.value === value);
if (!option) {
option = new Option(value, value, true, true);
selectElement.add(option);
}
selectElement.value = value;
}
function opt_bindSlider(panel, sliderId, displayId) {
@@ -641,14 +660,15 @@ function opt_loadSettings(panel) {
modelSelect.append(new Option('<-请先获取模型', '', true, true));
}
syncModelMirror(modelInput.get(0), modelSelect.get(0));
panel.find('#amily2_opt_max_tokens').val(settings.plotOpt_max_tokens);
panel.find('#amily2_opt_temperature').val(settings.plotOpt_temperature);
panel.find('#amily2_opt_top_p').val(settings.plotOpt_top_p);
panel.find('#amily2_opt_presence_penalty').val(settings.plotOpt_presence_penalty);
panel.find('#amily2_opt_frequency_penalty').val(settings.plotOpt_frequency_penalty);
panel.find('#amily2_opt_context_turn_count').val(settings.plotOpt_contextTurnCount);
const contextLimit = settings.plotOpt_contextLimit ?? settings.plotOpt_contextTurnCount ?? defaultSettings.plotOpt_contextLimit;
panel.find('#amily2_opt_worldbook_char_limit').val(settings.plotOpt_worldbookCharLimit);
panel.find('#amily2_opt_context_limit').val(settings.plotOpt_contextLimit);
panel.find('#amily2_opt_context_limit').val(contextLimit);
panel.find('#amily2_opt_rate_main').val(settings.plotOpt_rateMain);
panel.find('#amily2_opt_rate_personal').val(settings.plotOpt_ratePersonal);
@@ -680,7 +700,6 @@ function opt_loadSettings(panel) {
opt_bindSlider(panel, '#amily2_opt_top_p', '#amily2_opt_top_p_value');
opt_bindSlider(panel, '#amily2_opt_presence_penalty', '#amily2_opt_presence_penalty_value');
opt_bindSlider(panel, '#amily2_opt_frequency_penalty', '#amily2_opt_frequency_penalty_value');
opt_bindSlider(panel, '#amily2_opt_context_turn_count', '#amily2_opt_context_turn_count_value');
opt_bindSlider(panel, '#amily2_opt_worldbook_char_limit', '#amily2_opt_worldbook_char_limit_value');
opt_bindSlider(panel, '#amily2_opt_context_limit', '#amily2_opt_context_limit_value');
@@ -795,15 +814,22 @@ function bindConcurrentApiEvents() {
fields.forEach(field => {
const element = document.getElementById(field.id);
if (element) {
element.addEventListener('change', function() {
const saveField = function() {
if (field.sensitive) {
configManager.set(field.key, this.value);
} else {
if (!extension_settings[extensionName]) extension_settings[extensionName] = {};
extension_settings[extensionName][field.key] = this.value;
saveSettingsDebounced();
if (field.key === 'plotOpt_concurrentModel') {
syncModelMirror(
document.getElementById('amily2_plotOpt_concurrentModel'),
document.getElementById('amily2_plotOpt_concurrentModel_select')
);
}
}
});
};
bindInputLikeSave(element, saveField);
}
});
@@ -1192,6 +1218,13 @@ export function initializePlotOptimizationBindings() {
handleSettingChange(this);
});
panel.on('input.amily2_opt change.amily2_opt', '#amily2_opt_model', function() {
syncModelMirror(
panel.find('#amily2_opt_model').get(0),
panel.find('#amily2_opt_model_select').get(0)
);
});
panel.on('change.amily2_opt', '#amily2_opt_model_select', function() {
const selectedModel = $(this).val();
if (selectedModel) {
@@ -1408,13 +1441,20 @@ function bindJqyhApiEvents() {
element.value = field.sensitive
? (configManager.get(field.key) || '')
: (extension_settings[extensionName][field.key] || '');
element.addEventListener('change', function() {
const saveField = function() {
if (field.sensitive) {
configManager.set(field.key, this.value);
} else {
updateAndSaveSetting(field.key, this.value);
if (field.key === 'jqyhModel') {
syncModelMirror(
document.getElementById('amily2_jqyh_model'),
document.getElementById('amily2_jqyh_model_select')
);
}
}
});
};
bindInputLikeSave(element, saveField);
}
});

View File

@@ -198,10 +198,20 @@ export function updatePlotOptimizationUI() {
const settings = getMergedPlotOptSettings();
if (!settings) return;
const contextLimit = settings.plotOpt_contextLimit ?? settings.plotOpt_contextTurnCount ?? defaultSettings.plotOpt_contextLimit;
const worldbookCharLimit = settings.plotOpt_worldbookCharLimit ?? defaultSettings.plotOpt_worldbookCharLimit;
const worldbookEnabled = settings.plotOpt_worldbookEnabled ?? settings.plotOpt_worldbook_enabled ?? defaultSettings.plotOpt_worldbookEnabled;
let tableEnabledValue = settings.plotOpt_tableEnabled;
if (tableEnabledValue === true) {
tableEnabledValue = 'main';
} else if (tableEnabledValue === false || tableEnabledValue === undefined) {
tableEnabledValue = 'disabled';
}
$('#amily2_opt_enabled').prop('checked', settings.plotOpt_enabled);
$('#amily2_opt_ejs_enabled').prop('checked', settings.plotOpt_ejsEnabled);
$('#amily2_opt_worldbook_enabled').prop('checked', settings.plotOpt_worldbook_enabled);
$('#amily2_opt_table_enabled').prop('checked', settings.plotOpt_tableEnabled);
$('#amily2_opt_worldbook_enabled').prop('checked', worldbookEnabled);
$('#amily2_opt_table_enabled').val(tableEnabledValue);
$('#amily2_opt_main_prompt').val(settings.plotOpt_mainPrompt);
$('#amily2_opt_system_prompt').val(settings.plotOpt_systemPrompt);
@@ -213,13 +223,12 @@ export function updatePlotOptimizationUI() {
$('#amily2_opt_rate_cuckold').val(settings.plotOpt_rateCuckold);
const sliders = {
'#amily2_opt_context_limit': 'plotOpt_contextLimit',
'#amily2_opt_worldbook_char_limit': 'plotOpt_worldbookCharLimit',
'#amily2_opt_context_limit': contextLimit,
'#amily2_opt_worldbook_char_limit': worldbookCharLimit,
};
for (const sliderId in sliders) {
const key = sliders[sliderId];
const value = settings[key];
const value = sliders[sliderId];
const valueDisplayId = `${sliderId}_value`;
if (value !== undefined) {

View File

@@ -1195,6 +1195,8 @@ function bindWorldBookSettings() {
const refreshButton = document.getElementById('table_refresh_worldbooks');
const bookListContainer = document.getElementById('table_worldbook_checkbox_list');
const entryListContainer = document.getElementById('table_worldbook_entry_list');
const bookSearchInput = document.getElementById('table_worldbook_search');
const entrySearchInput = document.getElementById('table_entry_search');
if (!enabledCheckbox || !limitSlider || !limitValueSpan || !sourceRadios.length || !manualSelectWrapper || !refreshButton || !bookListContainer || !entryListContainer) {
log('无法找到世界书设置的相关UI元素绑定失败。', 'warn');
@@ -1380,6 +1382,26 @@ function bindWorldBookSettings() {
}
});
if (bookSearchInput) {
bookSearchInput.addEventListener('input', () => {
const keyword = bookSearchInput.value.trim().toLowerCase();
bookListContainer.querySelectorAll('.checkbox-item').forEach(item => {
const text = item.textContent.toLowerCase();
item.style.display = text.includes(keyword) ? '' : 'none';
});
});
}
if (entrySearchInput) {
entrySearchInput.addEventListener('input', () => {
const keyword = entrySearchInput.value.trim().toLowerCase();
entryListContainer.querySelectorAll('.checkbox-item').forEach(item => {
const text = item.textContent.toLowerCase();
item.style.display = text.includes(keyword) ? '' : 'none';
});
});
}
enabledCheckbox.dataset.eventsBound = 'true';
log('世界书设置已成功绑定。', 'success');
}