jihuaqiang vor 2 Wochen
Ursprung
Commit
c183b7535b
1 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 8 2
      tools/indentify/video_identifier.py

+ 8 - 2
tools/indentify/video_identifier.py

@@ -16,6 +16,10 @@ import uuid
 import requests
 from typing import Dict, Any, List, Optional
 from dotenv import load_dotenv
+from utils.logging_config import get_logger
+
+# 创建 logger
+logger = get_logger('VideoIdentifier')
 
 # 导入自定义模块
 sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
@@ -369,7 +373,9 @@ class VideoIdentifier:
                 url = item.get('url', '')
                 duration = item.get('duration', 0)
                 video_file = None
-                
+                # 确保Gemini已配置
+                self._ensure_configured()
+                logger.info(f"配置Gemini: {self.api_key}")
                 try:
                     # 1. 下载视频
                     video_path = self.download_video(url)
@@ -394,7 +400,7 @@ class VideoIdentifier:
                         }
 
                     # 3. 使用 Gemini 直接分析视频文件
-                    self._ensure_configured()
+                    
                     model = genai.GenerativeModel(
                         model_name='gemini-2.5-flash',
                         generation_config=genai.GenerationConfig(