AdaptiveDialog class
The Adaptive Dialog models conversation using events and events to adapt dynamically to changing conversation flow.
- Extends
-
DialogContainer<O>
Constructors
Adaptive |
Creates a new |
Properties
$kind | |
auto |
Whether to end the dialog when there are no actions to execute. |
condition |
|
default |
The property to return as the result when the dialog ends when there are no more Actions and |
generator | Optional. Language Generator override. |
recognizer | Optional. Recognizer used to analyze any message utterances. |
schema | Sets the JSON Schema for the dialog. Gets the JSON Schema for the dialog. |
selector | Optional. The selector for picking the possible events to execute. |
triggers | Trigger handlers to respond to conditions which modify the executing plan. |
Inherited Properties
dialogs | The containers dialog set. |
End |
Gets a default end-of-turn result. |
id | |
telemetry |
Methods
begin |
Called when the dialog is started and pushed onto the dialog stack. |
continue |
Called when the dialog is continued, where it is the active dialog and the user replies with a new activity. |
create |
Creates a child DialogContext for the given context. |
end |
Called when the dialog is ending. |
get |
|
get |
Gets Dialog enumerated dependencies. |
reprompt |
Reprompts the user. |
resume |
Called when a child dialog completed its turn, returning control to this dialog. |
Inherited Methods
configure(Record<string, unknown>) | Fluent method for configuring the object. |
find |
Finds a child dialog that was previously added to the container. |
get |
An encoded string used to aid in the detection of bot changes on re-deployment. |
on |
Called when an event has been raised, using |
Constructor Details
AdaptiveDialog(string)
Creates a new AdaptiveDialog
instance.
new AdaptiveDialog(dialogId?: string)
Parameters
- dialogId
-
string
(Optional) unique ID of the component within its parents dialog set.
Property Details
$kind
static $kind: string
Property Value
string
autoEndDialog
Whether to end the dialog when there are no actions to execute.
autoEndDialog: BoolExpression
Property Value
BoolExpression
Remarks
If true, when there are no actions to execute, the current dialog will end. If false, when there are no actions to execute, the current dialog will simply end the turn and still be active. Defaults to a value of true.
conditionTracker
static conditionTracker: string
Property Value
string
defaultResultProperty
The property to return as the result when the dialog ends when there are no more Actions and AutoEndDialog = true
.
defaultResultProperty: string
Property Value
string
Remarks
Defaults to a value of dialog.result
.
generator
Optional. Language Generator override.
generator?: LanguageGenerator
Property Value
recognizer
Optional. Recognizer used to analyze any message utterances.
recognizer?: Recognizer
Property Value
Recognizer
schema
Sets the JSON Schema for the dialog. Gets the JSON Schema for the dialog.
object schema
Property Value
object
The dialog schema.
selector
Optional. The selector for picking the possible events to execute.
selector: TriggerSelector
Property Value
triggers
Trigger handlers to respond to conditions which modify the executing plan.
triggers: OnCondition[]
Property Value
Inherited Property Details
dialogs
The containers dialog set.
dialogs: DialogSet
Property Value
DialogSet
Inherited From DialogContainer.dialogs
EndOfTurn
Gets a default end-of-turn result.
static EndOfTurn: DialogTurnResult
Property Value
DialogTurnResult
Remarks
This result indicates that a dialog (or a logical step within a dialog) has completed processing for the current turn, is still active, and is waiting for more input.
Inherited From Dialog.EndOfTurn
id
id: string
Property Value
string
Inherited From Dialog.id
telemetryClient
telemetryClient: BotTelemetryClient
Property Value
BotTelemetryClient
Inherited From DialogContainer.telemetryClient
Method Details
beginDialog(DialogContext, O)
Called when the dialog is started and pushed onto the dialog stack.
function beginDialog(dc: DialogContext, options?: O): Promise<DialogTurnResult>
Parameters
- dc
-
DialogContext
The DialogContext for the current turn of conversation.
- options
-
O
Optional, initial information to pass to the dialog.
Returns
Promise<DialogTurnResult>
A Promise representing the asynchronous operation.
continueDialog(DialogContext)
Called when the dialog is continued, where it is the active dialog and the user replies with a new activity.
function continueDialog(dc: DialogContext): Promise<DialogTurnResult>
Parameters
- dc
-
DialogContext
The DialogContext for the current turn of conversation.
Returns
Promise<DialogTurnResult>
A Promise representing the asynchronous operation.
createChildContext(DialogContext)
Creates a child DialogContext for the given context.
function createChildContext(dc: DialogContext): DialogContext
Parameters
- dc
-
DialogContext
The DialogContext for the current turn of conversation.
Returns
DialogContext
The child DialogContext or null if no AdaptiveDialogState.actions are found for the given context.
endDialog(TurnContext, DialogInstance, DialogReason)
Called when the dialog is ending.
function endDialog(turnContext: TurnContext, instance: DialogInstance, reason: DialogReason): Promise<void>
Parameters
- turnContext
-
TurnContext
The context object for this turn.
- instance
-
DialogInstance
State information associated with the instance of this dialog on the dialog stack.
- reason
-
DialogReason
Reason why the dialog ended.
Returns
Promise<void>
A Promise representing the asynchronous operation.
getConverter(Object)
function getConverter(property: Object): Converter | ConverterFactory
Parameters
- property
-
Object
The key of the conditional selector configuration.
Returns
Converter | ConverterFactory
The converter for the selector configuration.
getDependencies()
Gets Dialog enumerated dependencies.
function getDependencies(): Dialog[]
Returns
Dialog[]
(xref:botbuilder-dialogs.Dialog)'s enumerated dependencies.
repromptDialog(DialogContext | TurnContext, DialogInstance)
Reprompts the user.
function repromptDialog(context: DialogContext | TurnContext, instance: DialogInstance): Promise<void>
Parameters
- context
-
DialogContext | TurnContext
The context object for the turn.
- instance
-
DialogInstance
Current state information for this dialog.
Returns
Promise<void>
A Promise representing the asynchronous operation.
resumeDialog(DialogContext, DialogReason, any)
Called when a child dialog completed its turn, returning control to this dialog.
function resumeDialog(dc: DialogContext, _reason?: DialogReason, _result?: any): Promise<DialogTurnResult>
Parameters
- dc
-
DialogContext
The dialog context for the current turn of the conversation.
- _reason
-
DialogReason
Reason why the dialog resumed.
- _result
-
any
Optional, value returned from the dialog that was called. The type of the value returned is dependent on the child dialog.
Returns
Promise<DialogTurnResult>
A Promise representing the asynchronous operation.
Inherited Method Details
configure(Record<string, unknown>)
Fluent method for configuring the object.
function configure(config: Record<string, unknown>): this
Parameters
- config
-
Record<string, unknown>
Configuration settings to apply.
Returns
this
The Configurable after the operation is complete.
Inherited From Configurable.configure
findDialog(string)
Finds a child dialog that was previously added to the container.
function findDialog(dialogId: string): Dialog | undefined
Parameters
- dialogId
-
string
ID of the dialog to lookup.
Returns
Dialog | undefined
The Dialog if found; otherwise null.
Inherited From DialogContainer.findDialog
getVersion()
An encoded string used to aid in the detection of bot changes on re-deployment.
function getVersion(): string
Returns
string
Unique string which should only change when dialog has changed in a way that should restart the dialog.
Remarks
This defaults to returning the dialogs id but can be overridden to provide more
precise change detection logic. Any dialog on the stack that has its version change will
result in a versionChanged
event will be raised. If this event is not handled by the bot,
an error will be thrown resulting in the bots error handler logic being run.
Returning an empty string will disable version tracking for the component all together.
Inherited From Dialog.getVersion
onDialogEvent(DialogContext, DialogEvent)
Called when an event has been raised, using DialogContext.emitEvent()
,
by either the current dialog or a dialog that the current dialog started.
function onDialogEvent(dc: DialogContext, e: DialogEvent): Promise<boolean>
Parameters
- dc
-
DialogContext
The dialog context for the current turn of conversation.
- e
-
DialogEvent
The event being raised.
Returns
Promise<boolean>
True if the event is handled by the current dialog and bubbling should stop.
Inherited From DialogContainer.onDialogEvent