ConfirmPrompt 类

public class ConfirmPrompt
extends Prompt<java.lang.Boolean>

提示用户使用“是/否”响应确认某些内容。

构造函数摘要

构造函数 说明
ConfirmPrompt(String dialogId)

初始化 ConfirmPrompt 类的新实例。

ConfirmPrompt(String dialogId, PromptValidator<Boolean> validator, String defaultLocale)

初始化 ConfirmPrompt 类的新实例。

ConfirmPrompt(String dialogId, Map<String,Triplet<Choice,Choice,ChoiceFactoryOptions>> choiceDefaults, PromptValidator<Boolean> validator, String defaultLocale)

初始化 ConfirmPrompt 类的新实例。

方法摘要

修饰符和类型 方法和描述
ChoiceFactoryOptions getChoiceOptions()

获取传递给 的其他选项, ChoiceFactory 并用于调整呈现给用户的选项样式。

org.javatuples.Pair<Choice,Choice> getConfirmChoices()

获取提示的“是”和“否 Choice ”。

java.lang.String getDefaultLocale()

设置或设置用于确定提示语言特定行为的默认区域设置。

ListStyle getStyle()

获取向用户显示提示时要使用的样式。

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<java.lang.Boolean>> onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

尝试识别用户的输入。

void setChoiceOptions(ChoiceFactoryOptions choiceOptions)

设置传递给 ChoiceFactory 的其他选项,并用于调整呈现给用户的选项样式。

void setConfirmChoices(Pair<Choice,Choice> confirmChoices)

为提示设置“是”和“否 Choice ”。

void setDefaultLocale(String defaultLocale)

设置用于确定提示语言特定行为的默认区域设置。

void setStyle(ListStyle style)

设置向用户显示提示时要使用的样式。

方法继承自 Dialog

方法继承自 Prompt

方法继承自 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

构造函数详细信息

ConfirmPrompt

public ConfirmPrompt(String dialogId)

初始化 ConfirmPrompt 类的新实例。

Parameters:

dialogId - 要分配给此提示的 ID。

ConfirmPrompt

public ConfirmPrompt(String dialogId, PromptValidator validator, String defaultLocale)

初始化 ConfirmPrompt 类的新实例。

Parameters:

dialogId - 要分配给此提示的 ID。
validator - 可选为 {@link PromptValidator{FoundChoice}},其中包含对此提示的其他自定义验证。
defaultLocale - 可选,用于确定提示语言特定行为的默认区域设置。 区域设置是由 2、3 或 4 个字符组成的 ISO 639 代码,代表某种语言或语言系列。
                  The value of <xref uid="" data-throw-if-not-resolved="false" data-raw-source="dialogId"></xref> 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. If the <xref uid="com.microsoft.bot.schema.Activity.locale" data-throw-if-not-resolved="false" data-raw-source="Activity#locale"></xref> of
                  the <xref uid="com.microsoft.bot.dialogs.DialogContext" data-throw-if-not-resolved="false" data-raw-source="DialogContext"></xref> .<xref uid="com.microsoft.bot.dialogs.DialogContext.context" data-throw-if-not-resolved="false" data-raw-source="DialogContext#context"></xref>
                  .<xref uid="" data-throw-if-not-resolved="false" data-raw-source="ITurnContext#activity"></xref> is specified, then that
                  local is used to determine language specific behavior;
                  otherwise the <xref uid="" data-throw-if-not-resolved="false" data-raw-source="defaultLocale"></xref> is used. US-English
                  is the used if no language or default locale is
                  available, or if the language or locale is not otherwise
                  supported.

ConfirmPrompt

public ConfirmPrompt(String dialogId, Map<>> choiceDefaults, PromptValidator validator, String defaultLocale)

初始化 ConfirmPrompt 类的新实例。

Parameters:

dialogId - 要分配给此提示的 ID。
choiceDefaults - 替代 Bot Framework SDK 支持的_choiceDefaults (字典,以便提示本地化) 。 必须传递到需要自定义选项默认值的每个 ConfirmPrompt。
                   The value of <xref uid="" data-throw-if-not-resolved="false" data-raw-source="dialogId"></xref> 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. If the <xref uid="com.microsoft.bot.schema.Activity.locale" data-throw-if-not-resolved="false" data-raw-source="Activity#locale"></xref> of
                   the <xref uid="com.microsoft.bot.dialogs.DialogContext" data-throw-if-not-resolved="false" data-raw-source="DialogContext"></xref>
                   .<xref uid="com.microsoft.bot.dialogs.DialogContext.context" data-throw-if-not-resolved="false" data-raw-source="DialogContext#context"></xref>
                   .<xref uid="" data-throw-if-not-resolved="false" data-raw-source="ITurnContext#activity"></xref> is specified, then that
                   local is used to determine language specific behavior;
                   otherwise the <xref uid="" data-throw-if-not-resolved="false" data-raw-source="defaultLocale"></xref> is used. US-English
                   is the used if no language or default locale is
                   available, or if the language or locale is not
                   otherwise supported.
validator - 可选为 {@link PromptValidator{FoundChoice}},其中包含对此提示的其他自定义验证。
defaultLocale - 可选,用于确定提示语言特定行为的默认区域设置。 区域设置是由 2、3 或 4 个字符组成的 ISO 639 代码,代表某种语言或语言系列。

方法详细信息

getChoiceOptions

public ChoiceFactoryOptions getChoiceOptions()

获取传递给 的其他选项, ChoiceFactory 并用于调整呈现给用户的选项样式。

Returns:

用于显示选项集的其他选项。

getConfirmChoices

public Pair getConfirmChoices()

获取提示的“是”和“否 Choice ”。

Returns:

提示为“是”和“否 Choice ”。

getDefaultLocale

public String getDefaultLocale()

设置或设置用于确定提示语言特定行为的默认区域设置。

Returns:

用于确定提示语言特定行为的默认区域设置。

getStyle

public ListStyle getStyle()

获取向用户显示提示时要使用的样式。

Returns:

向用户显示提示时要使用的样式。

onPrompt

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

提示用户输入。

Overrides:

ConfirmPrompt.onPrompt(TurnContext turnContext, Map<String,Object> state, PromptOptions options, Boolean isRetry)

Parameters:

turnContext - 与用户当前轮次对话的上下文。
state - 包含对话框堆栈上提示的当前实例的状态。
options - 一个提示选项 对象,该对象是从调用 中最初提供的选项构造的 prompt(String dialogId, PromptOptions options)
isRetry - 如果这是堆栈上的此提示对话框实例首次提示用户输入,则为 true;否则为 false。

Returns:

表示异步操作的 CompletableFuture

onRecognize

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

尝试识别用户的输入。

Overrides:

ConfirmPrompt.onRecognize(TurnContext turnContext, Map<String,Object> state, PromptOptions options)

Parameters:

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

Returns:

表示异步操作的 CompletableFuture。 如果任务成功,则结果描述识别尝试的结果。

setChoiceOptions

public void setChoiceOptions(ChoiceFactoryOptions choiceOptions)

设置传递给 ChoiceFactory 的其他选项,并用于调整呈现给用户的选项样式。

Parameters:

choiceOptions - 用于显示选项集的其他选项。

setConfirmChoices

public void setConfirmChoices(Pair confirmChoices)

为提示设置“是”和“否 Choice ”。

Parameters:

confirmChoices - 提示为“是”和“否 Choice ”。

setDefaultLocale

public void setDefaultLocale(String defaultLocale)

设置用于确定提示语言特定行为的默认区域设置。

Parameters:

defaultLocale - 用于确定提示语言特定行为的默认区域设置。

setStyle

public void setStyle(ListStyle style)

设置向用户显示提示时要使用的样式。

Parameters:

style - 向用户显示提示时要使用的样式。

适用于