0

If my capsule has a requirement to allow a user to select from a set of fixed values represented by an enum, how can I do that in Bixby?

4

1 回答 1

0

我们将把固定值表示为一个枚举

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)
}
于 2019-02-26T19:28:48.220 回答