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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🦙 fix: Ollama System Message order (#2655)
Danny Avila98c96cd020ad
diff --git a/api/app/clients/OpenAIClient.js b/api/app/clients/OpenAIClient.jsindex c232e27817..456185c008 100644--- a/api/app/clients/OpenAIClient.js+++ b/api/app/clients/OpenAIClient.js@@ -129,6 +129,10 @@ class OpenAIClient extends BaseClient {this.useOpenRouter = true;}+ if (this.options.endpoint?.toLowerCase() === 'ollama') {+ this.isOllama = true;+ }+this.FORCE_PROMPT =isEnabled(OPENAI_FORCE_PROMPT) ||(reverseProxy && reverseProxy.includes('completions') && !reverseProxy.includes('chat'));@@ -1121,7 +1125,7 @@ ${convo}});/* Re-orders system message to the top of the messages payload, as not allowed anywhere else */- if (opts.baseURL.includes('api.mistral.ai') && modelOptions.messages) {+ if (modelOptions.messages && (opts.baseURL.includes('api.mistral.ai') || this.isOllama)) {const { messages } = modelOptions;const systemMessageIndex = messages.findIndex((msg) => msg.role === 'system');@@ -1165,7 +1169,7 @@ ${convo}});}- if (this.message_file_map && this.options.endpoint?.toLowerCase() === 'ollama') {+ if (this.message_file_map && this.isOllama) {const ollamaClient = new OllamaClient({ baseURL });return await ollamaClient.chatCompletion({payload: modelOptions,