diff --git a/src/middlewares/audio.ts b/src/middlewares/audio.ts index afb9b45..d1e6368 100644 --- a/src/middlewares/audio.ts +++ b/src/middlewares/audio.ts @@ -101,8 +101,12 @@ export default function factory(): BotBuilder.IMiddlewareMap { } bingSpeechClient.synthesize(event.text) - .then(response => storage.upload(streamifier.createReadStream(response.wave))) + .then(response => { + logger.debug('Bing Speech synthesize succeeded'); + return storage.upload(streamifier.createReadStream(response.wave)); + }) .then(url => { + logger.info({url: url}, 'Audio response uploaded'); event.attachments = event.attachments || []; event.attachments.push({ contentType: 'audio/wave', diff --git a/src/middlewares/directline-prompts.ts b/src/middlewares/directline-prompts.ts index bd2c66c..b92b2d0 100644 --- a/src/middlewares/directline-prompts.ts +++ b/src/middlewares/directline-prompts.ts @@ -17,6 +17,7 @@ import * as BotBuilder from 'botbuilder'; import { Channel } from '../botbuilder-ext'; +import * as logger from 'logops'; /** * Look for outgoing messages whose channel is DirectLine and carry some attachment whose contentType @@ -34,11 +35,13 @@ export default { // Pick the attachment with contentType 'application/vnd.microsoft.keyboard' let choicesIndex = message.attachments .findIndex(attachment => attachment.contentType === 'application/vnd.microsoft.keyboard'); + logger.debug('Found attachment of type Keyboard on index %d', choicesIndex); if (choicesIndex !== -1) { // Move the attachment containing the choices to the channelData - let choices = message.attachments.splice(choicesIndex); + let choices = message.attachments.splice(choicesIndex, 1); message.sourceEvent = message.sourceEvent || {}; message.sourceEvent.choices = choices[0]; + logger.info('Keyboard moved from attachments to channelData'); } } }