mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
fix
This commit is contained in:
parent
dec300b940
commit
b1eb1441a9
@ -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('')
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user