GeneratorExit

This commit is contained in:
恍兮惚兮 2024-08-07 17:13:50 +08:00
parent 7afc67749c
commit 87a1e0d789
5 changed files with 12 additions and 2 deletions

View File

@ -65,7 +65,8 @@ class TS(basetrans):
msg = json_data["result"].replace("\n\n", "\n").strip()
yield msg
message += msg
except GeneratorExit:
return
except:
print_exc()
raise Exception(response_data)

View File

@ -384,6 +384,9 @@ class basetrans(commonbase):
__callback(res, 0)
if all([_ is not None for _ in collectiterres]):
self.cachesetatend(contentsolved, "".join(collectiterres))
except GeneratorExit:
pass
except Exception as e:
if self.using and globalconfig["showtranexception"]:
if isinstance(e, ArgsEmptyExc):

View File

@ -118,6 +118,8 @@ class TS(basetrans):
msg = json_data["content_block"]["text"]
yield msg
message += msg
except GeneratorExit:
return
except:
print_exc()
raise Exception(response_data)

View File

@ -155,6 +155,8 @@ class TS(basetrans):
elif t == "stream-end":
break
except GeneratorExit:
return
except:
print_exc()
raise Exception(response_data)

View File

@ -96,7 +96,9 @@ class gptcommon(basetrans):
continue
yield msg
message += msg
except GeneratorExit:
return
except:
print_exc()
raise Exception(response_data)