Chore/include action metadata from API responses (#6204)

include action metadata from API responses
This commit is contained in:
Henry Heng
2026-04-13 16:22:43 +01:00
committed by GitHub
parent 4c0223a013
commit 6ba035ced9
4 changed files with 8 additions and 0 deletions
@@ -198,6 +198,9 @@ export class RedisEventPublisher implements IServerSideEventStreamer {
if (apiResponse.memoryType) {
metadataJson['memoryType'] = apiResponse.memoryType
}
if (apiResponse.action) {
metadataJson['action'] = typeof apiResponse.action === 'string' ? JSON.parse(apiResponse.action) : apiResponse.action
}
if (Object.keys(metadataJson).length > 0) {
this.streamCustomEvent(chatId, 'metadata', metadataJson)
}
+3
View File
@@ -231,6 +231,9 @@ export class SSEStreamer implements IServerSideEventStreamer {
metadataJson['flowVariables'] =
typeof apiResponse.flowVariables === 'string' ? JSON.parse(apiResponse.flowVariables) : apiResponse.flowVariables
}
if (apiResponse.action) {
metadataJson['action'] = typeof apiResponse.action === 'string' ? JSON.parse(apiResponse.action) : apiResponse.action
}
if (Object.keys(metadataJson).length > 0) {
this.streamCustomEvent(chatId, 'metadata', metadataJson)
}
@@ -2331,6 +2331,7 @@ export const executeAgentFlow = async ({
result.followUpPrompts = JSON.stringify(apiMessage.followUpPrompts)
result.executionId = newExecution.id
result.agentFlowExecutedData = agentFlowExecutedData
if (apiMessage.action) result.action = JSON.parse(apiMessage.action)
if (sessionId) result.sessionId = sessionId
@@ -871,6 +871,7 @@ export const executeFlow = async ({
if (result?.usedTools) apiMessage.usedTools = JSON.stringify(result.usedTools)
if (result?.fileAnnotations) apiMessage.fileAnnotations = JSON.stringify(result.fileAnnotations)
if (result?.artifacts) apiMessage.artifacts = JSON.stringify(result.artifacts)
if (result?.action) apiMessage.action = typeof result.action === 'string' ? result.action : JSON.stringify(result.action)
if (chatflow.followUpPrompts) {
const followUpPromptsConfig = JSON.parse(chatflow.followUpPrompts)
const followUpPrompts = await generateFollowUpPrompts(followUpPromptsConfig, apiMessage.content, {