2f9a95e12f
1、在test/rasa目录下提供本地nlp(rasa+chatglm)的替换方法。
11 lines
321 B
Python
11 lines
321 B
Python
import json
|
|
import requests
|
|
|
|
def question(cont):
|
|
url="http://localhost:5005/webhooks/rest/webhook"
|
|
req = json.dumps({"sender": "user", "message": cont})
|
|
headers = {'content-type': 'application/json'}
|
|
r = requests.post(url, headers=headers, data=req)
|
|
a = json.loads(r.text)[0].get('text')
|
|
return a
|