Unify the display of novel streaming checkbox

11751d3893793b551179c96fd0de6fe1c05151d2

Cohee <18619528+Cohee1207@users.noreply.github.com>

2 files changed, +33 -40Ignore whitespace
public/index.html+26 -29
@@ -218,22 +218,6 @@
218218 </div>
219219 </div>
220220 </div>
221- <div id="ai_module_block_novel" class="width100p">
222- <div class="range-block">
223- <div class="range-block-title justifyLeft" data-i18n="AI Module">
224- AI Module
225- </div>
226- <div class="toggle-description justifyLeft" data-i18n="Changes the style of the generated text.">
227- Changes the style of the generated text.
228- </div>
229- <select id="nai_prefix">
230- <option value="vanilla" data-i18n="No Module">No Module</option>
231- <option value="special_instruct" data-i18n="Instruct">Instruct</option>
232- <option value="special_proseaugmenter" data-i18n="Prose Augmenter">Prose Augmenter</option>
233- <option value="theme_textadventure" data-i18n="Text Adventure">Text Adventure</option>
234- </select>
235- </div>
236- </div>
237221 <div id="common-gen-settings-block" class="width100p">
238222 <div id="pro-settings-block" class="flex-container gap10h5v justifyCenter">
239223 <div id="amount_gen_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
@@ -258,6 +242,14 @@
258242 </small>
259243 </label>
260244 </div>
245+ <div id="streaming_novel_block" class="flex-container alignitemscenter justifyCenter marginTop5">
246+ <label class="checkbox_label" for="streaming_novel">
247+ <input type="checkbox" id="streaming_novel" />
248+ <small><span data-i18n="Streaming">Streaming</span>
249+ <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>
250+ </small>
251+ </label>
252+ </div>
261253 </div>
262254 <div id="max_context_block" class="alignitemscenter flex-container marginBot5 flexFlowColumn flexBasis48p flexGrow flexShrink gap0">
263255 <small data-i18n="context size(tokens)">Context (tokens)</small>
@@ -278,6 +270,22 @@
278270 <span data-i18n="Max prompt cost:">Max prompt cost:</span> <span id="or_prompt_cost">&ndash;</span>
279271 </small>
280272 </div>
273+ <div id="ai_module_block_novel" class="width100p">
274+ <div class="range-block">
275+ <div class="range-block-title justifyLeft" data-i18n="AI Module">
276+ AI Module
277+ </div>
278+ <div class="toggle-description justifyLeft" data-i18n="Changes the style of the generated text.">
279+ Changes the style of the generated text.
280+ </div>
281+ <select id="nai_prefix">
282+ <option value="vanilla" data-i18n="No Module">No Module</option>
283+ <option value="special_instruct" data-i18n="Instruct">Instruct</option>
284+ <option value="special_proseaugmenter" data-i18n="Prose Augmenter">Prose Augmenter</option>
285+ <option value="theme_textadventure" data-i18n="Text Adventure">Text Adventure</option>
286+ </select>
287+ </div>
288+ </div>
281289 <hr>
282290 </div>
283291 <div id="respective-ranges-and-temps" class="width100p">
@@ -287,19 +295,6 @@
287295 -->
288296 <div id="range_block_novel">
289297 <div class="range-block">
290- <label class="checkbox_label widthFreeExpand">
291- <input id="streaming_novel" type="checkbox" />
292- <span data-i18n="Streaming">Streaming</span>
293- </label>
294- <div class="toggle-description justifyLeft">
295- <span data-i18n="Display the response bit by bit as it is generated.">
296- Display the response bit by bit as it is generated.</span><br>
297- <span data-i18n="When this is off, responses will be displayed all at once when they are complete.">
298- When this is off, responses will be displayed all at once when they are complete.
299- </span>
300- </div>
301- </div>
302- <div class="range-block">
303298 <div class="range-block-title" data-i18n="Temperature">
304299 Temperature
305300 </div>
@@ -5160,6 +5155,8 @@
51605155 </div>
51615156 <!-- various fullscreen popups -->
51625157 <div name="templatesAndPopupsWrapper"> <!--this div is just for IDE sanity for quick collapsing-->
5158+ <!-- Point to this element when you need a no-op selector -->
5159+ <template id="NULL_SELECTOR" class="displayNone"></template>
51635160 <div id="export_format_popup" class="list-group">
51645161 <div class="export_format list-group-item" data-format="png">PNG</div>
51655162 <div class="export_format list-group-item" data-format="json">JSON</div>
public/script.js+7 -11
@@ -6360,6 +6360,7 @@ export function changeMainAPI() {
63606360 //console.log(selectedVal);
63616361 const apiElements = {
63626362 'koboldhorde': {
6363+ apiStreaming: $('#NULL_SELECTOR'),
63636364 apiSettings: $('#kobold_api-settings'),
63646365 apiConnector: $('#kobold_horde'),
63656366 apiPresets: $('#kobold_api-presets'),
@@ -6368,6 +6369,7 @@ export function changeMainAPI() {
63686369 amountGenElem: $('#amount_gen_block'),
63696370 },
63706371 'kobold': {
6372+ apiStreaming: $('#streaming_kobold_block'),
63716373 apiSettings: $('#kobold_api-settings'),
63726374 apiConnector: $('#kobold_api'),
63736375 apiPresets: $('#kobold_api-presets'),
@@ -6376,6 +6378,7 @@ export function changeMainAPI() {
63766378 amountGenElem: $('#amount_gen_block'),
63776379 },
63786380 'textgenerationwebui': {
6381+ apiStreaming: $('#streaming_textgenerationwebui_block'),
63796382 apiSettings: $('#textgenerationwebui_api-settings'),
63806383 apiConnector: $('#textgenerationwebui_api'),
63816384 apiPresets: $('#textgenerationwebui_api-presets'),
@@ -6384,6 +6387,7 @@ export function changeMainAPI() {
63846387 amountGenElem: $('#amount_gen_block'),
63856388 },
63866389 'novel': {
6390+ apiStreaming: $('#streaming_novel_block'),
63876391 apiSettings: $('#novel_api-settings'),
63886392 apiConnector: $('#novel_api'),
63896393 apiPresets: $('#novel_api-presets'),
@@ -6392,6 +6396,7 @@ export function changeMainAPI() {
63926396 amountGenElem: $('#amount_gen_block'),
63936397 },
63946398 'openai': {
6399+ apiStreaming: $('#NULL_SELECTOR'),
63956400 apiSettings: $('#openai_settings'),
63966401 apiConnector: $('#openai_api'),
63976402 apiPresets: $('#openai_api-presets'),
@@ -6414,12 +6419,14 @@ export function changeMainAPI() {
64146419 apiObj.apiConnector.css('display', 'none');
64156420 apiObj.apiRanges.css('display', 'none');
64166421 apiObj.apiPresets.css('display', 'none');
6422+ apiObj.apiStreaming.css('display', 'none');
64176423 }
64186424
64196425 //then, find and enable the active item.
64206426 //This is split out of the loop so that different apis can share settings divs
64216427 let activeItem = apiElements[selectedVal];
64226428
6429+ activeItem.apiStreaming.css('display', 'block');
64236430 activeItem.apiSettings.css('display', 'block');
64246431 activeItem.apiConnector.css('display', 'block');
64256432 activeItem.apiRanges.css('display', 'block');
@@ -6436,17 +6443,6 @@ export function changeMainAPI() {
64366443 }
64376444
64386445 //custom because streaming has been moved up under response tokens, which exists inside common settings block
6439- if (selectedVal === 'textgenerationwebui') {
6440- $('#streaming_textgenerationwebui_block').css('display', 'block');
6441- } else {
6442- $('#streaming_textgenerationwebui_block').css('display', 'none');
6443- }
6444- if (selectedVal === 'kobold') {
6445- $('#streaming_kobold_block').css('display', 'block');
6446- } else {
6447- $('#streaming_kobold_block').css('display', 'none');
6448- }
6449-
64506446 if (selectedVal === 'novel') {
64516447 $('#ai_module_block_novel').css('display', 'block');
64526448 } else {