-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Docs/example for creating a custom v3.8.x choice prompt? #3129
Comments
@amitbend, you're missing an args.prompt = prompt || args.prompt; This way if Out of curiosity, what are you trying to do with your custom prompt? Are you plugging in NLU via LUIS or API.ai? |
Not sure if this helps, but I had to manually configure some intent matches for my prompts untill I found out my issue was a bug with the source code. What I did was create a new PromptChoice instance and attach intent matches on it. Then I configured the builder.Prompts.choice to use my instance of the PromptChoice instead of the default one.
|
Hi @stevengum97, I'm still trying to tackle #2987. I tried to write an @haakotsm I have a dynamic list of choices, so I can't hard code them. Thanks for trying to help anyway. |
@amitbend re-reading my comment I may have been a little unclear... I'm actually referring to Here's an example of what I'm talking about: var customPrompt = new builder.PromptChoice({
defaultListStyle: builder.ListStyle.button,
disableRecognizer: true
});
customPrompt.onRecognize(function (context, callback) {
recognizer.recognize(context, function (err, result) {
// If we don't get an error from recognizer.recognize
// we'll either send send the LUIS results along or trigger
// our custom prompt to re-prompt the user.
if (!err) {
if (result && result.intent !== 'None') {
callback(null, result.score, result);
} else {
callback(null, 0.0, { intent: 'None', score: 0.0 });
}
} else {
callback(err, 0.0);
}
})
})
bot.dialog('CustomPrompt', customPrompt);
builder.Prompts.customPrompt = function (session, prompt, choices, options) {
var args = options || {};
args.choices = choices || args.choices;
args.prompt = prompt || args.prompt;
session.beginDialog('CustomPrompt', args);
} Also, I don't see any choices handling here: builder.Prompts.destChoice = function (session, prompt, options) {
console.log(prompt,options);
var args = options || {};
args.prompt = prompt || options.prompt;
session.beginDialog('destChoice', args);
} I assume you're passing the choices in via the |
I'm closing the issue due to inactivity; if you're still having difficulty, please feel free to reopen this issue. |
@amitbend I had to make sure my choices are passed in as an array of objects: |
System Information (Required)
Issue Description
I'm trying to create a custom choice prompt using the new v3.8.x mechanism, but i can't seem to find any references of how to do it correctly.
I tried to play with it, but I don't see any quick replies as I should.
Code Example
The text was updated successfully, but these errors were encountered: