We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
想到一个加一个吧。
The text was updated successfully, but these errors were encountered:
查看5005端口是否被占用 netstat -aon | findstr 5005 启动Rasa API服务(跨域)rasa run --enable-api --cors "*" 启动Rasa API服务(保存日志)rasa run --enable-api --log-file out.log 启动Rasa API服务(指定模型)rasa run --enable-api -m models
import json import secrets import requests def post(url, data=None): data = json.dumps(data, ensure_ascii=False) data = data.encode(encoding="utf-8") r = requests.post(url=url, data=data) r = json.loads(r.text) return r if __name__ == "__main__": conversation_id = secrets.token_urlsafe(16) # 随机生成会话id messages_url = "http://localhost:5005/conversations/{}/messages".format(conversation_id) # 发送消息 predict_url = "http://localhost:5005/conversations/{}/predict".format(conversation_id) # 预测下一步动作 execute_url = "http://localhost:5005/conversations/{}/execute".format(conversation_id) # 执行动作 action = "action_listen" # 动作初始化为等待输入 while True: if action in ["action_listen", "action_default_fallback", "action_restart"]: # 等待输入 text = input("Your input -> ") post(messages_url, data={"text": text, "sender": "user"}) # 发送消息 response = post(predict_url) # 预测下一步动作 action = response["scores"][0]["action"] # 取出置信度最高的下一步动作 response = post(execute_url, data={"name": action}) # 执行动作 messages = response["messages"] # 取出对话信息 if messages: print(messages)
官网API接口文档链接,以及中文博客参考。
Sorry, something went wrong.
问题 5 答案已补充到源文件。
No branches or pull requests
想到一个加一个吧。
The text was updated successfully, but these errors were encountered: