@@ -12,7 +12,7 @@ Current version indicated by LITEVER below.
1212-->
1313
1414<script id="init-config">
15- const LITEVER = 300 ;
15+ const LITEVER = 301 ;
1616 const urlParams = new URLSearchParams(window.location.search);
1717 var localflag = urlParams.get('local'); //this will be replaced automatically in embedded kcpp
1818 const STORAGE_PREFIX = (localflag?"e_":"")+"kaihordewebui_";
@@ -3744,7 +3744,7 @@ Current version indicated by LITEVER below.
37443744 saved_palm_jailbreak:"", //gemini system prompt
37453745 saved_palm_jailbreak2:"", //gemini postfix
37463746 saved_openrouter_provider:"", //for overriding provider
3747- saved_openrouter_reasoning:0 , //enable or disable openrouter thinking, 0=default, 1=disable, 2=enable
3747+ saved_oai_reasoning:"" , //if set, reasoning level "none,minimal,low,medium,high", else default
37483748 saved_oai_custommodel: "", //customized oai custom model
37493749 saved_oai_role: 3, //0=user,1=assistant,2=system, 3=auto
37503750 saved_a1111_url: default_a1111_base,
@@ -11822,6 +11822,7 @@ Current version indicated by LITEVER below.
1182211822 document.getElementById("oaidesc").classList.add("hidden");
1182311823 document.getElementById("pollinationsdesc").classList.add("hidden");
1182411824 document.getElementById("openrouterproviderbox").classList.add("hidden");
11825+ document.getElementById("oaireasoningeffort").value = localsettings.saved_oai_reasoning;
1182511826 if(epchoice==2)
1182611827 {
1182711828 document.getElementById("oaidesc").classList.remove("hidden");
@@ -11841,7 +11842,6 @@ Current version indicated by LITEVER below.
1184111842 document.getElementById("openrouterproviderbox").classList.remove("hidden");
1184211843 document.getElementById("custom_oai_endpoint").value = default_openrouter_base;
1184311844 document.getElementById("openrouterproviders").value = localsettings.saved_openrouter_provider;
11844- document.getElementById("openrouterreasoning").value = localsettings.saved_openrouter_reasoning;
1184511845 document.getElementById("custom_oai_key").value =(localsettings.saved_openrouter_key==dummy_api_key?"":localsettings.saved_openrouter_key);
1184611846 try_fetch_oai_models_auto();
1184711847 }
@@ -12417,8 +12417,8 @@ Current version indicated by LITEVER below.
1241712417 {
1241812418 localsettings.saved_openrouter_key = custom_oai_key;
1241912419 localsettings.saved_openrouter_provider = document.getElementById("openrouterproviders").value;
12420- localsettings.saved_openrouter_reasoning = document.getElementById("openrouterreasoning").value;
1242112420 }
12421+ localsettings.saved_oai_reasoning = document.getElementById("oaireasoningeffort").value;
1242212422 localsettings.saved_oai_jailbreak = document.getElementById("jailbreakprompttext").value;
1242312423 if(localsettings.saved_oai_jailbreak=="")
1242412424 {
@@ -16169,7 +16169,7 @@ Current version indicated by LITEVER below.
1616916169 {
1617016170 image_db[imgid].aspect = 2; //landscape
1617116171 }
16172- }, false, imgres,0.35 ,true);
16172+ }, false, imgres,0.45 ,true);
1617316173 }
1617416174
1617516175 function self_upload_audio(origAudio,filename,modify_curr_turn=false)
@@ -18438,13 +18438,13 @@ Current version indicated by LITEVER below.
1843818438 }
1843918439 }
1844018440
18441- if (document.getElementById("useoaichatcompl").checked) {
18442-
18443- // let reasoneffort = document.getElementById("oaireasoningeffort").value;
18444- // if(reasoneffort && reasoneffort!="none ")
18445- // {
18446- // oai_payload.reasoning_effort = reasoneffort;
18447- // }
18441+ if (document.getElementById("useoaichatcompl").checked)
18442+ {
18443+ let reasoneffort = document.getElementById("oaireasoningeffort").value;
18444+ if(reasoneffort && reasoneffort!="")
18445+ {
18446+ oai_payload.reasoning_effort = reasoneffort;
18447+ }
1844818448
1844918449 let mainoaibody = submit_payload.prompt; //can be string or array
1845018450 if(insertAIVisionImages.length>0 || insertAIAudioSounds.length>0)
@@ -18620,10 +18620,15 @@ Current version indicated by LITEVER below.
1862018620 "allow_fallbacks": false, //always explicitly selected
1862118621 };
1862218622 }
18623- let reasonselect = document.getElementById("openrouterreasoning").value;
18624- if(reasonselect!=0)
18623+
18624+ if(oai_payload.reasoning_effort && oai_payload.reasoning_effort!="") //adapt reasoning effort for openrouter
1862518625 {
18626- oai_payload.reasoning = {"enabled":(reasonselect==2?true:false)};
18626+ oai_payload.reasoning = {"enabled":(oai_payload.reasoning_effort=="none"?false:true)};
18627+ if(oai_payload.reasoning_effort!="none")
18628+ {
18629+ oai_payload.reasoning.effort = oai_payload.reasoning_effort;
18630+ }
18631+ delete oai_payload["reasoning_effort"];
1862718632 }
1862818633 }
1862918634
@@ -20508,7 +20513,7 @@ Current version indicated by LITEVER below.
2050820513 }
2050920514 }
2051020515
20511- function compressImage(inputDataUri, onDone, fixedSize=true, maxSize=NO_HD_RES_PX, quality = 0.35 , letterboxAspect=false) {
20516+ function compressImage(inputDataUri, onDone, fixedSize=true, maxSize=NO_HD_RES_PX, quality = 0.45 , letterboxAspect=false) {
2051220517 let img = document.createElement('img');
2051320518 let wantedWidth = maxSize;
2051420519 let wantedHeight = maxSize;
@@ -25241,7 +25246,7 @@ Current version indicated by LITEVER below.
2524125246 newbodystr += ` style='flex: 1; display:flex; padding: ${as.padding()}; margin: ${as.margin()}; min-height:${as.background_minHeight}px;`
2524225247 + ` font-size: ${as.font_size}px; flex-direction:column; align-items: ${as.centerHorizontally ? 'center' : 'flex-start'};`
2524325248 + ` justify-content: center; border-radius: ${as.rounded_bubbles ? '15px' : '0px'}'>`
25244- + `<span >${namepart}${curr.msg}</span ></div></div>`;
25249+ + `<div >${namepart}${curr.msg}</div ></div></div>`;
2524525250 }
2524625251
2524725252 return portraitsStyling + newbodystr.replaceAll(/(\r\n|\r|\n)/g,'<br>'); // Finally, convert newlines to HTML format and return the stylized string.
@@ -28228,12 +28233,14 @@ Current version indicated by LITEVER below.
2822828233 <div class="box-label" style="padding:4px" title="Add Prefix. Forcefully inserts extra text at the start of the prompt to steer the AI.">Add Prefix</div>
2822928234 <input type="checkbox" title="Add Postfix Prompt" id="jailbreakprompt2" onchange="togglejailbreak2()">
2823028235 <div class="box-label" style="padding:4px" title="Add Postfix. Forcefully inserts extra text to before the AI response to steer the AI.">Add Postfix</div>
28231- <!-- <select title="Reasoning Effort" class="form-control" style="height: 22px; font-size:10px; padding:2px;display:inline;width:120px" id="oaireasoningeffort">
28232- <option value="none" selected>Reasoning: Unset</option>
28236+ <select title="Reasoning Effort" class="form-control" style="height: 22px; font-size:10px; padding:2px;display:inline;width:120px" id="oaireasoningeffort">
28237+ <option value="" selected>Reasoning: Default</option>
28238+ <option value="none">Reasoning: None</option>
28239+ <option value="minimal">Reasoning: Minimal</option>
2823328240 <option value="low">Reasoning: Low</option>
2823428241 <option value="medium">Reasoning: Medium</option>
2823528242 <option value="high">Reasoning: High</option>
28236- </select> -->
28243+ </select>
2823728244 </div>
2823828245 <div style="display:flex" id="oaijailbreakpromptblock1">
2823928246 <select title="Injected Prefix Message Role" class="form-control" style="height: 25px; font-size:12px; padding:4px;display:inline;width:100px" id="jailbreakprompttextrole">
@@ -28256,15 +28263,7 @@ Current version indicated by LITEVER below.
2825628263 </div>
2825728264 </div>
2825828265 <div id="openrouterproviderbox" class="hidden">
28259- <div style="display:inline;">Prefer Provider: <input title="Enter Preferred AI Provider" style="height: 25px; font-size:12px;padding:4px;display:inline;width:calc(100% - 256px)" class="form-control" type="text" id="openrouterproviders" placeholder="(Automatic)" value=""></div>
28260- <div id="openrouterreasoningbox" style="display:inline;">
28261- <div style="padding-left:2px;padding-right:2px" class="box-label">Thinking</div>
28262- <select title="Thinking Settings" class="form-control" style="height: 25px; font-size:12px; margin-bottom: 2px; padding:3px;display:inline;width:72px" id="openrouterreasoning">
28263- <option value="0" selected>Default</option>
28264- <option value="1">Disable</option>
28265- <option value="2">Enable</option>
28266- </select>
28267- </div>
28266+ <div style="display:inline;">Prefer Provider: <input title="Enter Preferred AI Provider" style="height: 25px; font-size:12px;padding:4px;display:inline;width:calc(100% - 110px)" class="form-control" type="text" id="openrouterproviders" placeholder="(Automatic)" value=""></div>
2826828267 </div>
2826928268
2827028269 </div>
0 commit comments