Skip to content

Commit 8c20e08

Browse files
HenryHengZJtenuar
authored andcommitted
Feat/stream flow variables (FlowiseAI#4022)
stream flow variables
1 parent a4349a6 commit 8c20e08

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/server/src/utils/SSEStreamer.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,12 @@ export class SSEStreamer implements IServerSideEventStreamer {
194194
metadataJson['memoryType'] = apiResponse.memoryType
195195
}
196196
if (apiResponse.followUpPrompts) {
197-
metadataJson['followUpPrompts'] = JSON.parse(apiResponse.followUpPrompts)
197+
metadataJson['followUpPrompts'] =
198+
typeof apiResponse.followUpPrompts === 'string' ? JSON.parse(apiResponse.followUpPrompts) : apiResponse.followUpPrompts
199+
}
200+
if (apiResponse.flowVariables) {
201+
metadataJson['flowVariables'] =
202+
typeof apiResponse.flowVariables === 'string' ? JSON.parse(apiResponse.flowVariables) : apiResponse.flowVariables
198203
}
199204
if (Object.keys(metadataJson).length > 0) {
200205
this.streamCustomEvent(chatId, 'metadata', metadataJson)

0 commit comments

Comments
 (0)