ActivityPrompt 类

public class ActivityPrompt
extends Dialog

定义等待接收活动的提示对话框的核心行为。 此提示要求传入验证程序,在等待非消息活动(如要接收事件)时非常有用。验证程序可以忽略收到的活动,直到收到预期的活动类型。

构造函数摘要

构造函数 说明
ActivityPrompt(String dialogId, PromptValidator<Activity> validator)

初始化 ActivityPrompt 类的新实例。

方法摘要

修饰符和类型 方法和描述
java.util.concurrent.CompletableFuture<DialogTurnResult> beginDialog(DialogContext dc, Object options)

当将提示对话推送到对话堆栈并正在激活时调用。

java.util.concurrent.CompletableFuture<DialogTurnResult> continueDialog(DialogContext dc)

当提示对话框是活动对话框,用户用新活动答复时调用。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

在派生类中重写时,提示用户输入。

protected java.util.concurrent.CompletableFuture<java.lang.Void> onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)

在派生类中重写时,提示用户输入。

protected java.util.concurrent.CompletableFuture<PromptRecognizerResult<Activity>> onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

在派生类中重写时,尝试识别传入的活动。

java.util.concurrent.CompletableFuture<java.lang.Void> repromptDialog(TurnContext turnContext, DialogInstance instance)

当请求提示对话框重新提示用户输入时调用。

java.util.concurrent.CompletableFuture<DialogTurnResult> resumeDialog(DialogContext dc, DialogReason reason, Object result)

当提示对话框恢复为对话堆栈上的活动对话时调用,例如堆栈上以前的活动对话完成时。

方法继承自 Dialog

方法继承自 java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

构造函数详细信息

ActivityPrompt

public ActivityPrompt(String dialogId, PromptValidator validator)

初始化 ActivityPrompt 类的新实例。 从派生类中的构造函数调用以初始化 ActivityPrompt 类。

参数:

dialogId - 要分配给此提示的 ID。
validator - 包含此提示验证的 PromptValidator<T>
              The value of dialogId must be unique within the
              <xref uid="com.microsoft.bot.dialogs.DialogSet" data-throw-if-not-resolved="false" data-raw-source="DialogSet"></xref> or <xref uid="com.microsoft.bot.dialogs.ComponentDialog" data-throw-if-not-resolved="false" data-raw-source="ComponentDialog"></xref> to which the
              prompt is added.

方法详细信息

beginDialog

public CompletableFuture beginDialog(DialogContext dc, Object options)

当将提示对话推送到对话堆栈并正在激活时调用。

替代:

ActivityPrompt.beginDialog(DialogContext dc, Object options)

参数:

dc - 对话的当前轮次的对话上下文。
options - 可选,用于传递给正在启动的提示的其他信息。

返回:

表示异步作的 CompletableFuture
     If the task is successful, the result indicates whether the prompt is
     still active after the turn has been processed by the prompt.

continueDialog

public CompletableFuture continueDialog(DialogContext dc)

当提示对话框是活动对话框,用户用新活动答复时调用。

替代:

ActivityPrompt.continueDialog(DialogContext dc)

参数:

dc - 当前对话轮次的对话上下文。

返回:

表示异步作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog. The
     prompt generally continues to receive the user's replies until it
     accepts the user's reply as valid input for the prompt.

onPrompt

protected CompletableFuture onPrompt(TurnContext turnContext, Map state, PromptOptions options)

在派生类中重写时,提示用户输入。

参数:

turnContext - 与用户的当前会话轮次的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 从最初在调用 prompt(String dialogId, PromptOptions options) 中提供的选项构造的提示选项对象。

返回:

表示异步作的 CompletableFuture

onPrompt

protected CompletableFuture onPrompt(TurnContext turnContext, Map state, PromptOptions options, Boolean isRetry)

在派生类中重写时,提示用户输入。

参数:

turnContext - 与用户的当前会话轮次的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 从最初在调用 prompt(String dialogId, PromptOptions options) 中提供的选项构造的提示选项对象。
isRetry - 表示提示是否重试的 Boolean

返回:

表示异步作结果的 CompletableFuture

onRecognize

protected CompletableFuture> onRecognize(TurnContext turnContext, Map state, PromptOptions options)

在派生类中重写时,尝试识别传入的活动。

参数:

turnContext - 与用户的当前会话轮次的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 从最初在调用 prompt(String dialogId, PromptOptions options) 中提供的选项构造的提示选项对象。

返回:

表示异步作的 CompletableFuture
     If the task is successful, the result describes the result of the
     recognition attempt.

repromptDialog

public CompletableFuture repromptDialog(TurnContext turnContext, DialogInstance instance)

当请求提示对话框重新提示用户输入时调用。

替代:

ActivityPrompt.repromptDialog(TurnContext turnContext, DialogInstance instance)

参数:

turnContext - 与用户的当前会话轮次的上下文。
instance - 堆栈上对话框的实例。

返回:

表示异步作的 CompletableFuture

resumeDialog

public CompletableFuture resumeDialog(DialogContext dc, DialogReason reason, Object result)

当提示对话框恢复为对话堆栈上的活动对话时调用,例如堆栈上以前的活动对话完成时。

替代:

ActivityPrompt.resumeDialog(DialogContext dc, DialogReason reason, Object result)

参数:

dc - 对话的当前轮次的对话上下文。
reason - 一个枚举,指示对话恢复的原因。
result - 可选,从堆栈上上一个对话框返回的值。 返回的值的类型取决于上一个对话框。

返回:

表示异步作的 CompletableFuture
     If the task is successful, the result indicates whether the dialog is
     still active after the turn has been processed by the dialog.

适用于