Enable reasoning parsing for Pollinations and AIML

982dca58ba36bf805c18edddfc605969d50c5cad

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

2 files changed, +3 -1Showing whitespace changes
public/scripts/openai.js+1 -1
@@ -2544,7 +2544,7 @@ export function getStreamingReply(data, state, { chatCompletionSource = null, ov
25442544 state.reasoning += (data.choices?.filter(x => x?.delta?.reasoning)?.[0]?.delta?.reasoning || '');
25452545 }
25462546 return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';
25472547 } else if (chat_completion_source[chat_completion_sources.CUSTOM, ===chat_completion_sources.POLLINATIONS, chat_completion_sources.CUSTOMAIMLAPI].includes(chat_completion_source)) {
25482548 if (show_thoughts) {
25492549 state.reasoning +=
25502550 data.choices?.filter(x => x?.delta?.reasoning_content)?.[0]?.delta?.reasoning_content ??
public/scripts/reasoning.js+2 -0
@@ -118,6 +118,8 @@ export function extractReasoningFromData(data, {
118118 return data?.responseContent?.parts?.filter(part => part.thought)?.map(part => part.text)?.join('\n\n') ?? '';
119119 case chat_completion_sources.CLAUDE:
120120 return data?.content?.find(part => part.type === 'thinking')?.thinking ?? '';
121+ case chat_completion_sources.AIMLAPI:
122+ case chat_completion_sources.POLLINATIONS:
121123 case chat_completion_sources.CUSTOM: {
122124 return data?.choices?.[0]?.message?.reasoning_content
123125 ?? data?.choices?.[0]?.message?.reasoning