Feat/stream flow variables (#4022)

stream flow variables
This commit is contained in:
Henry Heng
2025-02-12 10:40:46 +00:00
committed by GitHub
parent 15dc8b701a
commit 54cdf00e7e
+6 -1
View File
@@ -194,7 +194,12 @@ export class SSEStreamer implements IServerSideEventStreamer {
metadataJson['memoryType'] = apiResponse.memoryType
}
if (apiResponse.followUpPrompts) {
metadataJson['followUpPrompts'] = JSON.parse(apiResponse.followUpPrompts)
metadataJson['followUpPrompts'] =
typeof apiResponse.followUpPrompts === 'string' ? JSON.parse(apiResponse.followUpPrompts) : apiResponse.followUpPrompts
}
if (apiResponse.flowVariables) {
metadataJson['flowVariables'] =
typeof apiResponse.flowVariables === 'string' ? JSON.parse(apiResponse.flowVariables) : apiResponse.flowVariables
}
if (Object.keys(metadataJson).length > 0) {
this.streamCustomEvent(chatId, 'metadata', metadataJson)