Spaces:
Sleeping
Sleeping
mkw18
commited on
Commit
•
ec02902
1
Parent(s):
8970855
add check
Browse files
app.py
CHANGED
@@ -59,18 +59,12 @@ def test(chatbot):
|
|
59 |
def CheckTrue(chatbot, key):
|
60 |
data = {'AgentCheck': True, 'key': key}
|
61 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
62 |
-
if not response.status_code == 200:
|
63 |
-
chatbot.append((parse_text(str(response.content, encoding="utf-8")), None))
|
64 |
-
return chatbot
|
65 |
chatbot.append((parse_text("是"), parse_text(str(response.content, encoding="utf-8"))))
|
66 |
return chatbot
|
67 |
|
68 |
def CheckFalse(chatbot, key):
|
69 |
data = {'AgentCheck': False, 'key': key}
|
70 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
71 |
-
if not response.status_code == 200:
|
72 |
-
chatbot.append((parse_text(str(response.content, encoding="utf-8")), None))
|
73 |
-
return chatbot
|
74 |
chatbot.append((parse_text("否"), parse_text(str(response.content, encoding="utf-8"))))
|
75 |
return chatbot
|
76 |
|
@@ -79,7 +73,7 @@ def CheckTerm(chatbot, key):
|
|
79 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
80 |
msg = str(response.content, encoding="utf-8")
|
81 |
if not response.status_code == 200:
|
82 |
-
chatbot
|
83 |
return chatbot, gr.update(value=msg), gr.update(value=msg)
|
84 |
response = json.loads(msg)
|
85 |
chatbot = [(None, parse_text(response['response']))]
|
|
|
59 |
def CheckTrue(chatbot, key):
|
60 |
data = {'AgentCheck': True, 'key': key}
|
61 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
|
|
|
|
|
|
62 |
chatbot.append((parse_text("是"), parse_text(str(response.content, encoding="utf-8"))))
|
63 |
return chatbot
|
64 |
|
65 |
def CheckFalse(chatbot, key):
|
66 |
data = {'AgentCheck': False, 'key': key}
|
67 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
|
|
|
|
|
|
68 |
chatbot.append((parse_text("否"), parse_text(str(response.content, encoding="utf-8"))))
|
69 |
return chatbot
|
70 |
|
|
|
73 |
response=requests.post(os.environ.get("URL"), data=json.dumps(data, ensure_ascii=False).encode('utf-8'))
|
74 |
msg = str(response.content, encoding="utf-8")
|
75 |
if not response.status_code == 200:
|
76 |
+
chatbot = [(None, parse_text(msg))]
|
77 |
return chatbot, gr.update(value=msg), gr.update(value=msg)
|
78 |
response = json.loads(msg)
|
79 |
chatbot = [(None, parse_text(response['response']))]
|