@@ -3198,7 +3198,7 @@ Current version indicated by LITEVER below.
31983198 var synchro_polled_response = null;
31993199 var last_stop_reason = ""; //update stop reason if known
32003200 var synchro_pending_stream = ""; //used for storing incomplete streaming text
3201- var gemini_was_thinking = false; //used as a switch to determine when thinking ends, to wrap output in tags
3201+ var streaming_was_thinking = false; //used as a switch to determine when thinking ends, to wrap output in tags
32023202 var waiting_for_tool_call = 0; //0=not waiting, 1=autosummary, 2=websearchsummary
32033203 var oaiemulatecompletionscontent = "";
32043204 var italics_regex = new RegExp(/\*(\S[^*]+\S)\*/g); //the fallback regex
@@ -5712,7 +5712,7 @@ Current version indicated by LITEVER below.
57125712 function oai_api_stream_sse(sub_endpt,submit_payload,submit_headers)
57135713 {
57145714 synchro_pending_stream = "";
5715- gemini_was_thinking = false;
5715+ streaming_was_thinking = false;
57165716 let reqOpt =
57175717 {method: 'POST',
57185718 headers: submit_headers,
@@ -5778,16 +5778,16 @@ Current version indicated by LITEVER below.
57785778 {
57795779 if(event.data.candidates[0].content.parts[x].thought)
57805780 {
5781- gemini_was_thinking = true;
5781+ streaming_was_thinking = true;
57825782 }
57835783 if(!event.data.candidates[0].content.parts[x].text)
57845784 {
57855785 continue;
57865786 }
5787- if(!event.data.candidates[0].content.parts[x].thought && gemini_was_thinking )
5787+ if(!event.data.candidates[0].content.parts[x].thought && streaming_was_thinking )
57885788 {
57895789 synchro_pending_stream = `${localsettings.start_thinking_tag}${synchro_pending_stream}${localsettings.stop_thinking_tag}`;
5790- gemini_was_thinking = false;
5790+ streaming_was_thinking = false;
57915791 }
57925792 synchro_pending_stream += event.data.candidates[0].content.parts[x].text;
57935793 }
@@ -5800,11 +5800,19 @@ Current version indicated by LITEVER below.
58005800 if(event.data.choices[0].text)
58015801 {
58025802 synchro_pending_stream += event.data.choices[0].text;
5803- }else if(event.data.choices[0].delta && event.data.choices[0].delta.content)
5803+ }
5804+ else if(event.data.choices[0].delta && event.data.choices[0].delta.content)
58045805 {
5806+ if(streaming_was_thinking)
5807+ {
5808+ streaming_was_thinking = false;
5809+ synchro_pending_stream = `${localsettings.start_thinking_tag}${synchro_pending_stream}${localsettings.stop_thinking_tag}`;
5810+ }
58055811 synchro_pending_stream += event.data.choices[0].delta.content;
5806- }else if(event.data.choices[0].delta && !event.data.choices[0].delta.content && event.data.choices[0].delta.reasoning_content!=null&& event.data.choices[0].delta.reasoning_content!="")
5812+ }
5813+ else if(event.data.choices[0].delta && !event.data.choices[0].delta.content && event.data.choices[0].delta.reasoning_content!=null&& event.data.choices[0].delta.reasoning_content!="")
58075814 {
5815+ streaming_was_thinking = true;
58085816 synchro_pending_stream += event.data.choices[0].delta.reasoning_content;
58095817 }
58105818
@@ -5867,7 +5875,7 @@ Current version indicated by LITEVER below.
58675875 synchro_polled_response = cleanup_story_completion(synchro_polled_response);
58685876 }
58695877 synchro_pending_stream = "";
5870- gemini_was_thinking = false;
5878+ streaming_was_thinking = false;
58715879 poll_pending_response();
58725880 //handle gen failures
58735881 if(resp.status==503)
@@ -14369,7 +14377,7 @@ Current version indicated by LITEVER below.
1436914377 synchro_polled_response = null;
1437014378 last_stop_reason = "";
1437114379 synchro_pending_stream = "";
14372- gemini_was_thinking = false;
14380+ streaming_was_thinking = false;
1437314381 waiting_for_tool_call = 0;
1437414382 horde_poll_nearly_completed = false;
1437514383 oaiemulatecompletionscontent = "";
@@ -14393,7 +14401,7 @@ Current version indicated by LITEVER below.
1439314401 synchro_polled_response = null;
1439414402 last_stop_reason = "";
1439514403 synchro_pending_stream = "";
14396- gemini_was_thinking = false;
14404+ streaming_was_thinking = false;
1439714405 waiting_for_tool_call = 0;
1439814406 oaiemulatecompletionscontent = "";
1439914407 last_reply_was_empty = false;
@@ -16960,7 +16968,7 @@ Current version indicated by LITEVER below.
1696016968 synchro_polled_response = null;
1696116969 last_stop_reason = "";
1696216970 synchro_pending_stream = "";
16963- gemini_was_thinking = false;
16971+ streaming_was_thinking = false;
1696416972
1696516973 //if this is set, we don't use horde, use the custom endpoint instead
1696616974 if (custom_kobold_endpoint != "") //handle for kai
0 commit comments