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:
@@ -53,11 +53,11 @@ class SimpleAIClient:
|
|||||||
SHORT_VIDEO_THRESHOLD = 600 # 10分钟
|
SHORT_VIDEO_THRESHOLD = 600 # 10分钟
|
||||||
LONG_VIDEO_THRESHOLD = 1800 # 30分钟
|
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.api_key = api_key or os.environ.get("AI_API_KEY", "")
|
||||||
self.provider = provider
|
self.provider = provider
|
||||||
self.model = model
|
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:
|
def generate(self, prompt: str, max_tokens: int = 1000) -> str:
|
||||||
"""生成文本"""
|
"""生成文本"""
|
||||||
@@ -252,8 +252,8 @@ class DeepAnalyzer:
|
|||||||
"""有字幕的长视频详细分析"""
|
"""有字幕的长视频详细分析"""
|
||||||
result = AnalysisResult()
|
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)
|
result = self._analyze_in_chunks(title, subtitle, duration)
|
||||||
else:
|
else:
|
||||||
# 直接分析
|
# 直接分析
|
||||||
|
|||||||
Reference in New Issue
Block a user