Spaces:
Runtime error
Runtime error
justest
commited on
Commit
·
cd446b6
1
Parent(s):
4f666fb
fix: bing
Browse files- g4f/Provider/Providers/Bing.py +23 -21
g4f/Provider/Providers/Bing.py
CHANGED
@@ -122,31 +122,32 @@ async def create_conversation():
|
|
122 |
for _ in range(5):
|
123 |
create = requests.get('https://www.bing.com/turing/conversation/create',
|
124 |
headers={
|
|
|
125 |
'accept': 'application/json',
|
126 |
'accept-language': 'zh-CN,zh;q=0.9',
|
127 |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.58',
|
128 |
'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/MacIntel',
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
})
|
151 |
|
152 |
conversationId = create.json().get('conversationId')
|
@@ -167,6 +168,7 @@ async def stream_generate(prompt: str, mode: optionsSets.optionSet = optionsSets
|
|
167 |
|
168 |
wss = await session.ws_connect('wss://sydney.bing.com/sydney/ChatHub', ssl=ssl_context, autoping=False,
|
169 |
headers={
|
|
|
170 |
'accept': 'application/json',
|
171 |
'accept-language': 'en-US,en;q=0.9',
|
172 |
'content-type': 'application/json',
|
|
|
122 |
for _ in range(5):
|
123 |
create = requests.get('https://www.bing.com/turing/conversation/create',
|
124 |
headers={
|
125 |
+
'cookie': '_U=1',
|
126 |
'accept': 'application/json',
|
127 |
'accept-language': 'zh-CN,zh;q=0.9',
|
128 |
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.58',
|
129 |
'x-ms-useragent': 'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/MacIntel',
|
130 |
+
'authority': 'edgeservices.bing.com',
|
131 |
+
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
132 |
+
'accept-language': 'en-US,en;q=0.9',
|
133 |
+
'cache-control': 'max-age=0',
|
134 |
+
'sec-ch-ua': '"Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"',
|
135 |
+
'sec-ch-ua-arch': '"x86"',
|
136 |
+
'sec-ch-ua-bitness': '"64"',
|
137 |
+
'sec-ch-ua-full-version': '"110.0.1587.69"',
|
138 |
+
'sec-ch-ua-full-version-list': '"Chromium";v="110.0.5481.192", "Not A(Brand";v="24.0.0.0", "Microsoft Edge";v="110.0.1587.69"',
|
139 |
+
'sec-ch-ua-mobile': '?0',
|
140 |
+
'sec-ch-ua-model': '""',
|
141 |
+
'sec-ch-ua-platform': '"Windows"',
|
142 |
+
'sec-ch-ua-platform-version': '"15.0.0"',
|
143 |
+
'sec-fetch-dest': 'document',
|
144 |
+
'sec-fetch-mode': 'navigate',
|
145 |
+
'sec-fetch-site': 'none',
|
146 |
+
'sec-fetch-user': '?1',
|
147 |
+
'upgrade-insecure-requests': '1',
|
148 |
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.69',
|
149 |
+
'x-edge-shopping-flag': '1',
|
150 |
+
'x-forwarded-for': Defaults.ip_address
|
151 |
})
|
152 |
|
153 |
conversationId = create.json().get('conversationId')
|
|
|
168 |
|
169 |
wss = await session.ws_connect('wss://sydney.bing.com/sydney/ChatHub', ssl=ssl_context, autoping=False,
|
170 |
headers={
|
171 |
+
'cookie': '_U=1',
|
172 |
'accept': 'application/json',
|
173 |
'accept-language': 'en-US,en;q=0.9',
|
174 |
'content-type': 'application/json',
|