@@ -28,14 +28,13 @@ class Prompt(Dialog):
28
28
Defines the core behavior of prompt dialogs. Extends the :class:`Dialog` base class.
29
29
30
30
.. remarks::
31
-
32
31
When the prompt ends, it returns an object that represents the value it was prompted for.
33
32
Use :meth:`DialogSet.add()` or :meth:`ComponentDialog.add_dialog()` to add a prompt to
34
33
a dialog set or component dialog, respectively.
34
+
35
35
Use :meth:`DialogContext.prompt()` or :meth:`DialogContext.begin_dialog()` to start the prompt.
36
36
If you start a prompt from a :class:`WaterfallStep` in a :class:`WaterfallDialog`, then the
37
37
prompt result will be available in the next step of the waterfall.
38
-
39
38
"""
40
39
41
40
ATTEMPT_COUNT_KEY = "AttemptCount"
@@ -46,11 +45,10 @@ def __init__(self, dialog_id: str, validator: object = None):
46
45
"""
47
46
Creates a new :class:`Prompt` instance.
48
47
49
- :param dialog_id: Unique Id of the prompt within its parent :class:`DialogSet` or
50
- :class:`ComponentDialog`.
48
+ :param dialog_id: Unique Id of the prompt within its parent :class:`DialogSet`
49
+ :class:`ComponentDialog`
51
50
:type dialog_id: str
52
- :param validator: Optional custom validator used to provide additional validation and re-prompting
53
- logic for the prompt.
51
+ :param validator: Optionally provide additional validation and re-prompting logic
54
52
:type validator: Object
55
53
"""
56
54
super (Prompt , self ).__init__ (dialog_id )
@@ -66,13 +64,12 @@ async def begin_dialog(
66
64
:param dialog_context: The dialog context for the current turn of the conversation
67
65
:type dialog_context: :class:`DialogContext`
68
66
:param options: Optional, additional information to pass to the prompt being started
69
- :type options: object
67
+ :type options: Object
70
68
:return: The dialog turn result
71
69
:rtype: :class:`DialogTurnResult`
72
70
73
71
.. note::
74
-
75
- If the task is successful, the result indicates whether the prompt is still active after the turn has been processed.
72
+ The result indicates whether the prompt is still active after the turn has been processed.
76
73
"""
77
74
if not dialog_context :
78
75
raise TypeError ("Prompt(): dc cannot be None." )
@@ -102,19 +99,21 @@ async def begin_dialog(
102
99
103
100
async def continue_dialog (self , dialog_context : DialogContext ):
104
101
"""
105
- Con
8000
tinues a dialog. Called when a prompt dialog is the active dialog and the user replied with a new activity.
102
+ Continues a dialog.
106
103
107
104
:param dialog_context: The dialog context for the current turn of the conversation
108
105
:type dialog_context: :class:`DialogContext`
109
106
:return: The dialog turn result
110
107
:rtype: :class:`DialogTurnResult`
111
108
112
109
.. remarks::
113
- If the task is successful, the result indicates whether the dialog is still
114
- active after the turn has been processed by the dialog.
110
+ Called when a prompt dialog is the active dialog and the user replied with a new activity.
111
+
112
+ If the task is successful, the result indicates whether the dialog is still active after
113
+ the turn has been processed by the dialog.
114
+
115
115
The prompt generally continues to receive the user's replies until it accepts the
116
116
user's reply as valid input for the prompt.
117
-
118
117
"""
119
118
if not dialog_context :
120
119
raise TypeError ("Prompt(): dc cannot be None." )
@@ -161,20 +160,21 @@ async def resume_dialog(
161
160
:param reason: An enum indicating why the dialog resumed.
162
161
:type reason: :class:`DialogReason`
163
162
:param result: Optional, value returned from the previous dialog on the stack.
164
- The type of the value returned is dependent on the previous dialog.
165
163
:type result: object
166
164
:return: The dialog turn result
167
165
:rtype: :class:`DialogTurnResult`
168
166
169
167
.. remarks::
170
-
171
168
Called when a prompt dialog resumes being the active dialog on the dialog stack,
172
169
such as when the previous active dialog on the stack completes.
170
+
173
171
If the task is successful, the result indicates whether the dialog is still
174
172
active after the turn has been processed by the dialog.
173
+
175
174
Prompts are typically leaf nodes on the stack but the dev is free to push other dialogs
176
175
on top of the stack which will result in the prompt receiving an unexpected call to
177
176
:meth:resume_dialog() when the pushed on dialog ends.
177
+
178
178
Simply re-prompt the user to avoid that the prompt ends prematurely.
179
179
180
180
"""
@@ -183,7 +183,7 @@ async def resume_dialog(
183
183
184
184
async def reprompt_dialog (self , context : TurnContext , instance : DialogInstance ):
185
185
"""
186
- Reprompts user for input. Called when a prompt dialog has been requested to re-prompt the user for input.
186
+ Reprompts user for input.
187
187
188
188
:param context: Context for the current turn of conversation with the user
189
189
:type context: :class:`botbuilder.core.TurnContext`
@@ -214,8 +214,7 @@ async def on_prompt(
214
214
:param options: A prompt options object constructed from the options initially provided
215
215
in the call :meth:`DialogContext.prompt()`
216
216
:type options: :class:`PromptOptions`
217
- :param is_retry: true if this is the first time this prompt dialog instance on the stack is prompting
218
- the user for input; otherwise, false
217
+ :param is_retry: true if is the first time the user for input; otherwise, false
219
218
:type is_retry: bool
220
219
221
220
:return: A task representing the asynchronous operation.
@@ -230,7 +229,7 @@ async def on_recognize(
230
229
options : PromptOptions ,
231
230
):
232
231
"""
233
- Recognizes the user's input. When overridden in a derived class, attempts to recognize the user's input.
232
+ Recognizes the user's input.
234
233
235
234
:param turn_context: Context for the current turn of conversation with the user
236
235
:type turn_context: :class:`botbuilder.core.TurnContext`
@@ -242,6 +241,8 @@ async def on_recognize(
242
241
243
242
:return: A task representing the asynchronous operation.
244
243
244
+ .. note::
245
+ When overridden in a derived class, attempts to recognize the user's input.
245
246
"""
246
247
247
248
def append_choices (
0 commit comments