NanoGPT: Add reasoning content display Fixes #4643
| @@ -2058,7 +2058,7 @@ | ||
| 2058 | 2058 | </span> |
| 2059 | 2059 | </div> |
| 2060 | 2060 | </div> |
| 2061 | 2061 | <div class="range-block" data-source="deepseek,aimlapi,openrouter,custom,claude,xai,makersuite,vertexai,pollinations,moonshot,mistralai,fireworks,cometapi,electronhub,azure_openai,nanogpt"> |
| 2062 | 2062 | <label for="openai_show_thoughts" class="checkbox_label widthFreeExpand"> |
| 2063 | 2063 | <input id="openai_show_thoughts" type="checkbox" /> |
| 2064 | 2064 | <span data-i18n="Request model reasoning">Request model reasoning</span> |
| @@ -2681,7 +2681,7 @@ export function getStreamingReply(data, state, { chatCompletionSource = null, ov | ||
| 2681 | 2681 | state.reasoning += (data.choices?.filter(x => x?.delta?.reasoning)?.[0]?.delta?.reasoning || ''); |
| 2682 | 2682 | } |
| 2683 | 2683 | return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? ''; |
| 2684 | 2684 | } 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)) { |
| 2685 | 2685 | if (show_thoughts) { |
| 2686 | 2686 | state.reasoning += |
| 2687 | 2687 | data.choices?.filter(x => x?.delta?.reasoning_content)?.[0]?.delta?.reasoning_content ?? |
| @@ -125,6 +125,8 @@ export function extractReasoningFromData(data, { | ||
| 125 | 125 | case chat_completion_sources.POLLINATIONS: |
| 126 | 126 | case chat_completion_sources.MOONSHOT: |
| 127 | 127 | case chat_completion_sources.COMETAPI: |
| 128 | + case chat_completion_sources.ELECTRONHUB: | |
| 129 | + case chat_completion_sources.NANOGPT: | |
| 128 | 130 | case chat_completion_sources.CUSTOM: { |
| 129 | 131 | return data?.choices?.[0]?.message?.reasoning_content |
| 130 | 132 | ?? data?.choices?.[0]?.message?.reasoning |