-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.py
36 lines (23 loc) · 1.01 KB
/
client.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import requests
import chat
import file_upload
import file_reader
if __name__ == "__main__":
name = input("Enter your name: ")
data2 = {'firstName': name}
#link: https://juji.ai/pre-chat/5ed6e8ba-218d-43ee-80e9-94ce0550978a?mode=test
link = input("Enter the link of the chatbot you are connecting to: ")
r = requests.post(link, data = data2)
response = eval(r.text)
wsurl = response["websocketUrl"]
pid = response["participationId"]
while True:
text = input("type chat to text with chatbot\ntype upload to for uploading files\ntype query to send queries to the chatbot from a file\ntype exit to quit\n>>")
if text == "chat":
chat.connect(wsurl, pid)
if text == "upload":
file_upload.connect(wsurl, pid)
if text == "query":
file_reader.connect(wsurl, pid)
if text == "exit":
break