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 类。

Parameters:

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)

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

Overrides:

ActivityPrompt.beginDialog(DialogContext dc, Object options)

Parameters:

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

Returns:

表示异步操作的 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)

当提示对话为活动对话且用户使用新活动进行答复时调用。

Overrides:

ActivityPrompt.continueDialog(DialogContext dc)

Parameters:

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

Returns:

表示异步操作的 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)

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

Parameters:

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

Returns:

表示异步操作的 CompletableFuture

onPrompt

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

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

Parameters:

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

Returns:

一个 CompletableFuture ,表示异步操作的结果。

onRecognize

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

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

Parameters:

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

Returns:

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

repromptDialog

public CompletableFuture repromptDialog(TurnContext turnContext, DialogInstance instance)

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

Overrides:

ActivityPrompt.repromptDialog(TurnContext turnContext, DialogInstance instance)

Parameters:

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

Returns:

表示异步操作的 CompletableFuture

resumeDialog

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

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

Overrides:

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

Parameters:

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

Returns:

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

适用于