diff --git a/public/script.js b/public/script.js index cbc21dbfd..8e90368fe 100644 --- a/public/script.js +++ b/public/script.js @@ -5436,7 +5436,7 @@ function extractMessageFromData(data) { case 'novel': return data.output; case 'openai': - return data?.choices?.[0]?.message?.content ?? data?.choices?.[0]?.text ?? data?.text ?? data?.message?.tool_plan ?? data?.message?.content?.[0]?.text ?? ''; + return data?.choices?.[0]?.message?.content ?? data?.choices?.[0]?.text ?? data?.text ?? data?.message?.content?.[0]?.text ?? data?.message?.tool_plan ?? ''; default: return ''; } diff --git a/public/scripts/openai.js b/public/scripts/openai.js index 94a537c07..7fb23e711 100644 --- a/public/scripts/openai.js +++ b/public/scripts/openai.js @@ -1973,11 +1973,11 @@ async function sendOpenAIRequest(type, messages, signal) { } function getStreamingReply(data) { - if (oai_settings.chat_completion_source == chat_completion_sources.CLAUDE) { + if (oai_settings.chat_completion_source === chat_completion_sources.CLAUDE) { return data?.delta?.text || ''; - } else if (oai_settings.chat_completion_source == chat_completion_sources.MAKERSUITE) { + } else if (oai_settings.chat_completion_source === chat_completion_sources.MAKERSUITE) { return data?.candidates?.[0]?.content?.parts?.[0]?.text || ''; - } else if (oai_settings.chat_completion_source == chat_completion_sources.COHERE) { + } else if (oai_settings.chat_completion_source === chat_completion_sources.COHERE) { return data?.delta?.message?.content?.text || data?.delta?.message?.tool_plan || ''; } else { return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';