Hello,
I'm working on a chatbot with Microsoft Copilot Studio, where I've encountered an issue after a user uploads an image. The chatbot is supposed to ask a question following the image upload, but instead of waiting for the user's response, it immediately reprompts. Here's a brief overview of my setup:
• I have a JavaScript client that capture the event of an upload image.
• I treat the file and return the image name, a blob URL for showing the sended image and the image in base 64.
• I use an event for communicating with my chatbot.
function initializeStore() {
return createStore({}, ({dispatch}) => next => async action => {
const {type, payload} = action
if (type === 'DIRECT_LINE/CONNECT_FULFILLED') {
await sendStartConversation(dispatch)
} else if (type === 'WEB_CHAT/SEND_FILES') {
for(const image of payload.files) {
try {
const imageData = await handleImage(image);
await sendImageUploadEvent(dispatch, imageData);
} catch (error) {
console.error('Error handling image:', error);
}
}
}
next(action)
});
}
export async function sendImageUploadEvent(dispatch, image) {
dispatch({
type: 'WEB_CHAT/SEND_EVENT',
payload: {
name: 'CLIENT/IMAGE_UPLOAD',
type: 'event',
value: "image:" + JSON.stringify(image)
}
});
}
I've ensured there's no duplication in event handling or state management that might lead to this behavior. I'm seeking insights or suggestions on potential causes for this immediate prompt issue and strategies to resolve it.
Any advice or guidance would be greatly appreciated.
Thank you.
Got it. Maybe try raising an issue here - https://github.com/microsoft/BotFramework-WebChat/issues
Yes, I'm sure, because if I display a message before displaying the question with the image, the message is only displayed once. I've also set up logs in my store, but the event is only sent once.
Are you sure WebChat isn't sending events you are not aware of? Maybe try logging any activity processed by your store just to make sure?
Pablo Roldan
27
Romain The Low-Code...
25
stampcoin
10