修改依赖的引用方式
This commit is contained in:
parent
3814c3a915
commit
59bed52faf
@ -49,7 +49,7 @@ class NewBingHandle(Process):
|
|||||||
def check_dependency(self):
|
def check_dependency(self):
|
||||||
try:
|
try:
|
||||||
self.success = False
|
self.success = False
|
||||||
import rich
|
import certifi, httpx, rich
|
||||||
self.info = "依赖检测通过,等待NewBing响应。注意目前不能多人同时调用NewBing接口(有线程锁),否则将导致每个人的NewBing问询历史互相渗透。调用NewBing时,会自动使用已配置的代理。"
|
self.info = "依赖检测通过,等待NewBing响应。注意目前不能多人同时调用NewBing接口(有线程锁),否则将导致每个人的NewBing问询历史互相渗透。调用NewBing时,会自动使用已配置的代理。"
|
||||||
self.success = True
|
self.success = True
|
||||||
except:
|
except:
|
||||||
|
@ -19,8 +19,6 @@ from typing import Generator
|
|||||||
from typing import Literal
|
from typing import Literal
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from typing import Union
|
from typing import Union
|
||||||
import certifi
|
|
||||||
import httpx
|
|
||||||
import websockets.client as websockets
|
import websockets.client as websockets
|
||||||
|
|
||||||
DELIMITER = "\x1e"
|
DELIMITER = "\x1e"
|
||||||
@ -78,8 +76,12 @@ HEADERS_INIT_CONVER = {
|
|||||||
"x-forwarded-for": FORWARDED_IP,
|
"x-forwarded-for": FORWARDED_IP,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def get_ssl_context():
|
||||||
|
import certifi
|
||||||
ssl_context = ssl.create_default_context()
|
ssl_context = ssl.create_default_context()
|
||||||
ssl_context.load_verify_locations(certifi.where())
|
ssl_context.load_verify_locations(certifi.where())
|
||||||
|
return ssl_context
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class NotAllowedToAccess(Exception):
|
class NotAllowedToAccess(Exception):
|
||||||
@ -210,6 +212,7 @@ class _Conversation:
|
|||||||
"conversationSignature": None,
|
"conversationSignature": None,
|
||||||
"result": {"value": "Success", "message": None},
|
"result": {"value": "Success", "message": None},
|
||||||
}
|
}
|
||||||
|
import httpx
|
||||||
self.proxy = proxy
|
self.proxy = proxy
|
||||||
proxy = (
|
proxy = (
|
||||||
proxy
|
proxy
|
||||||
@ -288,7 +291,7 @@ class _ChatHub:
|
|||||||
wss_link,
|
wss_link,
|
||||||
extra_headers=HEADERS,
|
extra_headers=HEADERS,
|
||||||
max_size=None,
|
max_size=None,
|
||||||
ssl=ssl_context,
|
ssl=get_ssl_context()
|
||||||
)
|
)
|
||||||
await self._initial_handshake()
|
await self._initial_handshake()
|
||||||
# Construct a ChatHub request
|
# Construct a ChatHub request
|
||||||
|
Loading…
x
Reference in New Issue
Block a user