Skip to content

Commit

Permalink
Merge pull request #965 from QQisQQ/patch-2
Browse files Browse the repository at this point in the history
解决new bing 报错200 (fix new bing error code 200 )
  • Loading branch information
binary-husky authored Jul 19, 2023
2 parents 16364f1 + 0c8c539 commit 99b8fce
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions request_llm/edge_gpt_free.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,15 @@ async def ask_stream(
"""
Ask a question to the bot
"""
req_header = HEADERS
if self.cookies is not None:
ws_cookies = []
for cookie in self.cookies:
ws_cookies.append(f"{cookie['name']}={cookie['value']}")
req_header.update({
'Cookie': ';'.join(ws_cookies),
})

timeout = aiohttp.ClientTimeout(total=30)
self.session = aiohttp.ClientSession(timeout=timeout)

Expand All @@ -455,7 +464,7 @@ async def ask_stream(
# Check if websocket is closed
self.wss = await self.session.ws_connect(
wss_link,
headers=HEADERS,
headers=req_header,
ssl=ssl_context,
proxy=self.proxy,
autoping=False,
Expand Down Expand Up @@ -1109,4 +1118,4 @@ def __repr__(self):


if __name__ == "__main__":
main()
main()

0 comments on commit 99b8fce

Please sign in to comment.