Skip to content

Commit e64e606

Browse files
authored
Merge pull request #221 from PDFMathTranslate/dev
feat(qwenmt): add model name check
2 parents 98d3b1f + bd8b011 commit e64e606

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

pdf2zh_next/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
# from pdf2zh_next.high_level import translate, translate_stream
3232

33-
__version__ = "2.6.3"
33+
__version__ = "2.6.4"
3434
__author__ = "Byaidu, awwaawwa"
3535
__license__ = "AGPL-3.0"
3636
__maintainer__ = "awwaawwa"

pdf2zh_next/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.6.3"
1+
__version__ = "2.6.4"
22
__major_version__ = "2"
33
__config_file_version__ = "3"
44

pdf2zh_next/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pdf2zh_next.config import ConfigManager
1515
from pdf2zh_next.high_level import do_translate_file_async
1616

17-
__version__ = "2.6.3"
17+
__version__ = "2.6.4"
1818

1919
logger = logging.getLogger(__name__)
2020

pdf2zh_next/translator/translator_impl/qwenmt.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,14 @@ def __init__(
3737
self.prompt_token_count = AtomicInteger()
3838
self.completion_token_count = AtomicInteger()
3939

40+
if "qwen-mt" not in self.model:
41+
raise ValueError(
42+
f"Model {self.model} is not a Qwen-MT model, Other Qwen models should use AliyunDashScope or OpenAICompatible."
43+
)
44+
4045
def lang_mapping(self, input_lang: str) -> str:
4146
"""
42-
Mapping the language code to the language code that Aliyun Qwen-Mt model supports.
47+
Mapping the language code to the language code that Aliyun Qwen-MT model supports.
4348
Since all existings languagues codes used in gui.py are able to be mapped, the original
4449
languague code will not be checked.
4550
"""

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "pdf2zh-next"
3-
version = "2.6.3"
3+
version = "2.6.4"
44
description = "Latex PDF Translator"
55
authors = [
66
{ name = "awwaawwa", email = "[email protected]" },
@@ -83,7 +83,7 @@ max-line-length = 88
8383

8484

8585
[bumpver]
86-
current_version = "2.6.3"
86+
current_version = "2.6.4"
8787
version_pattern = "MAJOR.MINOR.PATCH[.PYTAGNUM]"
8888

8989
[bumpver.file_patterns]

0 commit comments

Comments
 (0)