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

fix(openai/completions): use old method for instruct/davinci/text gen models (#1166)

Danny Avila9ca84edb9aa1
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.js
index 124d05e68f..c7c973e482 100644
--- a/api/app/clients/OpenAIClient.js
+++ b/api/app/clients/OpenAIClient.js
@@ -367,7 +367,7 @@ If your reverse proxy is compatible to OpenAI specs in every other way, it may s
let streamResult = null;
this.modelOptions.user = this.user;
const invalidBaseUrl = this.completionsUrl && extractBaseURL(this.completionsUrl) === null;
- const useOldMethod = !!(this.azure || invalidBaseUrl);
+ const useOldMethod = !!(this.azure || invalidBaseUrl || !this.isChatCompletion);
if (typeof opts.onProgress === 'function' && useOldMethod) {
await this.getCompletion(
payload,
@@ -702,9 +702,10 @@ ${convo}
if (typeof onProgress === 'function') {
modelOptions.stream = true;
}
- if (this.isChatGptModel) {
+ if (this.isChatCompletion) {
modelOptions.messages = payload;
} else {
+ // TODO: unreachable code. Need to implement completions call for non-chat models
modelOptions.prompt = payload;
}