Spaces:
Runtime error
Runtime error
:gem: [Feature] ConversationCreator: More details in headers
Browse files
conversations/conversation_creator.py
CHANGED
@@ -2,6 +2,7 @@ import httpx
|
|
2 |
import json
|
3 |
from pprint import pprint
|
4 |
from utils.enver import enver
|
|
|
5 |
|
6 |
|
7 |
class ConversationCreator:
|
@@ -18,9 +19,7 @@ class ConversationCreator:
|
|
18 |
def construct_headers(self):
|
19 |
# New Bing 封锁原理探讨 #78
|
20 |
# https://github.com/weaigc/bingo/issues/78
|
21 |
-
self.request_headers =
|
22 |
-
"X-Forwarded-For": "65.49.22.66",
|
23 |
-
}
|
24 |
|
25 |
def create(self):
|
26 |
self.construct_cookies()
|
|
|
2 |
import json
|
3 |
from pprint import pprint
|
4 |
from utils.enver import enver
|
5 |
+
from networks import ConversationCreateHeadersConstructor
|
6 |
|
7 |
|
8 |
class ConversationCreator:
|
|
|
19 |
def construct_headers(self):
|
20 |
# New Bing 封锁原理探讨 #78
|
21 |
# https://github.com/weaigc/bingo/issues/78
|
22 |
+
self.request_headers = ConversationCreateHeadersConstructor().request_headers
|
|
|
|
|
23 |
|
24 |
def create(self):
|
25 |
self.construct_cookies()
|
networks/__init__.py
CHANGED
@@ -3,5 +3,8 @@ from .cookies_constructor import CookiesConstructor
|
|
3 |
from .conversation_request_headers_constructor import (
|
4 |
ConversationRequestHeadersConstructor,
|
5 |
)
|
|
|
|
|
|
|
6 |
from .message_outputer import OpenaiStreamOutputer
|
7 |
from .message_parser import MessageParser
|
|
|
3 |
from .conversation_request_headers_constructor import (
|
4 |
ConversationRequestHeadersConstructor,
|
5 |
)
|
6 |
+
from .conversation_create_headers_constructor import (
|
7 |
+
ConversationCreateHeadersConstructor,
|
8 |
+
)
|
9 |
from .message_outputer import OpenaiStreamOutputer
|
10 |
from .message_parser import MessageParser
|
networks/conversation_create_headers_constructor.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
class ConversationCreateHeadersConstructor:
|
2 |
+
def __init__(self):
|
3 |
+
self.construct()
|
4 |
+
|
5 |
+
def construct(self):
|
6 |
+
self.request_headers = {
|
7 |
+
"Accept-Encoding": "gzip, deflate, br",
|
8 |
+
"Accept-Language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7",
|
9 |
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36",
|
10 |
+
"Referer": "https://www.bing.com/search?q=Bing+AI&showconv=1&setlang=en&cc=us",
|
11 |
+
"X-Ms-Useragent": "azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.12.0 OS/Windows",
|
12 |
+
"X-Forwarded-For": "65.49.22.66",
|
13 |
+
}
|