t.me/xtekky
commited on
Commit
•
1704cbe
1
Parent(s):
98d2b41
- testing/sqlchat_test.py +0 -7
- unfinished/easyai/main.py +0 -31
testing/sqlchat_test.py
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
import sqlchat
|
2 |
-
|
3 |
-
for response in sqlchat.StreamCompletion.create(
|
4 |
-
prompt = 'write python code to reverse a string',
|
5 |
-
messages = []):
|
6 |
-
|
7 |
-
print(response.completion.choices[0].text, end='')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unfinished/easyai/main.py
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
from requests import get
|
2 |
-
from os import urandom
|
3 |
-
from json import loads
|
4 |
-
|
5 |
-
sessionId = urandom(10).hex()
|
6 |
-
|
7 |
-
headers = {
|
8 |
-
'Accept': 'text/event-stream',
|
9 |
-
'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',
|
10 |
-
'Cache-Control': 'no-cache',
|
11 |
-
'Connection': 'keep-alive',
|
12 |
-
'Pragma': 'no-cache',
|
13 |
-
'Referer': 'http://easy-ai.ink/chat',
|
14 |
-
'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',
|
15 |
-
'token': 'null',
|
16 |
-
}
|
17 |
-
|
18 |
-
while True:
|
19 |
-
prompt = input('you: ')
|
20 |
-
|
21 |
-
params = {
|
22 |
-
'message': prompt,
|
23 |
-
'sessionId': sessionId
|
24 |
-
}
|
25 |
-
|
26 |
-
for chunk in get('http://easy-ai.ink/easyapi/v1/chat/completions', params = params,
|
27 |
-
headers = headers, verify = False, stream = True).iter_lines():
|
28 |
-
|
29 |
-
if b'content' in chunk:
|
30 |
-
data = loads(chunk.decode('utf-8').split('data:')[1])
|
31 |
-
print(data['content'], end='')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|