mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-20 14:10:39 +01:00
Apply preset manager for NovelAI
This commit is contained in:
parent
81ed4d8431
commit
1f2394cada
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@ public/css/bg_load.css
|
|||||||
public/themes/
|
public/themes/
|
||||||
public/OpenAI Settings/
|
public/OpenAI Settings/
|
||||||
public/KoboldAI Settings/
|
public/KoboldAI Settings/
|
||||||
|
public/NovelAI Settings/
|
||||||
public/TextGen Settings/
|
public/TextGen Settings/
|
||||||
public/scripts/extensions/third-party/
|
public/scripts/extensions/third-party/
|
||||||
public/stats.json
|
public/stats.json
|
||||||
|
@ -160,9 +160,16 @@
|
|||||||
<span class="note-link-span">?</span>
|
<span class="note-link-span">?</span>
|
||||||
</a>
|
</a>
|
||||||
</h3>
|
</h3>
|
||||||
<select id="settings_perset_novel" data-preset-manager-for="novel">
|
<div class="preset_buttons">
|
||||||
<option value="gui" data-i18n="default">Default</option>
|
<select id="settings_perset_novel" data-preset-manager-for="novel">
|
||||||
</select>
|
<option value="gui" data-i18n="default">Default</option>
|
||||||
|
</select>
|
||||||
|
<i data-preset-manager-update="novel" class="menu_button fa-solid fa-save" title="Update current preset" data-i18n="[title]Update current preset"></i>
|
||||||
|
<i data-preset-manager-new="novel" class="menu_button fa-solid fa-plus" title="Create new preset" data-i18n="[title]Create new preset"></i>
|
||||||
|
<i data-preset-manager-import="novel" class="menu_button fa-solid fa-upload" title="Import preset" data-i18n="[title]Import preset"></i>
|
||||||
|
<i data-preset-manager-export="novel" class="menu_button fa-solid fa-download" title="Export preset" data-i18n="[title]Export preset"></i>
|
||||||
|
<i data-preset-manager-delete="novel" class="menu_button fa-solid fa-trash-can" title="Delete the preset" data-i18n="[title]Delete the preset"></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="openai_api-presets">
|
<div id="openai_api-presets">
|
||||||
<div>
|
<div>
|
||||||
|
@ -2,11 +2,13 @@ import {
|
|||||||
getRequestHeaders,
|
getRequestHeaders,
|
||||||
getStoppingStrings,
|
getStoppingStrings,
|
||||||
getTextTokens,
|
getTextTokens,
|
||||||
|
max_context,
|
||||||
novelai_setting_names,
|
novelai_setting_names,
|
||||||
saveSettingsDebounced
|
saveSettingsDebounced,
|
||||||
|
setGenerationParamsFromPreset
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { getCfg } from "./extensions/cfg/util.js";
|
import { getCfg } from "./extensions/cfg/util.js";
|
||||||
import { tokenizers } from "./power-user.js";
|
import { MAX_CONTEXT_DEFAULT, tokenizers } from "./power-user.js";
|
||||||
import { getStringHash } from "./utils.js";
|
import { getStringHash } from "./utils.js";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@ -81,16 +83,17 @@ function getNovelTier(tier) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadNovelPreset(preset) {
|
function loadNovelPreset(preset) {
|
||||||
$("#amount_gen").val(preset.max_length);
|
if (preset.genamt === undefined) {
|
||||||
$("#amount_gen_counter").text(`${preset.max_length}`);
|
const needsUnlock = preset.max_context > MAX_CONTEXT_DEFAULT;
|
||||||
if (((preset.max_context > 2048) && (!$("#max_context_unlocked")[0].checked)) ||
|
$("#amount_gen").val(preset.max_length).trigger('input');
|
||||||
((preset.max_context <= 2048) && ($("#max_context_unlocked")[0].checked))) {
|
$('#max_context_unlocked').prop('checked', needsUnlock).trigger('change');
|
||||||
$("#max_context_unlocked").click();
|
$("#max_context").val(preset.max_context).trigger('input');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setGenerationParamsFromPreset(preset);
|
||||||
}
|
}
|
||||||
$("#max_context").val(preset.max_context);
|
|
||||||
$("#max_context_counter").text(`${preset.max_context}`);
|
|
||||||
$("#rep_pen_size_novel").attr('max', preset.max_context);
|
|
||||||
|
|
||||||
|
$("#rep_pen_size_novel").attr('max', max_context);
|
||||||
nai_settings.temperature = preset.temperature;
|
nai_settings.temperature = preset.temperature;
|
||||||
nai_settings.repetition_penalty = preset.repetition_penalty;
|
nai_settings.repetition_penalty = preset.repetition_penalty;
|
||||||
nai_settings.repetition_penalty_range = preset.repetition_penalty_range;
|
nai_settings.repetition_penalty_range = preset.repetition_penalty_range;
|
||||||
|
@ -116,6 +116,12 @@ class PresetManager {
|
|||||||
<h3>Preset name:</h3>
|
<h3>Preset name:</h3>
|
||||||
<h4>Hint: Use a character/group name to bind preset to a specific chat.</h4>`;
|
<h4>Hint: Use a character/group name to bind preset to a specific chat.</h4>`;
|
||||||
const name = await callPopup(popupText, "input");
|
const name = await callPopup(popupText, "input");
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
console.log('Preset name not provided');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await this.savePreset(name);
|
await this.savePreset(name);
|
||||||
toastr.success('Preset saved');
|
toastr.success('Preset saved');
|
||||||
}
|
}
|
||||||
@ -214,7 +220,17 @@ class PresetManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredKeys = ['preset', 'streaming_url', 'stopping_strings', 'use_stop_sequence'];
|
const filteredKeys = [
|
||||||
|
'preset',
|
||||||
|
'streaming_url',
|
||||||
|
'stopping_strings',
|
||||||
|
'use_stop_sequence',
|
||||||
|
'preset_settings_novel',
|
||||||
|
'streaming_novel',
|
||||||
|
'nai_preamble',
|
||||||
|
'model_novel',
|
||||||
|
'preamble',
|
||||||
|
];
|
||||||
const settings = Object.assign({}, getSettingsByApiId(this.apiId));
|
const settings = Object.assign({}, getSettingsByApiId(this.apiId));
|
||||||
|
|
||||||
for (const key of filteredKeys) {
|
for (const key of filteredKeys) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user