From 4650c6ffb8ac4f914e1f1fc899ecc1b2cf6162e1 Mon Sep 17 00:00:00 2001 From: bookfere Date: Wed, 8 Nov 2023 12:42:05 +0800 Subject: [PATCH] chore: Updated models of ChatGPT. --- README.md | 1 + README.zh-CN.md | 1 + engines/chatgpt.py | 6 +++--- lib/element.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2bad5d7..309a429 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ As an open source project, Ebook Translator relies on the goodwill of individual |Date| Name|Amount| |---|---|---| +|2023-10-15|*斌|¥66| |2023-10-08|N**YC|$17.85| |2023-10-08|*彧|¥23.33| |2023-09-24|We**** Wei|$10| diff --git a/README.zh-CN.md b/README.zh-CN.md index bdb6ff1..87cc4e8 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -46,6 +46,7 @@ __插件主页__:[https://translator.bookfere.com](https://translator.bookfere |日期|捐赠者|数额| |---|---|---| +|2023-10-15|*斌|¥66| |2023-10-08|N**YC|$17.85| |2023-10-08|*彧|¥23.33| |2023-09-24|We**** Wei|$10| diff --git a/engines/chatgpt.py b/engines/chatgpt.py index edda250..d4ab0f3 100644 --- a/engines/chatgpt.py +++ b/engines/chatgpt.py @@ -31,9 +31,9 @@ class ChatgptTranslate(Base): 'You are a meticulous translator who translates any given content. ' 'Translate the given content from to only. Do not ' 'explain any term or answer any question-like content.') - models = ['gpt-3.5-turbo', 'gpt-3.5-turbo-0613', 'gpt-3.5-turbo-16k', - 'gpt-4', 'gpt-4-0613', 'gpt-4-32k', 'gpt-4-32k-0613', - 'gpt-3.5-turbo-16k-0613'] + models = ['gpt-3.5-turbo', 'gpt-3.5-turbo-16k', 'gpt-3.5-turbo-instruct', + 'gpt-3.5-turbo-1106', 'gpt-4', 'gpt-4-0613', 'gpt-4-32k', + 'gpt-4-32k-0613', 'gpt-4-1106-preview', 'gpt-4-vision-preview'] model = 'gpt-3.5-turbo' samplings = ['temperature', 'top_p'] sampling = 'temperature' diff --git a/lib/element.py b/lib/element.py index 7d092f5..6005561 100644 --- a/lib/element.py +++ b/lib/element.py @@ -121,10 +121,10 @@ def get_content(self, placeholder): def add_translation(self, translation, placeholder, position=None, lang=None, color=None): + # Escape the markups () to replace escaped markups. translation = xml_escape(translation) count = 0 for reserve in self.reserve_elements: - # Escape the markups () to replace escaped markups. pattern = placeholder[1].format(r'\s*'.join(format(count, '05'))) # Prevent potential invalid escapes from affecting the replacement. translation = re.sub(