近期閱讀到 Juna Salviati一篇有關於Interactive Canvas的應用文章,裡面有講述詳細的原理內容。
1.在Dialogflow中建立新的Agent
名稱: InteractiveCanvasDemo
DEFAULT LANGUAGE: English
2. Restore agnet
先下載 https://github.com/antigones/GraphInteractiveCanvas/blob/master/GraphInteractiveCanvasAgent.zip
選擇Agent設定,選擇Export and import,接著選RESTORE FROM ZIP,挑選剛剛所下載的zip file。
點選Intents後會看到,從zip檔案restore成作者zip檔案內容。
3.設定Fulfillment
點選Fulfillment,並且複製以下gist code貼上,請注意其中的
https://<PROJECT_ID>.firebaseapp.com
要替換成下個步驟會提到的firebase的project id。
4. Deploy firebase host
安裝firebase cli的套件
$ npm -g install firebase-tools
git clone 程式碼
$ git clone https://github.com/antigones/GraphInteractiveCanvas.git
$ cd GraphInteractiveCanvas
firebase取的帳號認證
$ firebase login
or
$ firebase login — reauth
選擇所創立的PROJECT_ID
$ firebase use <PROJECT_ID>
Deploy
$ firebase deploy
5.設定action on google
接著跳到https://console.actions.google.com/ 選擇InteractiveCanvasDemo專案,接著最重要的事情就是設定action on google要deploy的屬性設定。
Category選擇Games & fun
Interactive Canvas 請勾選
其他的隨便填
6.測試
結果就如最前面的Gif動畫一樣,為確保結果的一致,請依序輸入:
add node Alice
add node Bob
Alice is friend of Bob
感謝 Juna Salviati 的文章: