mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@@ -2333,26 +2333,6 @@
|
|||||||
koboldai_setting_names = {};
|
koboldai_setting_names = {};
|
||||||
koboldai_setting_names = arr_holder;
|
koboldai_setting_names = arr_holder;
|
||||||
|
|
||||||
// world info settings
|
|
||||||
koboldai_world_names = data.koboldai_world_names?.length ? data.koboldai_world_names : [];
|
|
||||||
|
|
||||||
if(settings.kobold_world != undefined) {
|
|
||||||
if (koboldai_world_names.includes(settings.kobold_world)) {
|
|
||||||
kobold_world = settings.kobold_world;
|
|
||||||
kobold_world_synced = false;
|
|
||||||
kobold_sync_failed = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
koboldai_world_names.forEach((item, i) => {
|
|
||||||
$('#world_info').append(`<option value='${i}'>${item}</option>`);
|
|
||||||
// preselect world if saved
|
|
||||||
if (item == kobold_world){
|
|
||||||
$('#world_info').val(i).change();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// end world info settings
|
|
||||||
|
|
||||||
preset_settings = settings.preset_settings;
|
preset_settings = settings.preset_settings;
|
||||||
|
|
||||||
temp = settings.temp;
|
temp = settings.temp;
|
||||||
@@ -2440,6 +2420,26 @@
|
|||||||
|
|
||||||
api_server = settings.api_server;
|
api_server = settings.api_server;
|
||||||
$('#api_url_text').val(api_server);
|
$('#api_url_text').val(api_server);
|
||||||
|
|
||||||
|
// world info settings
|
||||||
|
koboldai_world_names = data.koboldai_world_names?.length ? data.koboldai_world_names : [];
|
||||||
|
|
||||||
|
if(settings.kobold_world != undefined) {
|
||||||
|
if (koboldai_world_names.includes(settings.kobold_world)) {
|
||||||
|
kobold_world = settings.kobold_world;
|
||||||
|
kobold_world_synced = false;
|
||||||
|
kobold_sync_failed = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
koboldai_world_names.forEach((item, i) => {
|
||||||
|
$('#world_info').append(`<option value='${i}'>${item}</option>`);
|
||||||
|
// preselect world if saved
|
||||||
|
if (item == kobold_world) {
|
||||||
|
$('#world_info').val(i).change();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// end world info settings
|
||||||
}
|
}
|
||||||
if(!is_checked_colab) isColab();
|
if(!is_checked_colab) isColab();
|
||||||
|
|
||||||
@@ -3086,6 +3086,9 @@
|
|||||||
const value = $(this).prop('checked');
|
const value = $(this).prop('checked');
|
||||||
kobold_world_data.entries[uid].selective = value;
|
kobold_world_data.entries[uid].selective = value;
|
||||||
saveWorldInfo();
|
saveWorldInfo();
|
||||||
|
|
||||||
|
const keysecondary = $(this).closest('.world_entry').find('.keysecondary');
|
||||||
|
value ? keysecondary.show() : keysecondary.hide();
|
||||||
});
|
});
|
||||||
selectiveInput.prop('checked', entry.selective).trigger('input');
|
selectiveInput.prop('checked', entry.selective).trigger('input');
|
||||||
selectiveInput.siblings('.checkbox_fancy').click(function() {
|
selectiveInput.siblings('.checkbox_fancy').click(function() {
|
||||||
@@ -3254,6 +3257,41 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFreeWorldName() {
|
||||||
|
const MAX_FREE_NAME = 100_000;
|
||||||
|
for (let index = 1; index < MAX_FREE_NAME; index++) {
|
||||||
|
const newName = `New World (${index})`;
|
||||||
|
if (koboldai_world_names.includes(newName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return newName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createNewWorldInfo() {
|
||||||
|
const worldInfoTemplate = { folders: {}, entries: {} };
|
||||||
|
const worldInfoName = getFreeWorldName();
|
||||||
|
|
||||||
|
if (!worldInfoName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kobold_world = worldInfoName;
|
||||||
|
kobold_world_data = { ...worldInfoTemplate };
|
||||||
|
await saveWorldInfo(true);
|
||||||
|
await updateWorldInfoList();
|
||||||
|
|
||||||
|
const selectedIndex = koboldai_world_names.indexOf(worldInfoName);
|
||||||
|
if (selectedIndex !== -1) {
|
||||||
|
$('#world_info').val(selectedIndex).change();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#world_info').val('None').change();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('#world_info_edit_button').click(() => {
|
$('#world_info_edit_button').click(() => {
|
||||||
is_world_edit_open ? hideWorldEditor() : showWorldEditor();
|
is_world_edit_open ? hideWorldEditor() : showWorldEditor();
|
||||||
});
|
});
|
||||||
@@ -3282,6 +3320,10 @@
|
|||||||
$('#world_popup_name_button').click(() => {
|
$('#world_popup_name_button').click(() => {
|
||||||
renameWorldInfo();
|
renameWorldInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#world_create_button').click(() => {
|
||||||
|
createNewWorldInfo();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<title>Tavern.AI</title>
|
<title>Tavern.AI</title>
|
||||||
@@ -3378,7 +3420,7 @@
|
|||||||
</label>
|
</label>
|
||||||
<input class="text_pole" type="text" name="key" placeholder=""/>
|
<input class="text_pole" type="text" name="key" placeholder=""/>
|
||||||
</div>
|
</div>
|
||||||
<div class="world_entry_form_control">
|
<div class="world_entry_form_control keysecondary">
|
||||||
<label for="keysecondary">
|
<label for="keysecondary">
|
||||||
<h4>Secondary Key</h4>
|
<h4>Secondary Key</h4>
|
||||||
<h5>Comma-separated list of additional keywords (e.g: foo,bar).</h5>
|
<h5>Comma-separated list of additional keywords (e.g: foo,bar).</h5>
|
||||||
@@ -3581,6 +3623,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<h4 id="world_info_block">
|
<h4 id="world_info_block">
|
||||||
<span>World Info</span>
|
<span>World Info</span>
|
||||||
|
<div id="world_create_button" class="right_menu_button"><h2>+Create</h2></div>
|
||||||
<div id="world_import_button" class="right_menu_button"><h2>+Import</h2></div>
|
<div id="world_import_button" class="right_menu_button"><h2>+Import</h2></div>
|
||||||
</h4>
|
</h4>
|
||||||
<h5>How to use (<a href="/notes/13" target="_blank">?</a>)</h5>
|
<h5>How to use (<a href="/notes/13" target="_blank">?</a>)</h5>
|
||||||
|
@@ -983,14 +983,14 @@ input[type=button] {
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
#world_import_button {
|
#world_import_button, #world_create_button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#world_import_button h2 {
|
#world_import_button h2, #world_create_button h2 {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
margin-bottom: auto;
|
margin-bottom: auto;
|
||||||
margin-left: 1rem;
|
margin-left: 1rem;
|
||||||
|
@@ -1377,7 +1377,7 @@ function isEntryOutOfSync(tavernEntry, koboldEntry) {
|
|||||||
tavernEntry.selective !== koboldEntry.selective ||
|
tavernEntry.selective !== koboldEntry.selective ||
|
||||||
tavernEntry.constant !== koboldEntry.constant ||
|
tavernEntry.constant !== koboldEntry.constant ||
|
||||||
tavernEntry.key.join(',') !== koboldEntry.key ||
|
tavernEntry.key.join(',') !== koboldEntry.key ||
|
||||||
tavernEntry.keysecondary.join(',') !== koboldEntry.keysecondary;
|
(koboldEntry.selective ? tavernEntry.keysecondary.join(',') !== koboldEntry.keysecondary : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ** REST CLIENT ASYNC WRAPPERS **
|
// ** REST CLIENT ASYNC WRAPPERS **
|
||||||
|
Reference in New Issue
Block a user