# Case: Film Grading Skills

This case will use the movie rating query service API (provided by Douban Movie) to introduce: how to associate the slot value returned by the API to the Mini Program path, directly to the Mini Program page of the query content.

# Effect display

There are a variety of scenarios for querying movie ratings, and this case is configured in two scenarios:

  1. The user directly initiates the query of the movie score (intention: query the movie rating)
  2. First query the cast list of a movie, and then query the movie rating of the movie (Intention: cast list, cast list - second round)

For example, when the user wants to query the movie rating of "Chinese Captain," the robot answers the mini-program card that can directly reach the corresponding page of "Chinese Captain," and displays the number of ratings and evaluations of the movie "Chinese Captain" on the mini-program card. movie movie

# Step 1: Creating Intent

Create the advanced skill "Movie Rating Query," adding the following three intents.

movie

# Step 2: Add User Questions

In the "Query Movie Ratings" intent, we configure common questions for users to query movie ratings. If the user directly gives the name of the movie to be searched, we can configure the user's query with the "movie name" semantic slot. If the user does not give the name of the movie to be searched, we can set up the query in the semantic slot later. movie In the intention of "actor list" (the first round of querying the actor list of a film) and "actor table-second round" (the second round and then the film score of the film), we supplement the user question method separately. movie movie

# Step 3: Configure the semantic slot settings

From the query movie rating API we know that we need to provide input parameters are "movie name," the API will return the actor, rating, title, type and other output parameters. movie

In the semantic slot settings of the three intentions, we associate the "movie name" semantic slot with the corresponding movie comprehensive dictionary, and open the query to ensure that the input parameters are filled in completely to run the API successfully. movie

# Step 4: Configure the robot to answer

All three intentions use the same API. Under the three intentions, we select the reply type of "service interface call", and select "movie rating query service-movie score query" API, and in the "interface configuration", the input parameter "movie name" corresponding to the previously configured "movie name" semantic slot, to maintain the transmission of semantic slot. Under the "cast list" intention of replying to the main actors list, configure the robot to reply to the main actors. movie Under the intention of "query movie score" and "cast list - second round" in response to query score results, the robot answers the same configuration method, which is a Mini Program card that can directly pull up the target movie page. So we call in the successful state, select "reply results" and select "Mini Program," according to the requirements to fill in the Mini Program information:

  • 【APPID】: APPID's Get Method in Use Document[Create a Question - Reply Directly](https://developers.weixin.qq.com/doc/Speaking/platform/dialog/config_normal.html#*AppId, Small Program Path Acquisition Method)A detailed introduction, in this case, we will pull up the "watercress movie" Mini Program.
  • [Small Program Path]: Under the same Mini Program, different movies have different Mini Program page paths. The interface returns a different path parameter for different movie names. "$ABC $" represents a reference to the slot named "ABC," so we can use the syntax of "$slot name $" to associate the slot information with the path parameter. In the "douvalve movie" Mini Program, the path parameter has been completely given by "doubanjumpurl," and can be filled in directly./$doubanjumpurl$”For Mini Programs where the full path of the output parameter is not given, the slots of the path parameter can be associated after the Mini Programs path, such as: movie
  • [Card Title]: Also associated with the "$slot name $" syntax, the "$slot name $" part of the header text automatically replaces the content value of the corresponding slot. For example, in this case, we fill in the card title "$title $score: $score $," if the semantic slot value of "title" is "Chinese captain," "score" is the semantic slot value of "10," the front display of the card title is "Chinese captain score: 10."
  • [Card Style]: Upload the corresponding image

So in this case, the Mini Program is configured as follows: movie If the query fails, the user is informed that the corresponding movie rating was not found: movie In this way, the three intentions of user questions, semantic slot settings, and robot replies are configured.

# Step 5: Multiple rounds of dialogue

The scene from the cast list to the movie rating query involves multiple rounds of dialogue with sequential order, and there is a certain degree of overlap between asking the movie rating through the cast list and the user asking the movie rating directly, So we chose not to end the conversation at the bottom of the [Cast] Intent page, and set the Priority Hit Intent [Cast - Round 2]. At the same time, in the intention [cast list - second round] above the page select only to undertake the intention [cast list], so that the sequence of multiple rounds of dialogue is also set. movie

Through the above configuration, the skill of querying the movie score is configured, and by associating the slot value returned by the API to the Mini Program path, you can directly pull up the Mini Program page of the corresponding movie, and directly display the movie score on the front-end card. Developers can apply the same logic, according to their own needs, the user into the corresponding Mini Program page in one step.