mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01:00
🔁 refactor: Token Event Handler and Standardize maxTokens Key (#6886)
* refactor: agent token handling to use createHandleLLMNewToken for improved closure * refactor: update llmConfig to use maxTokens instead of max_tokens for consistency
This commit is contained in:
parent
52b3ed54ca
commit
c49f883e1a
5 changed files with 24 additions and 19 deletions
|
|
@ -8,7 +8,7 @@ const {
|
|||
removeNullishValues,
|
||||
} = require('librechat-data-provider');
|
||||
const { getUserKey, checkUserKeyExpiry } = require('~/server/services/UserService');
|
||||
const { sleep } = require('~/server/utils');
|
||||
const { createHandleLLMNewToken } = require('~/app/clients/generators');
|
||||
|
||||
const getOptions = async ({ req, overrideModel, endpointOption }) => {
|
||||
const {
|
||||
|
|
@ -90,12 +90,7 @@ const getOptions = async ({ req, overrideModel, endpointOption }) => {
|
|||
|
||||
llmConfig.callbacks = [
|
||||
{
|
||||
handleLLMNewToken: async () => {
|
||||
if (!streamRate) {
|
||||
return;
|
||||
}
|
||||
await sleep(streamRate);
|
||||
},
|
||||
handleLLMNewToken: createHandleLLMNewToken(streamRate),
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue