Explorar o código

refactor: Simplify OpenAITranslator initialization and add main function

mrh hai 1 ano
pai
achega
726a4795ce
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      mylib/translate_utils.py

+ 7 - 1
mylib/translate_utils.py

@@ -22,7 +22,7 @@ def process_batch_translations(data: List[List[str]], search_term_index: int, ca
     """批量处理翻译"""
     try:
         # 初始化翻译器
-        translator = OpenAITranslator("openai", "zh-CN", "en", "gpt-3.5-turbo")
+        translator = OpenAITranslator()
         
         # 收集所有需要翻译的文本
         translation_batches = {
@@ -68,3 +68,9 @@ def process_batch_translations(data: List[List[str]], search_term_index: int, ca
     except Exception as e:
         logger.error(f"Error in batch translation: {e}")
         raise
+
+def main():
+    pass
+
+if __name__ == "__main__":
+    main()