0

我正在尝试flask-assistant为 Google Assistant 开发运行库。我按照这里的说明进行操作。

我将flask-assistant库安装在virtualenv. 我的webhook.py样子是这样的:

from flask import Flask
from flask_assistant import Assistant, ask, tell

app = Flask(__name__)
assist = Assistant(app, route='/', project_id='GOOGLE_CLOUD_PROJECT_ID')


@assist.action('greeting')
def greet_and_start():
    speech = "Hey! Are you male or female?"
    return ask(speech)

@assist.action("give-gender")
def ask_for_color(gender):
    if gender == 'male':
        gender_msg = 'Sup bro!'
    else:
        gender_msg = 'Haay gurl!'

    speech = gender_msg + ' What is your favorite color?'
    return ask(speech)

@assist.action('give-color', mapping={'color': 'sys.color'})
def ask_for_season(color):
    speech = 'Ok, {} is an okay color I guess'.format(color)
    return ask(speech)

if __name__ == '__main__':
    app.run(debug=True)

我按照它所说的做了一切,但是在我必须运行的步骤中,schema webhook.py我得到了这个错误:

Traceback (most recent call last):
  File "/Users/alexmarginean/Documents/Projects/travelrr-google-assistant/venv/bin/schema", line 7, in <module>
    from api_ai.cli import schema
  File "/Users/alexmarginean/Documents/Projects/travelrr-google-assistant/venv/lib/python3.7/site-packages/api_ai/cli.py", line 15, in <module>
    "Schema generation and management is not yet available for Dialogflow V2, please define intents and entities in the Dialogflow console"
DeprecationWarning: Schema generation and management is not yet available for Dialogflow V2, please define intents and entities in the Dialogflow console

我尝试切换到 BETA V2 和 V1,但问题仍然存在。我还检查了我tokens是否正确,他们是否正确。我也尝试更新schema图书馆,但没有运气。我不知道如何解决这个问题。

4

1 回答 1

1

引用 flask-assistant 项目的 GitHub 存储库中的一个问题,flask-assistant 的所有者/开发者说(截至 2019 年 3 月 1 日):

[他] 尚未更新架构功能以支持 dialogflow V2 API。

看起来还没有对 V2 API 的支持。

于 2019-06-26T21:08:02.513 回答