Unify the display of novel streaming checkbox

This commit is contained in:
Cohee 2024-10-13 22:38:14 +03:00
parent b077b157dc
commit 11751d3893
2 changed files with 33 additions and 40 deletions

View File

@ -218,22 +218,6 @@
</div> </div>
</div> </div>
</div> </div>
<div id="ai_module_block_novel" class="width100p">
<div class="range-block">
<div class="range-block-title justifyLeft" data-i18n="AI Module">
AI Module
</div>
<div class="toggle-description justifyLeft" data-i18n="Changes the style of the generated text.">
Changes the style of the generated text.
</div>
<select id="nai_prefix">
<option value="vanilla" data-i18n="No Module">No Module</option>
<option value="special_instruct" data-i18n="Instruct">Instruct</option>
<option value="special_proseaugmenter" data-i18n="Prose Augmenter">Prose Augmenter</option>
<option value="theme_textadventure" data-i18n="Text Adventure">Text Adventure</option>
</select>
</div>
</div>
<div id="common-gen-settings-block" class="width100p"> <div id="common-gen-settings-block" class="width100p">
<div id="pro-settings-block" class="flex-container gap10h5v justifyCenter"> <div id="pro-settings-block" class="flex-container gap10h5v justifyCenter">
<div id="amount_gen_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div id="amount_gen_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
@ -258,6 +242,14 @@
</small> </small>
</label> </label>
</div> </div>
<div id="streaming_novel_block" class="flex-container alignitemscenter justifyCenter marginTop5">
<label class="checkbox_label" for="streaming_novel">
<input type="checkbox" id="streaming_novel" />
<small><span data-i18n="Streaming">Streaming</span>
<div class="margin5 fa-solid fa-circle-info opacity50p" data-i18n="[title]Streaming_desc" title="Display the response bit by bit as it is generated.&#13;When this is off, responses will be displayed all at once when they are complete."></div>
</small>
</label>
</div>
</div> </div>
<div id="max_context_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0"> <div id="max_context_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
<small data-i18n="context size(tokens)">Context (tokens)</small> <small data-i18n="context size(tokens)">Context (tokens)</small>
@ -278,6 +270,22 @@
<span data-i18n="Max prompt cost:">Max prompt cost:</span> <span id="or_prompt_cost">&ndash;</span> <span data-i18n="Max prompt cost:">Max prompt cost:</span> <span id="or_prompt_cost">&ndash;</span>
</small> </small>
</div> </div>
<div id="ai_module_block_novel" class="width100p">
<div class="range-block">
<div class="range-block-title justifyLeft" data-i18n="AI Module">
AI Module
</div>
<div class="toggle-description justifyLeft" data-i18n="Changes the style of the generated text.">
Changes the style of the generated text.
</div>
<select id="nai_prefix">
<option value="vanilla" data-i18n="No Module">No Module</option>
<option value="special_instruct" data-i18n="Instruct">Instruct</option>
<option value="special_proseaugmenter" data-i18n="Prose Augmenter">Prose Augmenter</option>
<option value="theme_textadventure" data-i18n="Text Adventure">Text Adventure</option>
</select>
</div>
</div>
<hr> <hr>
</div> </div>
<div id="respective-ranges-and-temps" class="width100p"> <div id="respective-ranges-and-temps" class="width100p">
@ -286,19 +294,6 @@
</div> </div>
--> -->
<div id="range_block_novel"> <div id="range_block_novel">
<div class="range-block">
<label class="checkbox_label widthFreeExpand">
<input id="streaming_novel" type="checkbox" />
<span data-i18n="Streaming">Streaming</span>
</label>
<div class="toggle-description justifyLeft">
<span data-i18n="Display the response bit by bit as it is generated.">
Display the response bit by bit as it is generated.</span><br>
<span data-i18n="When this is off, responses will be displayed all at once when they are complete.">
When this is off, responses will be displayed all at once when they are complete.
</span>
</div>
</div>
<div class="range-block"> <div class="range-block">
<div class="range-block-title" data-i18n="Temperature"> <div class="range-block-title" data-i18n="Temperature">
Temperature Temperature
@ -5160,6 +5155,8 @@
</div> </div>
<!-- various fullscreen popups --> <!-- various fullscreen popups -->
<div name="templatesAndPopupsWrapper"> <!--this div is just for IDE sanity for quick collapsing--> <div name="templatesAndPopupsWrapper"> <!--this div is just for IDE sanity for quick collapsing-->
<!-- Point to this element when you need a no-op selector -->
<template id="NULL_SELECTOR" class="displayNone"></template>
<div id="export_format_popup" class="list-group"> <div id="export_format_popup" class="list-group">
<div class="export_format list-group-item" data-format="png">PNG</div> <div class="export_format list-group-item" data-format="png">PNG</div>
<div class="export_format list-group-item" data-format="json">JSON</div> <div class="export_format list-group-item" data-format="json">JSON</div>

View File

@ -6360,6 +6360,7 @@ export function changeMainAPI() {
//console.log(selectedVal); //console.log(selectedVal);
const apiElements = { const apiElements = {
'koboldhorde': { 'koboldhorde': {
apiStreaming: $('#NULL_SELECTOR'),
apiSettings: $('#kobold_api-settings'), apiSettings: $('#kobold_api-settings'),
apiConnector: $('#kobold_horde'), apiConnector: $('#kobold_horde'),
apiPresets: $('#kobold_api-presets'), apiPresets: $('#kobold_api-presets'),
@ -6368,6 +6369,7 @@ export function changeMainAPI() {
amountGenElem: $('#amount_gen_block'), amountGenElem: $('#amount_gen_block'),
}, },
'kobold': { 'kobold': {
apiStreaming: $('#streaming_kobold_block'),
apiSettings: $('#kobold_api-settings'), apiSettings: $('#kobold_api-settings'),
apiConnector: $('#kobold_api'), apiConnector: $('#kobold_api'),
apiPresets: $('#kobold_api-presets'), apiPresets: $('#kobold_api-presets'),
@ -6376,6 +6378,7 @@ export function changeMainAPI() {
amountGenElem: $('#amount_gen_block'), amountGenElem: $('#amount_gen_block'),
}, },
'textgenerationwebui': { 'textgenerationwebui': {
apiStreaming: $('#streaming_textgenerationwebui_block'),
apiSettings: $('#textgenerationwebui_api-settings'), apiSettings: $('#textgenerationwebui_api-settings'),
apiConnector: $('#textgenerationwebui_api'), apiConnector: $('#textgenerationwebui_api'),
apiPresets: $('#textgenerationwebui_api-presets'), apiPresets: $('#textgenerationwebui_api-presets'),
@ -6384,6 +6387,7 @@ export function changeMainAPI() {
amountGenElem: $('#amount_gen_block'), amountGenElem: $('#amount_gen_block'),
}, },
'novel': { 'novel': {
apiStreaming: $('#streaming_novel_block'),
apiSettings: $('#novel_api-settings'), apiSettings: $('#novel_api-settings'),
apiConnector: $('#novel_api'), apiConnector: $('#novel_api'),
apiPresets: $('#novel_api-presets'), apiPresets: $('#novel_api-presets'),
@ -6392,6 +6396,7 @@ export function changeMainAPI() {
amountGenElem: $('#amount_gen_block'), amountGenElem: $('#amount_gen_block'),
}, },
'openai': { 'openai': {
apiStreaming: $('#NULL_SELECTOR'),
apiSettings: $('#openai_settings'), apiSettings: $('#openai_settings'),
apiConnector: $('#openai_api'), apiConnector: $('#openai_api'),
apiPresets: $('#openai_api-presets'), apiPresets: $('#openai_api-presets'),
@ -6414,12 +6419,14 @@ export function changeMainAPI() {
apiObj.apiConnector.css('display', 'none'); apiObj.apiConnector.css('display', 'none');
apiObj.apiRanges.css('display', 'none'); apiObj.apiRanges.css('display', 'none');
apiObj.apiPresets.css('display', 'none'); apiObj.apiPresets.css('display', 'none');
apiObj.apiStreaming.css('display', 'none');
} }
//then, find and enable the active item. //then, find and enable the active item.
//This is split out of the loop so that different apis can share settings divs //This is split out of the loop so that different apis can share settings divs
let activeItem = apiElements[selectedVal]; let activeItem = apiElements[selectedVal];
activeItem.apiStreaming.css('display', 'block');
activeItem.apiSettings.css('display', 'block'); activeItem.apiSettings.css('display', 'block');
activeItem.apiConnector.css('display', 'block'); activeItem.apiConnector.css('display', 'block');
activeItem.apiRanges.css('display', 'block'); activeItem.apiRanges.css('display', 'block');
@ -6436,17 +6443,6 @@ export function changeMainAPI() {
} }
//custom because streaming has been moved up under response tokens, which exists inside common settings block //custom because streaming has been moved up under response tokens, which exists inside common settings block
if (selectedVal === 'textgenerationwebui') {
$('#streaming_textgenerationwebui_block').css('display', 'block');
} else {
$('#streaming_textgenerationwebui_block').css('display', 'none');
}
if (selectedVal === 'kobold') {
$('#streaming_kobold_block').css('display', 'block');
} else {
$('#streaming_kobold_block').css('display', 'none');
}
if (selectedVal === 'novel') { if (selectedVal === 'novel') {
$('#ai_module_block_novel').css('display', 'block'); $('#ai_module_block_novel').css('display', 'block');
} else { } else {