grammyjs / conversations

Conversational interfaces for grammY.
https://grammy.dev/plugins/conversations
MIT License
52 stars 17 forks source link

Context partially cleared after first turn of conversation #114

Closed danielrhodes closed 3 weeks ago

danielrhodes commented 2 months ago

I noticed that after one turn of a conversation, the Context gets some properties cleared. I assume this is because the Context is being saved to an external store and then when it is unfrozen, it doesn't have things like functions or anything else that was hydrated.

Is there a way around this? One thing that makes it confusing is that the hydrated context is fully available on the first turn.

KnorpelSenf commented 2 months ago

I assume this is because the Context is being saved to an external store and then when it is unfrozen, it doesn't have things like functions or anything else that was hydrated

This is correct

Is there a way around this?

You can either look into conversation.run and https://grammy.dev/plugins/conversations#working-with-plugins, or you can call these functions directly rather than installing them on the context object.

One thing that makes it confusing is that the hydrated context is fully available on the first turn.

That is correct, this was an early design mistake. It will be fixed for the next major version.