NanoGPT: Add reasoning content display Fixes #4643

e4d779d4500e2b7f0e3cc6734bb68488c60a7fa8

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

3 files changed, +4 -2Showing whitespace changes
public/index.html+1 -1
@@ -2058,7 +2058,7 @@
20582058 </span>
20592059 </div>
20602060 </div>
20612061 <div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,azure_openai,nanogpt">
20622062 <label for="openai_show_thoughts" class="checkbox_label widthFreeExpand">
20632063 <input id="openai_show_thoughts" type="checkbox" />
20642064 <span data-i18n="Request model reasoning">Request model reasoning</span>
public/scripts/openai.js+1 -1
@@ -2681,7 +2681,7 @@ export function getStreamingReply(data, state, { chatCompletionSource = null, ov
26812681 state.reasoning += (data.choices?.filter(x => x?.delta?.reasoning)?.[0]?.delta?.reasoning || '');
26822682 }
26832683 return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';
26842684 } else if ([chat_completion_sources.CUSTOM, chat_completion_sources.POLLINATIONS, chat_completion_sources.AIMLAPI, chat_completion_sources.MOONSHOT, chat_completion_sources.COMETAPI, chat_completion_sources.ELECTRONHUB, chat_completion_sources.NANOGPT].includes(chat_completion_source)) {
26852685 if (show_thoughts) {
26862686 state.reasoning +=
26872687 data.choices?.filter(x => x?.delta?.reasoning_content)?.[0]?.delta?.reasoning_content ??
public/scripts/reasoning.js+2 -0
@@ -125,6 +125,8 @@ export function extractReasoningFromData(data, {
125125 case chat_completion_sources.POLLINATIONS:
126126 case chat_completion_sources.MOONSHOT:
127127 case chat_completion_sources.COMETAPI:
128+ case chat_completion_sources.ELECTRONHUB:
129+ case chat_completion_sources.NANOGPT:
128130 case chat_completion_sources.CUSTOM: {
129131 return data?.choices?.[0]?.message?.reasoning_content
130132 ?? data?.choices?.[0]?.message?.reasoning