如何使用Bot框架弹出根对话框?

编程入门 行业动态 更新时间:2024-10-27 00:27:46
本文介绍了如何使用Bot框架弹出根对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在基于bot框架为我的bot使用.Net后端. 在我的一个对话框中,我为用户提供了返回根对话框的选项-至少,这是我正在尝试执行的操作,但没有成功.这是我已经尝试过的:

I'm using the .Net backend for my bot based on the bot framework. In one of my dialogs I give the user the option to return to the root dialog - or at least, that's what I'm trying to do but no success. Here's what I have already tried:

  • 致电context.Reset()-我了解到我可能无法在对话框中使用它;它会导致崩溃
  • Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialog())-似乎什么也没做
  • call context.Reset() - I learned that I may not use this from inside a dialog; it causes a crash
  • Conversation.SendAsync((IMessageActivity)context.Activity, () => new RootDialog()) - does not seem to do anything

理想情况下,我只想回到堆栈的第一位,而不必对RootDialog类型进行硬编码.

Ideally I just want to get back to what is first on the stack without having to hardcode the RootDialog type.

推荐答案

正如Ezequiel所指出的,context.Done()是如何结束当前对话框并将控件返回到调用对话框的方法.

As pointed out by Ezequiel, context.Done() is how to end the current dialog, and return control to the calling dialog.

://relreferrofofer .botframework/.../sdkreference/dialog_stack.html

void Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Done(R值)

void Microsoft.Bot.Builder.Dialogs.Internals.IDialogStack.Done(R value)

完成当前对话框,然后将结果返回到父对话框.

Complete the current dialog and return a result to the parent dialog.

参数

value: The value of the result.

更多推荐

如何使用Bot框架弹出根对话框?

本文发布于:2023-11-17 06:30:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609161.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   如何使用   对话框   框架   Bot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!