mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
🐛 fix: Artifacts Type Error, Tool Token Counts, and Agent Chat Import (#5142)
* fix: message import functionality to support content field * fix: handle tool calls token counts in context window management * fix: handle potential undefined size in FilePreview component
This commit is contained in:
parent
cb1921626e
commit
6c9a468b8e
3 changed files with 26 additions and 2 deletions
|
|
@ -931,6 +931,24 @@ class BaseClient {
|
|||
continue;
|
||||
}
|
||||
|
||||
if (item.type === 'tool_call' && item.tool_call != null) {
|
||||
const toolName = item.tool_call?.name || '';
|
||||
if (toolName != null && toolName && typeof toolName === 'string') {
|
||||
numTokens += this.getTokenCount(toolName);
|
||||
}
|
||||
|
||||
const args = item.tool_call?.args || '';
|
||||
if (args != null && args && typeof args === 'string') {
|
||||
numTokens += this.getTokenCount(args);
|
||||
}
|
||||
|
||||
const output = item.tool_call?.output || '';
|
||||
if (output != null && output && typeof output === 'string') {
|
||||
numTokens += this.getTokenCount(output);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const nestedValue = item[item.type];
|
||||
|
||||
if (!nestedValue) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue