This commit is contained in:
coldplaying42 2021-06-29 17:07:28 +08:00
Родитель f03627c066
Коммит 006d11f6c6
7 изменённых файлов: 146 добавлений и 123 удалений

Просмотреть файл

@ -25,16 +25,6 @@
>> OnChooseProperty
# chooseProperties
> Choose properties activity
[Activity
Text = ${chooseProperties_text()}
]
# chooseProperties_text
> Choose between different properties
- Did you mean ${choices(turn.dialogEvent.value, 'chooseProperty', 'or')}?
# chooseProperty(property)
> Display a possible property assignment
- ${displayOperation(property.operation, property.property, property.value)}

Просмотреть файл

@ -0,0 +1,140 @@
[form.en-us.lg](form.en-us.lg)
>> OnChooseProperty Prompt
# chooseProperties
> Choose properties activity
[Activity
Text = ${chooseProperties_text()}
]
# chooseProperties_text
> Choose between different properties
- Did you mean ${choices(turn.dialogEvent.value, 'chooseProperty', 'or')}?
>> Show Card Prompt
# propertiesAsActivity(name, properties)
> Display value for properties as an activity
[Activity
Attachments=${json(propertiesAsCard(name, properties))}
]
# propertiesAsCard(name, properties)
> Display value for properties as a card
-```
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "${name}",
"size": "large"
},
{
"type": "FactSet",
"facts": [${propertiesAsFacts(properties)}]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
```
# propertiesAsFacts(properties)
> Display property values as card facts
- ${join(foreach(properties, property, getPropertyAsFact(property)), ', ')}
# getPropertyAsFact(property)
> Display property value as a card fact
- {"title": "${propertyName(property)}", "value": "${replace(propertyValue(property, dialog[property]), '"', '\"')}"}
>> Help Global Prompt
# helpGlobal()
> Global help message activity
[Activity
Text = ${helpGlobal_text()}
]
# helpGlobal_text()
> Global help message
- ```
${requiredProperties()}
${optionalProperties()}
For each property you can add/remove values, clear, show, change or ask for help.
You can also ask for overall help, cancel the whole form or skip a step.```
# requiredProperties
> Display value for required properties
- IF: ${count($requiredProperties) > 0}
- Required properties include: ${join(foreach($requiredProperties, property, propertyName(property)), ', ')}
- ELSE:
-
# optionalProperties
> Display value for optional properties
- IF: ${count(publicProperties()) > count($requiredProperties)}
- Optional properties include: ${join(foreach(where(publicProperties(), property, !contains($requiredProperties, property)), property, propertyName(property)), ', ')}${EOL()}
- ELSE:
-
>> Help Reprompt
# helpReprompt
> Display reprompt activity
[Activity
Text = ${helpReprompt_text()}
]
# helpReprompt_text
> Display value on reprompt
- ${if($expectedProperties, join(foreach(where($expectedProperties, expected, isTemplate(`${expected}_RepromptHelp_text`)), expected, template(`${expected}_RepromptHelp_text`)), EOL()), '')}
>> Cancel Prompt
# cancelPrompt
> Prompt activity to cancel a form
[Activity
Text = ${cancelPrompt_text()}
]
# cancelPrompt_text
> Prompt to cancel a form
- Do you want to end the form? (yes/no)
>> Change Property Prompt
# changePropertyPrompt
> Prompt activity for property to change
[Activity
Text = ${changePropertyPrompt_text()}
]
# changePropertyPrompt_text
> Prompt for property to change
- Is there any property you want to change? (no or the property name)
>> Choose Property Prompt
# choosePropertyPrompt
> Prompt activity for what property to change
[Activity
Text = ${choosePropertyPrompt_text()}
]
# choosePropertyPrompt_text
> Prompt for what property to change
- Which property do you want to change?
>> not Understood Prompt
# notUnderstood
> Message for not understanding activity
[Activity
Text = ${notUnderstood_text()}
]
# notUnderstood_text
> Message for not understanding
- Sorry, I do not understand ${join(foreach(turn.unrecognizedtext, chunk, `'${chunk}'`), ' or ')}

Просмотреть файл

@ -1,11 +1,5 @@
[form.en-us.lg]
# propertiesAsActivity(name, properties)
> Display value for properties as an activity
[Activity
Attachments=${json(propertiesAsCard(name, properties))}
]
# propertiesAsText
> Display value for properties as text
- ${join(foreach($requiredProperties, property, getPropertyValueDescriptionText(property)), EOL())}
@ -14,31 +8,3 @@
> Display value for a property
- The value of ${propertyName(property)} is ${propertyValue(property, dialog[property])}.
# propertiesAsCard(name, properties)
> Display value for properties as a card
-```
{
"type": "AdaptiveCard",
"version": "1.0",
"body": [
{
"type": "TextBlock",
"text": "${name}",
"size": "large"
},
{
"type": "FactSet",
"facts": [${propertiesAsFacts(properties)}]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
```
# propertiesAsFacts(properties)
> Display property values as card facts
- ${join(foreach(properties, property, getPropertyAsFact(property)), ', ')}
# getPropertyAsFact(property)
> Display property value as a card fact
- {"title": "${propertyName(property)}", "value": "${replace(propertyValue(property, dialog[property]), '"', '\"')}"}

Просмотреть файл

@ -43,44 +43,6 @@
- ELSE:
- no value
# requiredProperties
> Display value for required properties
- IF: ${count($requiredProperties) > 0}
- Required properties include: ${join(foreach($requiredProperties, property, propertyName(property)), ', ')}
- ELSE:
-
# optionalProperties
> Display value for optional properties
- IF: ${count(publicProperties()) > count($requiredProperties)}
- Optional properties include: ${join(foreach(where(publicProperties(), property, !contains($requiredProperties, property)), property, propertyName(property)), ', ')}${EOL()}
- ELSE:
-
# helpGlobal()
> Global help message activity
[Activity
Text = ${helpGlobal_text()}
]
# helpGlobal_text()
> Global help message
- ```
${requiredProperties()}
${optionalProperties()}
For each property you can add/remove values, clear, show, change or ask for help.
You can also ask for over all help, cancel the whole form or skip a step.```
# helpReprompt
> Display reprompt activity
[Activity
Text = ${helpReprompt_text()}
]
# helpReprompt_text
> Display value on reprompt
- ${if($expectedProperties, join(foreach(where($expectedProperties, expected, isTemplate(`${expected}_RepromptHelp_text`)), expected, template(`${expected}_RepromptHelp_text`)), EOL()), '')}
# publicProperties
> Public properties from schema
-${dialogClass.schema.$public}
@ -124,46 +86,6 @@ You can also ask for over all help, cancel the whole form or skip a step.```
> Display confirmation message on update
- ${template(if(dialog[property], `${property}_UnexpectedUpdateConfirmation`, `${property}_UnexpectedSetConfirmation`), val)}
# cancelPrompt
> Prompt activity to cancel a form
[Activity
Text = ${cancelPrompt_text()}
]
# cancelPrompt_text
> Prompt to cancel a form
- Do you want to end the form? (yes/no)
# changePropertyPrompt
> Prompt activity for property to change
[Activity
Text = ${changePropertyPrompt_text()}
]
# changePropertyPrompt_text
> Prompt for property to change
- Is there any property you want to change? (no or the property name)
# choosePropertyPrompt
> Prompt activity for what property to change
[Activity
Text = ${choosePropertyPrompt_text()}
]
# choosePropertyPrompt_text
> Prompt for what property to change
- Which property do you want to change?
# notUnderstood
> Message for not understanding activity
[Activity
Text = ${notUnderstood_text()}
]
# notUnderstood_text
> Message for not understanding
- Sorry, I do not understand ${join(foreach(turn.unrecognizedtext, chunk, `'${chunk}'`), ' or ')}
>> FUNCTIONS for dialogs
# missingPropertyPriority(property)

Просмотреть файл

@ -0,0 +1,4 @@
[generator.lg](../generator.lg)
# generators
- ${formTemplates('Prompts', '.lg')}

Просмотреть файл

@ -53,6 +53,7 @@
"form-global.lu",
"form-custom.lu",
"form-Show.lg",
"form-Prompts.lg",
"form.lg",
"locale.lu",
"locale.lg",

Просмотреть файл

@ -262,7 +262,7 @@ describe('dialog:generate library', async () => {
await checkDirectory(ppath.join(output, 'language-understanding'), 0, 1)
await checkDirectory(ppath.join(output, 'language-generation', 'en-us'), 1, 15)
await checkDirectory(ppath.join(output, 'language-understanding', 'en-us'), 1, 10)
await checkPattern(ppath.join(output, '**'), 136)
await checkPattern(ppath.join(output, '**'), 137)
} catch (e) {
assert.fail(e.message)
}