mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
📞 fix: Model End Callback and Streamline Client Cleanup (#10438)
* fix: update agent context handling in ModelEndHandler due to new MultiAgentGraph * refactor: streamline client cleanup process by utilizing property arrays for potential circular reference removal
This commit is contained in:
parent
360ec22964
commit
09c309bc78
2 changed files with 97 additions and 57 deletions
|
|
@ -41,7 +41,11 @@ class ModelEndHandler {
|
|||
}
|
||||
|
||||
try {
|
||||
if (metadata.provider === Providers.GOOGLE || graph.clientOptions?.disableStreaming) {
|
||||
const agentContext = graph.getAgentContext(metadata);
|
||||
if (
|
||||
agentContext.provider === Providers.GOOGLE ||
|
||||
agentContext.clientOptions?.disableStreaming
|
||||
) {
|
||||
handleToolCalls(data?.output?.tool_calls, metadata, graph);
|
||||
}
|
||||
|
||||
|
|
@ -49,14 +53,13 @@ class ModelEndHandler {
|
|||
if (!usage) {
|
||||
return;
|
||||
}
|
||||
if (metadata?.model) {
|
||||
usage.model = metadata.model;
|
||||
const modelName = metadata?.ls_model_name || agentContext.clientOptions?.model;
|
||||
if (modelName) {
|
||||
usage.model = modelName;
|
||||
}
|
||||
|
||||
this.collectedUsage.push(usage);
|
||||
const streamingDisabled = !!(
|
||||
graph.clientOptions?.disableStreaming || graph?.boundModel?.disableStreaming
|
||||
);
|
||||
const streamingDisabled = !!agentContext.clientOptions?.disableStreaming;
|
||||
if (!streamingDisabled) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue