LoginSignup
0
0

More than 5 years have passed since last update.

永続値が保存できない・・・なぜだろう?

Last updated at Posted at 2018-10-12

Dialogflow v2 に挑戦しています。

永続値を保存しようとして、以下のシンプルなコードを試しましたが、
永続値が取得できなかった。何か間違っているのだろうか?

index.js
'use strict';

const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');

const app = dialogflow();

app.intent('FirstIntent', conv => {
    conv.user.storage.value = 'A';
    conv.followup('SecondEvent');
});

app.intent('SecondIntent', conv => {
    conv.close('value is ' + conv.user.storage.value);
});

exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
package.json
{
  "name": "dialogflowFirebaseFulfillment",
  "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "8"
  },
  "scripts": {
    "start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
    "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
  },
  "dependencies": {
    "actions-on-google": "^2.2.0",
    "firebase-admin": "^5.13.1",
    "firebase-functions": "^2.0.2",
    "dialogflow": "^0.6.0",
    "dialogflow-fulfillment": "^0.6.1"
  }
}

まず、FirstIntentが呼ばれて、
永続値を保存してからSecondEventを発生させます。
次に、SecondIntentが呼ばれて、
永続値を読み込んでから「Value is A」の応答を返す想定ですが、
「Value is undefined」と表示されてしまいます。

以下のログを見つけました。

Billing account not configured. 
External network is not accessible and quotas are severely limited. 
Configure billing account to remove these restrictions

課金しなければならないように見えたのでflameにアップグレードし、
このログが表示されないことは確認しましたが、
永続値が保存・取得できない問題は解決しませんでした。
この問題と課金は関係ないのかなぁ・・・


追記

@yoichiro6642 様のコメントによると、この現象は仕様通りとのこと。

API Referenceにも記載があるそうです。
https://actions-on-google.github.io/actions-on-google-nodejs/classes/dialogflow.dialogflowconversation.html#followup

別の方法で対応しなきゃならないですね・・・


0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0