feat(kb-deep-analyzer): Increase output limits for detailed analysis

## Increased limits:
| Stage | Before | After |
|-------|--------|-------|
| Per chunk | 500 tokens / 300 chars | 2000 tokens / 800 chars |
| Summary | 150 chars | 300 chars |
| Full analysis | 500 chars | 1500 chars |
| Short video | 100 chars | 200 chars |
| JSON response | 2000 tokens | 4000 tokens |

| Added items:
| - Topics: 3-4 → 5
| - Insights: 2-3 → 4
| - Actions: 1-2 → 3
This commit is contained in:
OpenClaw Agent
2026-02-10 16:51:45 +08:00
parent 08066334c4
commit aa695c7cb7
+14 -14
View File
@@ -79,7 +79,7 @@ class SimpleAIClient:
def generate_json(self, prompt: str) -> Dict[str, Any]: def generate_json(self, prompt: str) -> Dict[str, Any]:
"""生成 JSON 格式响应""" """生成 JSON 格式响应"""
response = self.generate(prompt, max_tokens=2000) response = self.generate(prompt, max_tokens=4000)
try: try:
return json.loads(response) return json.loads(response)
except json.JSONDecodeError: except json.JSONDecodeError:
@@ -401,15 +401,15 @@ class DeepAnalyzer:
"""分析单个分片""" """分析单个分片"""
text_sample = self._get_text_sample(chunk_text, max_chars=3000) text_sample = self._get_text_sample(chunk_text, max_chars=3000)
prompt = f"""请对以下视频片段进行简要分析(限制在300字以内): prompt = f"""请对以下视频片段进行详细分析(限制在800字以内):
片段内容: 片段内容:
{text_sample} {text_sample}
请用中文简要回答,包括核心主题和关键要点。""" 请用中文详细回答,包括核心主题、关键要点和重要细节。"""
try: try:
return self.ai_client.generate(prompt, max_tokens=500) return self.ai_client.generate(prompt, max_tokens=2000)
except Exception as e: except Exception as e:
print(f"[DeepAnalyzer] 分片 {chunk_index} 分析失败: {e}") print(f"[DeepAnalyzer] 分片 {chunk_index} 分析失败: {e}")
return f"第{chunk_index}段内容分析" return f"第{chunk_index}段内容分析"
@@ -421,7 +421,7 @@ class DeepAnalyzer:
for s in chunk_summaries for s in chunk_summaries
]) ])
prompt = f"""基于以下视频各段分析,生成完整的分析报告: prompt = f"""基于以下视频各段分析,生成完整详细的分析报告:
标题:{title} 标题:{title}
@@ -430,11 +430,11 @@ class DeepAnalyzer:
请返回JSON格式: 请返回JSON格式:
{{ {{
"summary": "整体摘要(150字以内)", "summary": "整体摘要(300字以内)",
"topics": ["主题1", "主题2", "主题3", "主题4"], "topics": ["主题1", "主题2", "主题3", "主题4", "主题5"],
"insights": ["见解1", "见解2", "见解3"], "insights": ["见解1", "见解2", "见解3", "见解4"],
"actions": ["建议1", "建议2"], "actions": ["建议1", "建议2", "建议3"],
"full_analysis": "详细分析(500字以内)" "full_analysis": "详细分析(1500字以内)"
}}""" }}"""
try: try:
@@ -493,10 +493,10 @@ class DeepAnalyzer:
请返回以下格式JSON: 请返回以下格式JSON:
{{ {{
"summary": "整体摘要(100字以内)", "summary": "整体摘要(200字以内)",
"topics": ["主题1", "主题2", "主题3"], "topics": ["主题1", "主题2", "主题3", "主题4"],
"insights": ["见解1", "见解2"], "insights": ["见解1", "见解2", "见解3"],
"actions": ["建议1"], "actions": ["建议1", "建议2"],
"tags": ["标签1", "标签2", "标签3", "标签4", "标签5"] "tags": ["标签1", "标签2", "标签3", "标签4", "标签5"]
}}""" }}"""