Spaces:
Paused
Paused
Your Name
commited on
Commit
•
59bed52
1
Parent(s):
3814c3a
修改依赖的引用方式
Browse files- request_llm/bridge_newbing.py +1 -1
- request_llm/edge_gpt.py +8 -5
request_llm/bridge_newbing.py
CHANGED
@@ -49,7 +49,7 @@ class NewBingHandle(Process):
|
|
49 |
def check_dependency(self):
|
50 |
try:
|
51 |
self.success = False
|
52 |
-
import rich
|
53 |
self.info = "依赖检测通过,等待NewBing响应。注意目前不能多人同时调用NewBing接口(有线程锁),否则将导致每个人的NewBing问询历史互相渗透。调用NewBing时,会自动使用已配置的代理。"
|
54 |
self.success = True
|
55 |
except:
|
|
|
49 |
def check_dependency(self):
|
50 |
try:
|
51 |
self.success = False
|
52 |
+
import certifi, httpx, rich
|
53 |
self.info = "依赖检测通过,等待NewBing响应。注意目前不能多人同时调用NewBing接口(有线程锁),否则将导致每个人的NewBing问询历史互相渗透。调用NewBing时,会自动使用已配置的代理。"
|
54 |
self.success = True
|
55 |
except:
|
request_llm/edge_gpt.py
CHANGED
@@ -19,8 +19,6 @@ from typing import Generator
|
|
19 |
from typing import Literal
|
20 |
from typing import Optional
|
21 |
from typing import Union
|
22 |
-
import certifi
|
23 |
-
import httpx
|
24 |
import websockets.client as websockets
|
25 |
|
26 |
DELIMITER = "\x1e"
|
@@ -78,8 +76,12 @@ HEADERS_INIT_CONVER = {
|
|
78 |
"x-forwarded-for": FORWARDED_IP,
|
79 |
}
|
80 |
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
83 |
|
84 |
|
85 |
class NotAllowedToAccess(Exception):
|
@@ -210,6 +212,7 @@ class _Conversation:
|
|
210 |
"conversationSignature": None,
|
211 |
"result": {"value": "Success", "message": None},
|
212 |
}
|
|
|
213 |
self.proxy = proxy
|
214 |
proxy = (
|
215 |
proxy
|
@@ -288,7 +291,7 @@ class _ChatHub:
|
|
288 |
wss_link,
|
289 |
extra_headers=HEADERS,
|
290 |
max_size=None,
|
291 |
-
ssl=
|
292 |
)
|
293 |
await self._initial_handshake()
|
294 |
# Construct a ChatHub request
|
|
|
19 |
from typing import Literal
|
20 |
from typing import Optional
|
21 |
from typing import Union
|
|
|
|
|
22 |
import websockets.client as websockets
|
23 |
|
24 |
DELIMITER = "\x1e"
|
|
|
76 |
"x-forwarded-for": FORWARDED_IP,
|
77 |
}
|
78 |
|
79 |
+
def get_ssl_context():
|
80 |
+
import certifi
|
81 |
+
ssl_context = ssl.create_default_context()
|
82 |
+
ssl_context.load_verify_locations(certifi.where())
|
83 |
+
return ssl_context
|
84 |
+
|
85 |
|
86 |
|
87 |
class NotAllowedToAccess(Exception):
|
|
|
212 |
"conversationSignature": None,
|
213 |
"result": {"value": "Success", "message": None},
|
214 |
}
|
215 |
+
import httpx
|
216 |
self.proxy = proxy
|
217 |
proxy = (
|
218 |
proxy
|
|
|
291 |
wss_link,
|
292 |
extra_headers=HEADERS,
|
293 |
max_size=None,
|
294 |
+
ssl=get_ssl_context()
|
295 |
)
|
296 |
await self._initial_handshake()
|
297 |
# Construct a ChatHub request
|