我正在尝试运行flask-assistant
库以进行Google Assistant开发。我遵循了here的指示。
我将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
库,但是没有运气。我不确定该如何解决。
答案 0 :(得分:1)
flask-assistant的所有者/开发人员从flask-assistant项目的GitHub存储库中引用issue,(截至2019年3月1日):
[他还没有]更新架构功能以支持dialogflow V2 API。
好像还不支持V2 API。