From 84e36bdd02e881c47431150be9ed1364980c748e Mon Sep 17 00:00:00 2001 From: jeremygan2021 Date: Wed, 11 Mar 2026 14:53:33 +0800 Subject: [PATCH] tingwu_new --- .gitea/workflows/deploy.yaml | 13 +++++ backend/Dockerfile | 1 + backend/ai_services/management/__init__.py | 0 .../management/commands/__init__.py | 0 .../commands/check_aliyun_config.py | 54 +++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 backend/ai_services/management/__init__.py create mode 100644 backend/ai_services/management/commands/__init__.py create mode 100644 backend/ai_services/management/commands/check_aliyun_config.py diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 8e74515..8263116 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -40,6 +40,19 @@ jobs: git pull fi + # 3.1 创建/更新 .env 文件 (从本地环境变量注入) + echo -e "\n===== 配置环境变量 =====" + cat > backend/.env < 8 else "****" + self.stdout.write(self.style.SUCCESS(f"[OK] {key}: {masked_value}")) + + if not all_valid: + self.stdout.write(self.style.ERROR("\nConfiguration check FAILED. Some required settings are missing.")) + return + + # Test OSS Connection + self.stdout.write("\nTesting OSS Connection...") + try: + auth = oss2.Auth(configs['ALIYUN_ACCESS_KEY_ID'], configs['ALIYUN_ACCESS_KEY_SECRET']) + bucket = oss2.Bucket(auth, configs['ALIYUN_OSS_ENDPOINT'], configs['ALIYUN_OSS_BUCKET_NAME']) + bucket.get_bucket_info() + self.stdout.write(self.style.SUCCESS("[OK] OSS Connection successful")) + except Exception as e: + self.stdout.write(self.style.ERROR(f"[FAILED] OSS Connection failed: {e}")) + + # Test Tingwu Client Initialization + self.stdout.write("\nTesting Tingwu Client Initialization...") + try: + client = AcsClient( + configs['ALIYUN_ACCESS_KEY_ID'], + configs['ALIYUN_ACCESS_KEY_SECRET'], + "cn-beijing" + ) + self.stdout.write(self.style.SUCCESS("[OK] Tingwu Client initialized")) + except Exception as e: + self.stdout.write(self.style.ERROR(f"[FAILED] Tingwu Client init failed: {e}")) +