我正在尝试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
图书馆,但没有运气。我不知道如何解决这个问题。