0

I am showing artist to user and following up by asking if user wanted to listen the song of this artist.

Endpoint

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)
}

Follow-up

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.)
   }
 }
}

Now i need to pass this value to PlayArtist action file but after seeing your sample capsule i am confused where to pass the input.

PlayArtist Action file

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)
}

Do i need to extra accept-input? also BuildArtistAudioInfo.js file has songs info, so i need to get the artist id here and proceed it to the api where I will get song info. please guide.

Rahul Gupta
  • 972
  • 11
  • 29

1 Answers1

0
  1. You need an input artistID in action model PlayArtist and action model BuildArtistAudioInfo, that's how the artistID pass to BuildArtistAudioInfo.js as an argument
  2. In computed-input (artistToPlay), intent block should have a value field
  3. Use value in intent instead of value-set, since it's single value, not a set
  4. Make sure in endpoints.bxb you correctly link JS file to action model, that is accepted input and argument name must match.