Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

odd context resetting problem and question #226

Open
pgoldweic opened this issue Apr 9, 2021 · 3 comments
Open

odd context resetting problem and question #226

pgoldweic opened this issue Apr 9, 2021 · 3 comments

Comments

@pgoldweic
Copy link

For a long time, I've been able to completely reset the bot's user context in my (botkit-based orchestration) app by performing this sequence of steps 1- saving an empty context object directly in (botkit) persistent storage and then 2- calling watsonMiddleware.interpret() on the message. However, I just noticed that this sequence failed to work properly in one occasion recently (that is, Watson continued the conversation with the user instead of starting one from scratch). Can you help me understand what could have gone wrong? (this bot is still using the older botkit/botkit-middleware-watson combo, although I'm working on a botkit4-based update,)
In addition, I'd like to understand whether this sequence of steps should be expected to work with the latest botkit and watsonMiddleware code or whether I should use something else instead. I am aware of the 'sendToWatson' method, but I don't know whether it can be used to completely clear the user's context, which is the desired result (so that a new conversation can get started).

@pgoldweic pgoldweic changed the title odd context resetting problem odd context resetting problem and question Apr 9, 2021
@Naktibalda
Copy link
Contributor

sendToWatson can't be used to clear the context, it takes contextDelta parameter which is merged with context object stored in storage.

updateContext method replaces entire context object, use it instead.

@pgoldweic
Copy link
Author

Ah, that's great to know @Naktibalda . Thanks for explaining that!. I'm curious though, would it still work to do the manual context clearing first (outside of Watson, just accessing botbuilder storage), and then calling watsonMiddleware.interpret() ?

@Naktibalda
Copy link
Contributor

I don't see any reason why it shouldn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants