Skip to content

Commit 7b6c600

Browse files
committed
upatch ; )
1 parent ece5cd3 commit 7b6c600

File tree

2 files changed

+14
-122
lines changed

2 files changed

+14
-122
lines changed

server/backend.py

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
from json import dumps
2+
from time import time
13
from flask import request
2-
4+
from hashlib import sha256
35
from datetime import datetime
46
from requests import get
57
from requests import post
68

7-
from server.config import models
89
from server.config import special_instructions
910

1011

@@ -15,11 +16,10 @@ def __init__(self, app) -> None:
1516
'/backend-api/v2/conversation': {
1617
'function': self._conversation,
1718
'methods': ['POST']
18-
},
19+
}
1920
}
2021

2122
def _conversation(self):
22-
2323
try:
2424
jailbreak = request.json['jailbreak']
2525
internet_access = request.json['meta']['content']['internet_access']
@@ -53,29 +53,20 @@ def _conversation(self):
5353
extra + special_instructions[jailbreak] + \
5454
_conversation + [prompt]
5555

56+
timestamp = int(time() * 1000)
5657
headers = {
57-
'authority': 'www.sqlchat.ai',
58-
'accept': '*/*',
59-
'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',
60-
'content-type': 'text/plain;charset=UTF-8',
61-
'origin': 'https://www.sqlchat.ai',
62-
'referer': 'https://www.sqlchat.ai/',
63-
'sec-fetch-dest': 'empty',
64-
'sec-fetch-mode': 'cors',
65-
'sec-fetch-site': 'same-origin',
58+
'authority' : 'chatforai.com',
59+
'origin' : 'https://chatforai.com',
60+
'referer' : 'https://chatforai.com/',
6661
'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',
6762
}
6863

69-
data = {
70-
'messages': conversation,
71-
'openAIApiConfig': {
72-
'key': '',
73-
'endpoint': ''
74-
}
75-
}
76-
77-
gpt_resp = post('https://www.sqlchat.ai/api/chat',
78-
headers=headers, json=data, stream=True)
64+
gpt_resp = post('https://chatforai.com/api/generate', headers=headers, stream=True,
65+
data = dumps(separators=(',', ':'), obj={
66+
'messages': conversation,
67+
'time': timestamp,
68+
'pass': None,
69+
'sign': sha256(f'{timestamp}:{conversation[-1]["content"]}:k6zeE77ge7XF'.encode()).hexdigest(), 'key': ''}))
7970

8071
def stream():
8172
answer = ''

server/errors.py

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)