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() msg = json_data["result"].replace("\n\n", "\n").strip()
yield msg yield msg
message += msg message += msg
except GeneratorExit:
return
except: except:
print_exc() print_exc()
raise Exception(response_data) raise Exception(response_data)

View File

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

View File

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

View File

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

View File

@ -97,6 +97,8 @@ class gptcommon(basetrans):
yield msg yield msg
message += msg message += msg
except GeneratorExit:
return
except: except:
print_exc() print_exc()
raise Exception(response_data) raise Exception(response_data)