mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-04-07 00:15:23 +02:00
add progress notification feature
This commit is contained in:
parent
b4d97bd888
commit
be0619755d
18 changed files with 1311 additions and 57 deletions
|
|
@ -8,6 +8,7 @@ const {
|
|||
} = require('@librechat/agents');
|
||||
const {
|
||||
sendEvent,
|
||||
sendProgress,
|
||||
MCPOAuthHandler,
|
||||
isMCPDomainAllowed,
|
||||
normalizeServerName,
|
||||
|
|
@ -648,6 +649,30 @@ function createToolInstance({
|
|||
oauthStart,
|
||||
oauthEnd,
|
||||
graphTokenResolver: getGraphApiToken,
|
||||
onProgress: async (progressData) => {
|
||||
logger.debug(
|
||||
`[MCP][${serverName}][${toolName}] Sending progress to client:`,
|
||||
progressData,
|
||||
);
|
||||
const eventData = {
|
||||
progress: progressData.progress,
|
||||
total: progressData.total,
|
||||
message: progressData.message,
|
||||
toolCallId: toolCall.id,
|
||||
};
|
||||
try {
|
||||
if (streamId) {
|
||||
await GenerationJobManager.emitTransientEvent(streamId, {
|
||||
event: 'progress',
|
||||
data: eventData,
|
||||
});
|
||||
} else {
|
||||
sendProgress(res, eventData);
|
||||
}
|
||||
} catch (err) {
|
||||
logger.error(`[MCP][${serverName}][${toolName}] Failed to emit progress:`, err);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
if (isAssistantsEndpoint(provider) && Array.isArray(result)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue