我刚刚编写了一个在ngninx ubuntu上使用pyhthon运行的Facebook Chatbot,它完美运行,直到我想添加wit.ai。代码应该工作,但我认为python无法找到模块机智虽然我添加了它。
这是控制台:
File "/var/www/chatbot/wit.py", line 1, in <module>
from wit import Wit
ImportError: cannot import name 'Wit'
这是wit.py的代码:
from wit import Wit
access_token = "*****"
client = Wit(access_token = access_token)
def wit_response(msg):
resp = client.message(msg)
entity = None
value = None
try:
entity = list(resp['entities'])[0]
value = resp['entities'][entity][0]['value']
except:
pass
return (entity, value)