如果我的胶囊需要允许用户从enum
表示的一组固定值中进行选择,我该如何在Bixby中做到这一点?
答案 0 :(得分:1)
我们将固定值表示为枚举
enum (FixedValue) {
symbol (ONE)
symbol (TWO)
symbol (THREE)
symbol (FOUR)
}
动作文件如下所示
action (GetFixedValue) {
type(Search)
description (Allow user to choose a value from the set of fixed values)
collect{
input (fixedValue) {
type (FixedValue)
min (Required) max (One)
prompt-behavior (AlwaysElicitation)
default-init {
intent {
goal: FixedValue
value-set {FixedValue {FixedValue(ONE) FixedValue(TWO) FixedValue(THREE) FixedValue(FOUR) }}
}
}
}
} output (FixedValue)
}
此操作的Javascript文件如下:
module.exports.function = function GetFixedValue (fixedValue) {
return JSON.stringify(fixedValue)
}