mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-17 19:24:19 +00:00
feat: 内容函数全局开关支持
This commit is contained in:
+10
-3
@@ -16,12 +16,16 @@ class RequestBase:
|
||||
"""处理代理问题"""
|
||||
|
||||
ret: dict = {}
|
||||
exception: Exception = None
|
||||
|
||||
async def awrapper(**kwargs):
|
||||
nonlocal ret
|
||||
nonlocal ret, exception
|
||||
|
||||
ret = await self.req_func(**kwargs)
|
||||
return ret
|
||||
try:
|
||||
ret = await self.req_func(**kwargs)
|
||||
return ret
|
||||
except Exception as e:
|
||||
exception = e
|
||||
|
||||
loop = asyncio.new_event_loop()
|
||||
|
||||
@@ -33,6 +37,9 @@ class RequestBase:
|
||||
thr.start()
|
||||
thr.join()
|
||||
|
||||
if exception is not None:
|
||||
raise exception
|
||||
|
||||
return ret
|
||||
|
||||
def __iter__(self):
|
||||
|
||||
Reference in New Issue
Block a user