Bixby:音频播放器概念

时间:2019-07-08 11:20:02

标签: bixby bixbystudio

我正在向用户展示艺术家,并通过询问用户是否要听这位艺术家的歌曲来跟进。

端点

action-endpoint (PlayArtist) {
  accepted-inputs (artist_id)   // here too yellow line (Missing required input `artistToPlay`)
  local-endpoint (PlayArtist.js)
}
action-endpoint (BuildArtistAudioInfo) {
  accepted-inputs (artist_id)
  local-endpoint (BuildArtistAudioInfo.js)
}

BuildArtistAudioInfo.model.bxb

action (BuildArtistAudioInfo) {
  type (Search)
  description (Makes a meow info to play.)
  collect{
    input (artist_id){
      type (ArtistID)
      min (Optional)
      max (One)
    }
  }
  output (audioPlayer.AudioInfo)
}

跟进

followup {
  prompt {
    dialog (Would you like to play music for this artist)
      on-confirm {
        if (false) {
          message (I see...)
        } else {
          intent {
            goal: PlayArtist
            value: $expr(singleArtistEvent.artistId)
          }
      }
   }
   on-deny {
      message (OK friend.)
   }
 }
}

现在,我需要将此值传递给PlayArtist动作文件,但是在看到您的样品囊之后,我很困惑将输入传递到哪里。

PlayArtist动作文件

action (PlayArtist) {
  type (Search)
  collect {
     input (artist_id){
       type (ArtistID)
       min (Optional)
       max (One)
     }
     computed-input (artistToPlay) {
        description (Create the playlist to play)
        type (audioPlayer.AudioInfo)
        min (Required) max (One)
        compute {
           intent {
             goal: BuildArtistAudioInfo
             value:ArtistID(artist_id) // i am confused over here, it's giving error ()
           }
        }
        //hidden     
     }

     computed-input (play) {
         description (By passing in the AudioInfo object to the PlayAudio action, we ask the client to play our sound.)
         type (audioPlayer.Result)
         compute {
            intent {
              goal: audioPlayer.PlayAudio
              value: $expr(artistToPlay)
            }
         }
         //hidden
      }
  }
  output (Result)
}

我需要多加accept-input吗?此外,BuildArtistAudioInfo.js文件还具有歌曲信息,因此我需要在此处获取歌手ID,然后将其转到api,我将在其中获取歌曲信息。请指导。

1 个答案:

答案 0 :(得分:1)

  1. 在动作模型PlayArtist和动作模型BuildArtistAudioInfo中需要输入artistID,这是artistID作为参数传递给BuildArtistAudioInfo.js的方式
  2. computed-input (artistToPlay)中,意图块应具有一个值字段
  3. 在意图上使用value代替value-set,因为它是单个值而不是集合
  4. 确保在endpoints.bxb中将JS文件正确链接到动作模型,即可接受的输入和参数名称必须匹配。