0

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

端点

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。请指导。

4

1 回答 1

0
  1. 您需要在动作模型 PlayArtist 和动作模型 BuildArtistAudioInfo 中输入艺术家 ID,这就是艺术家 ID 作为参数传递给 BuildArtistAudioInfo.js 的方式
  2. computed-input (artistToPlay),意图块应该有一个值字段
  3. 使用valueintent 而不是value-set,因为它是单个值,而不是集合
  4. 确保在 endpoints.bxb 中正确地将 JS 文件链接到动作模型,即接受的输入和参数名称必须匹配。
于 2019-07-08T18:40:58.677 回答