Feature/sse (#3125)

* Base changes for ServerSide Events (instead of socket.io)

* lint fixes

* adding of interface and separate methods for streaming events

* lint

* first draft, handles both internal and external prediction end points.

* lint fixes

* additional internal end point for streaming and associated changes

* return streamresponse as true to build agent flow

* 1) JSON formatting for internal events
2) other fixes

* 1) convert internal event to metadata to maintain consistency with external response

* fix action and metadata streaming

* fix for error when agent flow is aborted

* prevent subflows from streaming and other code cleanup

* prevent streaming from enclosed tools

* add fix for preventing chaintool streaming

* update lock file

* add open when hidden to sse

* Streaming errors

* Streaming errors

* add fix for showing error message

---------

Co-authored-by: Henry <hzj94@hotmail.com>
This commit is contained in:
Vinod Kiran
2024-09-17 12:31:25 +05:30
committed by GitHub
parent 7a4c7efcab
commit 26444ac3ae
47 changed files with 1021 additions and 327 deletions
+2 -11
View File
@@ -1,7 +1,6 @@
import path from 'path'
import fs from 'fs'
import logger from './logger'
import { Server } from 'socket.io'
import {
IComponentCredentials,
IComponentNodes,
@@ -436,8 +435,6 @@ type BuildFlowParams = {
stopNodeId?: string
uploads?: IFileUpload[]
baseURL?: string
socketIO?: Server
socketIOClientId?: string
}
/**
@@ -462,9 +459,7 @@ export const buildFlow = async ({
isUpsert,
stopNodeId,
uploads,
baseURL,
socketIO,
socketIOClientId
baseURL
}: BuildFlowParams) => {
const flowNodes = cloneDeep(reactFlowNodes)
@@ -533,9 +528,7 @@ export const buildFlow = async ({
cachePool,
dynamicVariables,
uploads,
baseURL,
socketIO,
socketIOClientId
baseURL
})
if (indexResult) upsertHistory['result'] = indexResult
logger.debug(`[server]: Finished upserting ${reactFlowNode.data.label} (${reactFlowNode.data.id})`)
@@ -561,8 +554,6 @@ export const buildFlow = async ({
dynamicVariables,
uploads,
baseURL,
socketIO,
socketIOClientId,
componentNodes: componentNodes as ICommonObject
})