mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🔥 feat: deepseek-reasoner
Thought Streaming (#5379)
* 🔧 refactor: Remove unused penalties and enhance reasoning token handling in OpenAIClient * 🔧 refactor: `addInstructions` default to adding instructions at index 0, flag for legacy behavior * chore: remove long placeholder * chore: update localization strings across multiple languages * ci: adjust tests for new `addInstructions` behavior
This commit is contained in:
parent
79585e22d2
commit
d6b4d83b68
14 changed files with 67 additions and 18 deletions
|
@ -264,17 +264,24 @@ class BaseClient {
|
|||
/**
|
||||
* Adds instructions to the messages array. If the instructions object is empty or undefined,
|
||||
* the original messages array is returned. Otherwise, the instructions are added to the messages
|
||||
* array, preserving the last message at the end.
|
||||
* array either at the beginning (default) or preserving the last message at the end.
|
||||
*
|
||||
* @param {Array} messages - An array of messages.
|
||||
* @param {Object} instructions - An object containing instructions to be added to the messages.
|
||||
* @param {boolean} [beforeLast=false] - If true, adds instructions before the last message; if false, adds at the beginning.
|
||||
* @returns {Array} An array containing messages and instructions, or the original messages if instructions are empty.
|
||||
*/
|
||||
addInstructions(messages, instructions) {
|
||||
const payload = [];
|
||||
addInstructions(messages, instructions, beforeLast = false) {
|
||||
if (!instructions || Object.keys(instructions).length === 0) {
|
||||
return messages;
|
||||
}
|
||||
|
||||
if (!beforeLast) {
|
||||
return [instructions, ...messages];
|
||||
}
|
||||
|
||||
// Legacy behavior: add instructions before the last message
|
||||
const payload = [];
|
||||
if (messages.length > 1) {
|
||||
payload.push(...messages.slice(0, -1));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue