不能运行 flask-assistant python库的例子
Can't run the example of flask-assistant python library
我正在尝试 运行 flask-assistant
库用于 Google 助手开发。我按照 here.
的说明进行操作
我在 virtualenv
中安装了 flask-assistant
库。
我的 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
库,但没有成功。我不确定如何解决这个问题。
引用 flask-assistant 项目的 GitHub 存储库中的 issue,flask-assistant 的 owner/developer 说(截至 2019 年 3 月 1 日):
[He has] not yet updated the schema functionality to support the dialogflow V2 API.
似乎还没有对 V2 API 的支持。
我正在尝试 运行 flask-assistant
库用于 Google 助手开发。我按照 here.
我在 virtualenv
中安装了 flask-assistant
库。
我的 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
库,但没有成功。我不确定如何解决这个问题。
引用 flask-assistant 项目的 GitHub 存储库中的 issue,flask-assistant 的 owner/developer 说(截至 2019 年 3 月 1 日):
[He has] not yet updated the schema functionality to support the dialogflow V2 API.
似乎还没有对 V2 API 的支持。