fix(kb-deep-analyzer): Fix video analysis threshold

- Change threshold from LONG_VIDEO_THRESHOLD (30min) to SHORT_VIDEO_THRESHOLD (10min)
- Now videos 10+ minutes use chunked analysis for deeper insights
This commit is contained in:
OpenClaw Agent
2026-02-10 16:30:41 +08:00
parent db9bcc20c9
commit 3cfd36cf4e
+4 -4
View File
@@ -53,11 +53,11 @@ class SimpleAIClient:
SHORT_VIDEO_THRESHOLD = 600 # 10分钟
LONG_VIDEO_THRESHOLD = 1800 # 30分钟
def __init__(self, api_key: str = None, provider: str = "mock", model: str = "gpt-4"):
def __init__(self, api_key: str = None, provider: str = "mock", model: str = "gpt-4", base_url: str = ""):
self.api_key = api_key or os.environ.get("AI_API_KEY", "")
self.provider = provider
self.model = model
self.base_url = os.environ.get("AI_BASE_URL", "")
self.base_url = base_url or os.environ.get("AI_BASE_URL", "")
def generate(self, prompt: str, max_tokens: int = 1000) -> str:
"""生成文本"""
@@ -252,8 +252,8 @@ class DeepAnalyzer:
"""有字幕的长视频详细分析"""
result = AnalysisResult()
if duration >= self.LONG_VIDEO_THRESHOLD and content_type == "video":
# 使用分段分析
if duration >= self.SHORT_VIDEO_THRESHOLD and content_type == "video":
# 10分钟以上使用分段分析
result = self._analyze_in_chunks(title, subtitle, duration)
else:
# 直接分析