Reputation: 1599
I'm trying to understand how conv.data
and conv.user.storage
works.
As far as I uderstand is that conv.data
is used for temporary storage and conv.user.storage
for longer for between conversations. When i was testing locally I noticed that conv.data
doesn't really save for the next turn but only the same one. So is it tied to context?
On the other hand, user storage is pretty straight forward, you save the data and you have it in user and it is limited to 10 000 bytes but that is it.
But what I don't understand is this part:
When the Assistant can't match an identity to the user, the content of user storage is cleared at the end of the conversation. Examples of cases where the Assistant can't match an identity to the user are:
voice match is set up and there is no match.
The user disabled personal data.
Does this mean that if the user is now using the app and then someone else in the same conversation drops in to test it, does it clear the data?
TLDR
- Is context related to conv.data
and when context expires then conv.data
is deleted?
- Does your app data get deleted when another user tries to talk on your account?
Upvotes: 2
Views: 466
Reputation: 50701
You have things mostly correct. Let's look at a few things you say or ask.
Why doesn't conv.data
save for the next turn?
It depends what you mean by a "turn". conv.data
is saved during a single conversation - from the point your Action is invoked until your action "closes the microphone" with conv.close()
or the equivalent. AoG maintains this as a consistent conversation model.
(There are some bugs when you're using a Media response and are playing a very long audio file. But these are exceptions.)
Is conv.data
implemented using Dialogflow contexts?
If you're using AoG with Dialogflow - yes.
You can use conv.data
with the Action SDK, and it does not use Dialogflow contexts.
But then won't it expire when the context does?
Yes and no. The context for conv.data
is created as a long-lasting context (a lifespan of 99), so it will be a while before the context expires. The library also refreshes the context every turn, so it keeps the lifespan at 99 and resets the 20-minute timer for a context.
For conv.user.storage
, if the user is now using the app and then someone else in the same conversation drops in to test it, does it clear the data?
No. User identity is determined when the user says the hotword - "OK Google" or "Hey Google". After that, multiple users can speak during the conversation and the device treats it as the same account.
The Assistant doesn't try to figure out who is saying what during a conversation - only initially.
So if it identifies the user at the beginning of the conversation, it uses their storage
object. If it does not, it creates a new storage
object that is disposed of when the conversation ends (when it closes the microphone after conv.close()
).
Upvotes: 1