MCPcopy
hub / github.com/FlowiseAI/Flowise / streamResponse

Function streamResponse

packages/components/nodes/moderation/Moderation.ts:16–25  ·  view source on GitHub ↗
(sseStreamer: IServerSideEventStreamer, chatId: string, response: string)

Source from the content-addressed store, hash-verified

14// is this the correct location for this function?
15// should we have a utils files that all node components can use?
16export const streamResponse = (sseStreamer: IServerSideEventStreamer, chatId: string, response: string) => {
17 const result = response.split(/(\s+)/)
18 result.forEach((token: string, index: number) => {
19 if (index === 0) {
20 sseStreamer.streamStartEvent(chatId, token)
21 }
22 sseStreamer.streamTokenEvent(chatId, token)
23 })
24 sseStreamer.streamEndEvent(chatId)
25}

Callers 13

runMethod · 0.90
runPredictionFunction · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90
runMethod · 0.90

Calls 3

streamStartEventMethod · 0.65
streamTokenEventMethod · 0.65
streamEndEventMethod · 0.65

Tested by

no test coverage detected