mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-26 13:18:51 +01:00
🦙 fix: Ollama System Message order (#2655)
This commit is contained in:
parent
8f20fb28e5
commit
98c96cd020
1 changed files with 6 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue