Cohere: Swap message and tool plan in extractMessageFromData

7162f9d562855ca669ae472d58795b8d89003d55

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

2 files changed, +4 -4Ignore whitespace
public/script.js+1 -1
@@ -5436,7 +5436,7 @@ function extractMessageFromData(data) {
54365436 case 'novel':
54375437 return data.output;
54385438 case 'openai':
54395439 return data?.choices?.[0]?.message?.content ?? data?.choices?.[0]?.text ?? data?.text ?? data?.message?.tool_plancontent?.[0]?.text ?? data?.message?.content?.[0]?.texttool_plan ?? '';
54405440 default:
54415441 return '';
54425442 }
public/scripts/openai.js+3 -3
@@ -1973,11 +1973,11 @@ async function sendOpenAIRequest(type, messages, signal) {
19731973}
19741974
19751975function getStreamingReply(data) {
19761976 if (oai_settings.chat_completion_source === chat_completion_sources.CLAUDE) {
19771977 return data?.delta?.text || '';
19781978 } else if (oai_settings.chat_completion_source === chat_completion_sources.MAKERSUITE) {
19791979 return data?.candidates?.[0]?.content?.parts?.[0]?.text || '';
19801980 } else if (oai_settings.chat_completion_source === chat_completion_sources.COHERE) {
19811981 return data?.delta?.message?.content?.text || data?.delta?.message?.tool_plan || '';
19821982 } else {
19831983 return data.choices?.[0]?.delta?.content ?? data.choices?.[0]?.message?.content ?? data.choices?.[0]?.text ?? '';