Update nlp_ChatGLM2.py

修正查库顺序
This commit is contained in:
xszyou 2023-08-24 09:59:10 +08:00
parent c01256e8dc
commit 8a4beb9d7f

View File

@ -1,6 +1,9 @@
import json
import requests
from core.content_db import Content_Db
def question(cont):
content_db = Content_Db()
list = content_db.get_list('all','desc',10)
answer_info = dict()
@ -14,13 +17,10 @@ for val in list:
answer_info["role"] = "bot"
answer_info["content"] = val[2]
chat_list.append(answer_info)
def question(cont):
print(chat_list)
content = {
"prompt":"请简单回复我。" + cont,
"history":chat_list}
url = "http://192.168.1.23:8000"
url = "http://127.0.0.1:8000"
req = json.dumps(content)
headers = {'content-type': 'application/json'}
r = requests.post(url, headers=headers, data=req)