t.me/xtekky
commited on
Commit
•
d0e9b9d
1
Parent(s):
d60d6fa
- unfinished/easyai/main.py +26 -0
unfinished/easyai/main.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
|
3 |
+
headers = {
|
4 |
+
'Accept': 'text/event-stream',
|
5 |
+
'Accept-Language': 'en,fr-FR;q=0.9,fr;q=0.8,es-ES;q=0.7,es;q=0.6,en-US;q=0.5,am;q=0.4,de;q=0.3',
|
6 |
+
'Cache-Control': 'no-cache',
|
7 |
+
'Connection': 'keep-alive',
|
8 |
+
'Pragma': 'no-cache',
|
9 |
+
'Referer': 'http://easy-ai.ink/chat',
|
10 |
+
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36',
|
11 |
+
'token': 'null',
|
12 |
+
}
|
13 |
+
|
14 |
+
while True:
|
15 |
+
params = {
|
16 |
+
'message': 'what is my name',
|
17 |
+
'sessionId': '2eacb8ad826056587598',
|
18 |
+
}
|
19 |
+
|
20 |
+
for chunk in requests.get('http://easy-ai.ink/easyapi/v1/chat/completions', params=params,
|
21 |
+
headers=headers, verify=False, stream=True).iter_lines():
|
22 |
+
|
23 |
+
if b'data:' in chunk:
|
24 |
+
print(chunk)
|
25 |
+
|
26 |
+
print(chunk)
|