Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

📤 refactor: Utilize `intermediateReply` when `message.content` is Empty

Danny Avilad8038e3b1942
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js
index 0e61fdcbaa..e913c6a994 100644
--- a/api/app/clients/OpenAIClient.js
+++ b/api/app/clients/OpenAIClient.js
@@ -1097,6 +1097,14 @@ ${convo}
logger.debug('[OpenAIClient] chatCompletion response', chatCompletion);
+ if (!message?.content?.trim() && intermediateReply.length) {
+ logger.debug(
+ '[OpenAIClient] chatCompletion: using intermediateReply due to empty message.content',
+ { intermediateReply },
+ );
+ return intermediateReply;
+ }
+
return message.content;
} catch (err) {
if (