lalashechka commited on
Commit
d7f2449
·
verified ·
1 Parent(s): b93f329

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -0
app.py CHANGED
@@ -48,6 +48,7 @@ async def generate_response(request_body: RequestBody):
48
  headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36","Accept": "*/*","Accept-Language": "en-US,en;q=0.5","Accept-Encoding": "gzip, deflate, br","Referer": "https://www.blackbox.ai","Content-Type": "application/json","Origin": "https://www.blackbox.ai","DNT": "1","Sec-GPC": "1","Alt-Used": "www.blackbox.ai","Connection": "keep-alive",}
49
  json_data = {'messages': [{'id': uuid.uuid4().hex,'content': input_text,'role': 'user',},],'id': uuid.uuid4().hex,'previewToken': None,'userId': None,'codeModelMode': True,'agentMode': { 'mode': True, 'id': 'ImageGenerationLV45LJp', 'name': 'Image Generation',},'trendingAgentMode': {},'isMicMode': False,'maxTokens': 1024,'playgroundTopP': None,'playgroundTemperature': None,'isChromeExt': False,'githubToken': None,'clickedAnswer2': False,'clickedAnswer3': False,'clickedForceWebSearch': False,'visitFromDelta': False,'mobileClient': False,'userSelectedModel': None,'validated': '00f37b34-a166-4efb-bce5-1312d87f2f94',}
50
  response = requests.post('https://www.blackbox.ai/api/chat', headers=headers, json=json_data)
 
51
  decoded_string = ''.join(char for char in response.text if char != '\x00' and char != '\x08')
52
  pattern = r'https?://\S+\.(?:jpg|jpeg|png|gif)'
53
  match2 = re.search(pattern, decoded_string)
 
48
  headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36","Accept": "*/*","Accept-Language": "en-US,en;q=0.5","Accept-Encoding": "gzip, deflate, br","Referer": "https://www.blackbox.ai","Content-Type": "application/json","Origin": "https://www.blackbox.ai","DNT": "1","Sec-GPC": "1","Alt-Used": "www.blackbox.ai","Connection": "keep-alive",}
49
  json_data = {'messages': [{'id': uuid.uuid4().hex,'content': input_text,'role': 'user',},],'id': uuid.uuid4().hex,'previewToken': None,'userId': None,'codeModelMode': True,'agentMode': { 'mode': True, 'id': 'ImageGenerationLV45LJp', 'name': 'Image Generation',},'trendingAgentMode': {},'isMicMode': False,'maxTokens': 1024,'playgroundTopP': None,'playgroundTemperature': None,'isChromeExt': False,'githubToken': None,'clickedAnswer2': False,'clickedAnswer3': False,'clickedForceWebSearch': False,'visitFromDelta': False,'mobileClient': False,'userSelectedModel': None,'validated': '00f37b34-a166-4efb-bce5-1312d87f2f94',}
50
  response = requests.post('https://www.blackbox.ai/api/chat', headers=headers, json=json_data)
51
+ print(response.text)
52
  decoded_string = ''.join(char for char in response.text if char != '\x00' and char != '\x08')
53
  pattern = r'https?://\S+\.(?:jpg|jpeg|png|gif)'
54
  match2 = re.search(pattern, decoded_string)