简体   繁体   English

Microsoft bot 框架中的会话 state

[英]Conversation state in Microsoft bot framework

I want to know how long a conversation state will be there if we haven't added any expiry method in the bot framework.我想知道如果我们没有在 bot 框架中添加任何到期方法,对话 state 将存在多长时间。 Did anyone know anything about this?有人知道这件事吗?

The short answer is that it's up to you.简短的回答是,这取决于你。

Check out the docs for Managing state.查看管理 state 的文档

From the docs:从文档:

The Bot Framework SDK includes some implementations for the storage layer: Bot Framework SDK 包括存储层的一些实现:

  • Memory storage implements in-memory storage for testing purposes. Memory 存储实现内存存储用于测试目的。 In-memory data storage is intended for local testing only as this storage is volatile and temporary.内存数据存储仅用于本地测试,因为此存储是易失性和临时性的。 The data is cleared each time the bot is restarted.每次重新启动机器人时,数据都会被清除。

  • Azure Blob Storage connects to an Azure Blob Storage object database. Azure Blob 存储连接到一个 Azure Blob 存储 object 数据库。

  • Azure Cosmos DB partitioned storage connects to a partitioned Cosmos DB NoSQL database. Azure Cosmos DB 分区存储连接到分区的 Cosmos DB NoSQL 数据库。

(although it also states: The Cosmos DB storage class has been deprecated.) (尽管它还声明:Cosmos DB 存储 class 已被弃用。)

Or you can write your own custom storage .或者您可以编写自己的自定义存储

What your question really comes down to is when does a conversation expire .您的问题真正归结为对话何时到期 This can be a function of the bot or the storage layer.这可以是机器人或存储层的 function。

From the conversation expire link above:从上面的对话过期链接:

  • User Interaction Expiration用户交互过期

This type of expiring conversation is accomplished by adding a last accessed time property to the bot's conversation state. This property value is then compared to the current time within the activity handler before processing activities.这种类型的过期对话是通过向机器人的对话 state 添加上次访问的时间属性来实现的。然后在处理活动之前将此属性值与活动处理程序中的当前时间进行比较。

  • Storage Expiration存储过期

Cosmos DB provides a Time To Live (TTL) feature that allows you to delete items automatically from a container after a certain time period. Cosmos DB 提供了生存时间 (TTL) 功能,允许您在特定时间段后自动从容器中删除项目。 This can be configured from within the Azure portal or during container creation (using the language-specific Cosmos DB SDKs).这可以从 Azure 门户内或在容器创建期间配置(使用特定语言的 Cosmos DB SDK)。

The Bot Framework SDK doesn't expose a TTL configuration setting. Bot Framework SDK 不公开 TTL 配置设置。 However, container initialization can be overridden and the Cosmos DB SDK can be used to configure TTL prior to Bot Framework storage initialization.但是,可以覆盖容器初始化,并且 Cosmos DB SDK 可用于在 Bot Framework 存储初始化之前配置 TTL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM