Dooratre commited on
Commit
c03acd5
·
verified ·
1 Parent(s): 7a0df2b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +92 -0
app.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import requests
2
+ import json
3
+
4
+ def send_chat_request():
5
+ # Define the URL of the API endpoint
6
+ url = 'https://www.blackbox.ai/api/chat'
7
+
8
+ # Headers
9
+ headers = {
10
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
11
+ 'Content-Type': 'application/json' # Assuming the API expects JSON format
12
+ }
13
+
14
+ # Payload
15
+ payload = {
16
+ "agentMode": {},
17
+ "clickedAnswer2": False,
18
+ "clickedAnswer3": False,
19
+ "clickedForceWebSearch": False,
20
+ "codeModelMode": True,
21
+ "githubToken": None,
22
+ "id": "hFnU6fo",
23
+ "isChromeExt": False,
24
+ "isMicMode": False,
25
+ "maxTokens": 1024,
26
+ "messages": [
27
+ {
28
+ "id": "hFnU6fo",
29
+ "content": "GIve me FULL NEWS ABOUT BTC YOU CAN GET IT FROM WEB",
30
+ "role": "user"
31
+ }
32
+ ],
33
+ "mobileClient": False,
34
+ "previewToken": None,
35
+ "trendingAgentMode": {},
36
+ "userId": None,
37
+ "userSelectedModel": None,
38
+ "visitFromDelta": False
39
+ }
40
+
41
+ # Send the POST request
42
+ response = requests.post(url, headers=headers, data=json.dumps(payload))
43
+
44
+ first = response.text# Print the response text
45
+ return first
46
+
47
+
48
+ def send_chat_request_v2(first):
49
+ # Define the URL of the API endpoint
50
+ url = 'https://www.blackbox.ai/api/chat'
51
+
52
+ # Headers
53
+ headers = {
54
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
55
+ 'Content-Type': 'application/json' # Assuming the API expects JSON format
56
+ }
57
+
58
+ # Payload
59
+ payload = {
60
+ "agentMode": {},
61
+ "id": "hFnU6fo",
62
+ "messages": [
63
+ {
64
+ "id": "hFnU6fo",
65
+ "content": "GIve me FULL NEWS ABOUT BTC YOU CAN GET IT FROM WEB",
66
+ "role": "user"
67
+ },
68
+ {
69
+ "id": "9RsMsaM",
70
+ "createdAt": "2024-09-21T08:11:09.953Z",
71
+ "content": first
72
+ ,
73
+ "role": "assistant"
74
+ }
75
+ ],
76
+ "mobileClient": False,
77
+ "mode": "continue",
78
+ "trendingAgentMode": {},
79
+ "userId": None
80
+ }
81
+
82
+ # Send the POST request
83
+ response = requests.post(url, headers=headers, data=json.dumps(payload))
84
+
85
+ second = response.text# Print the response text
86
+ return second
87
+ first = send_chat_request()
88
+ second = send_chat_request_v2(first)
89
+
90
+
91
+ print (f"{first}{second}")
92
+