(chatId: string, apiResponse: any)
| 287 | } |
| 288 | |
| 289 | streamMetadataEvent(chatId: string, apiResponse: any) { |
| 290 | const metadataJson: any = {} |
| 291 | if (apiResponse.chatId) { |
| 292 | metadataJson['chatId'] = apiResponse.chatId |
| 293 | } |
| 294 | if (apiResponse.chatMessageId) { |
| 295 | metadataJson['chatMessageId'] = apiResponse.chatMessageId |
| 296 | } |
| 297 | if (apiResponse.question) { |
| 298 | metadataJson['question'] = apiResponse.question |
| 299 | } |
| 300 | if (apiResponse.sessionId) { |
| 301 | metadataJson['sessionId'] = apiResponse.sessionId |
| 302 | } |
| 303 | if (apiResponse.memoryType) { |
| 304 | metadataJson['memoryType'] = apiResponse.memoryType |
| 305 | } |
| 306 | if (apiResponse.followUpPrompts) { |
| 307 | metadataJson['followUpPrompts'] = |
| 308 | typeof apiResponse.followUpPrompts === 'string' ? JSON.parse(apiResponse.followUpPrompts) : apiResponse.followUpPrompts |
| 309 | } |
| 310 | if (apiResponse.flowVariables) { |
| 311 | metadataJson['flowVariables'] = |
| 312 | typeof apiResponse.flowVariables === 'string' ? JSON.parse(apiResponse.flowVariables) : apiResponse.flowVariables |
| 313 | } |
| 314 | if (apiResponse.action) { |
| 315 | metadataJson['action'] = typeof apiResponse.action === 'string' ? JSON.parse(apiResponse.action) : apiResponse.action |
| 316 | } |
| 317 | if (Object.keys(metadataJson).length > 0) { |
| 318 | this.streamCustomEvent(chatId, 'metadata', metadataJson) |
| 319 | } |
| 320 | } |
| 321 | |
| 322 | streamUsageMetadataEvent(chatId: string, data: any): void { |
| 323 | const clientResponse = { |
no test coverage detected