This commit is contained in:
恍兮惚兮 2024-03-07 14:34:41 +08:00
parent dec300b940
commit b1eb1441a9
3 changed files with 7 additions and 2 deletions

View File

@ -256,11 +256,10 @@ class Textbrowser( ):
lastpos=None
posx=pos
for i in range(len(text)):
if text[i] =='\n':continue
self.textcursor.setPosition(posx)
posx+=1
tl1=self.textbrowser.cursorRect(self.textcursor).topLeft()
if lastpos is None or tl1.y()!=lastpos.y():
if lastpos is None or tl1.y()!=lastpos.y() or text[i] =='\n':
lastpos=tl1
subpos.append(lastpos)
subtext.append('')

View File

@ -61,10 +61,13 @@ class TS(basetrans):
continue
try:
json_data = json.loads(response_data[6:])
if json_data['choices'][0]['finish_reason']:
break
msg = json_data["choices"][0]["delta"]['content']
yield msg
message+=msg
except:
print_exc()
raise Exception(response_data)
else:

View File

@ -77,10 +77,13 @@ class TS(basetrans):
continue
try:
json_data = json.loads(response_data[6:])
if json_data['choices'][0]['finish_reason']:
break
msg = json_data["choices"][0]["delta"]['content']
yield msg
message+=msg
except:
print_exc()
raise Exception(response_data)
else: