2017-11-29 22 views
0

내 Google 홈에 맞춤 전송 기능을 추가하고 싶습니다. 내가 지금 무슨 짓을했는지 지금까지이 페이지에서 Dialogflow를 사용하여 튜토리얼을했다 :내 필요에 맞게 사용자 정의 된 Google 홈용 전송 기능을 구현할 수 있습니까?

https://github.com/googlecast/CastHelloVideo-chrome/blob/master/helloVideos.js가 그럼 난 결합 시도 : 나는 단지 PC에서가 아니라 Google 홈에서 Chromecast에 비디오를 캐스팅에 대해 REPO을 발견 그런

https://developers.google.com/actions/dialogflow/first-app 둘. 난 단지 지금까지 내 Chromecast에 연결을 시도했지만,이 오류마다 얻을 :

API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find field.". 

내가 튜토리얼 작품을 만들어를, 그래서, Dialogflow에 전용하는 index.js 파일을 아무것도 변경하지 않았다 .

'use strict'; 

process.env.DEBUG = 'actions-on-google:*'; 
const App = require('actions-on-google').DialogflowApp; 
const functions = require('firebase-functions'); 


// a. the action name from the make_name Dialogflow intent 
const NAME_ACTION = 'game_cast'; 
// b. the parameters that are parsed from the make_name intent 
const COLOR_ARGUMENT = 'color'; 
const NUMBER_ARGUMENT = 'number'; 


exports.gameCast = functions.https.onRequest((request, response) => { 
    const app = new App({request, response}); 
    console.log('Request headers: ' + JSON.stringify(request.headers)); 
    console.log('Request body: ' + JSON.stringify(request.body)); 


// c. The function that generates the silly name 
    function gameCast (app) { 
    let number = app.getArgument(NUMBER_ARGUMENT); 
    let color = app.getArgument(COLOR_ARGUMENT); 
// app.tell('Alright, your silly name is ' + 
//  color + ' ' + number + 
//  '! I hope you like it. See you next time.'); 
    launchApp(); 
    } 

    // d. build an action map, which maps intent names to functions 
    let actionMap = new Map(); 
    actionMap.set(NAME_ACTION, gameCast); 


app.handleRequest(actionMap); 
}); 

gameCast 함수의 launchApp() 함수 호출 내에서 Chromecast에 연결하는 것입니다 :

내 파일입니다. 또한 helloVideos.js의 전체 내용을 추가 했으므로 launchApp()에서 사용할 수있는 누락 된 함수가 없습니다. (helloVideos.js 파일에는 617 줄의 코드가 있으므로 원래 파일은 여기에 포함되지 않았습니다.)

모든 의견을 크게 환영합니다! 감사!

+0

[SO 게시물]에서 제안 된 답변을 시도해보십시오. (https://stackoverflow.com/questions/46179147/api-ai-actions-on-google-failed-to-parse-json-response-string- with-invalid-ar)? –

답변

0

Google 액션의 의도가 api.ai 콘솔의 gamecast와 다른 경우 "필드를 찾을 수 없음"이 표시됩니다.

google cloud back end https://console.cloud.google.com으로 이동하여 로깅 오류를 확인할 수 있습니다.