Have the DialogManager return the value based on a key if it's present with a label fallback

This commit is contained in:
Oliver-Akins 2024-09-21 18:07:07 -06:00
parent 460ba9e4f1
commit dde0b21b19

View file

@ -79,7 +79,7 @@ export class DialogManager {
/**
* Asks the user to provide a simple piece of information, this is primarily
* intended to be used within macros so that it can have better info gathering
* as needed. This returns an object of input labels to the value the user
* as needed. This returns an object of input keys/labels to the value the user
* input for that label, if there is only one input, this will return the value
* without an object wrapper, allowing for easier access.
*/
@ -149,7 +149,7 @@ export class DialogManager {
break;
}
Logger.debug(`Ask response: ${value} (type: ${typeof value})`);
answers[i.label] = value;
answers[i.key ?? i.label] = value;
if (data.inputs.length === 1) {
resolve(value);
return;