diff --git a/.github/workflows/check_no_chinese_comments.py b/.github/workflows/check_no_chinese_comments.py deleted file mode 100644 index 8fb51970af1bcb..00000000000000 --- a/.github/workflows/check_no_chinese_comments.py +++ /dev/null @@ -1,37 +0,0 @@ -import os -import re -from zhon.hanzi import punctuation - -def has_chinese_characters(text): - for char in text: - if '\u4e00' <= char <= '\u9fff' or char in punctuation: - return True - return False - -def check_file_for_chinese_comments(file_path): - with open(file_path, 'r', encoding='utf-8') as file: - for line_number, line in enumerate(file, start=1): - if has_chinese_characters(line): - print(f"Found Chinese characters in {file_path} on line {line_number}:") - print(line.strip()) - return True - return False - -def main(): - has_chinese = False - excluded_files = ["model_template.py", 'stopwords.py', 'commands.py', - 'indexing_runner.py', 'web_reader_tool.py', 'spark_provider.py', - 'prompts.py'] - - for root, _, files in os.walk("."): - for file in files: - if file.endswith(".py") and file not in excluded_files: - file_path = os.path.join(root, file) - if check_file_for_chinese_comments(file_path): - has_chinese = True - - if has_chinese: - raise Exception("Found Chinese characters in Python files. Please remove them.") - -if __name__ == "__main__": - main() diff --git a/.github/workflows/check_no_chinese_comments.yml b/.github/workflows/check_no_chinese_comments.yml deleted file mode 100644 index ff3882acacd866..00000000000000 --- a/.github/workflows/check_no_chinese_comments.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Check for Chinese comments - -on: - push: - branches: - - 'main' - pull_request: - branches: - - main - -jobs: - check-chinese-comments: - runs-on: ubuntu-latest - - steps: - - name: Check out repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install zhon - - - name: Run script to check for Chinese comments - run: | - python .github/workflows/check_no_chinese_comments.py diff --git a/api/tests/unit_tests/model_providers/test_minimax_provider.py b/api/tests/unit_tests/model_providers/test_minimax_provider.py index ec3e4762730f6e..fa98142e8c7490 100644 --- a/api/tests/unit_tests/model_providers/test_minimax_provider.py +++ b/api/tests/unit_tests/model_providers/test_minimax_provider.py @@ -2,6 +2,8 @@ from unittest.mock import patch import json +from langchain.schema import ChatResult, ChatGeneration, AIMessage + from core.model_providers.providers.base import CredentialsValidateFailedError from core.model_providers.providers.minimax_provider import MinimaxProvider from models.provider import ProviderType, Provider @@ -24,7 +26,8 @@ def decrypt_side_effect(tenant_id, encrypted_key): def test_is_provider_credentials_valid_or_raise_valid(mocker): - mocker.patch('langchain.llms.minimax.Minimax._call', return_value='abc') + mocker.patch('core.third_party.langchain.llms.minimax_llm.MinimaxChatLLM._generate', + return_value=ChatResult(generations=[ChatGeneration(message=AIMessage(content='abc'))])) MODEL_PROVIDER_CLASS.is_provider_credentials_valid_or_raise(VALIDATE_CREDENTIAL)