Add some color on the translated text output (#226)

This commit is contained in:
Will 保哥 2023-04-02 21:05:10 +08:00 committed by GitHub
parent fd5782513a
commit cc64495d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@ import re
import time
from copy import copy
from os import environ
from rich import print
import openai
@ -133,7 +134,7 @@ The total token is too long and cannot be completely translated\n
# todo: Determine whether to print according to the cli option
if needprint:
print(re.sub("\n{3,}", "\n\n", t_text))
print("[bold green]" + re.sub("\n{3,}", "\n\n", t_text) + "[/bold green]")
time.time() - start_time
# print(f"translation time: {elapsed_time:.1f}s")