feat: 娣诲姞澶氫釜鏂板姛鑳藉拰淇 - 鍖呮嫭鐢ㄦ埛绠$悊銆佹暟鎹簱杩佺Щ銆丟it鎺ㄩ€佸伐鍏风瓑
This commit is contained in:
@@ -212,7 +212,7 @@ class TSPAgentAssistant:
|
||||
try:
|
||||
self.is_agent_mode = enabled
|
||||
logger.info(f"Agent模式: {'启用' if enabled else '禁用'}")
|
||||
return True
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"切换Agent模式失败: {e}")
|
||||
return False
|
||||
@@ -233,8 +233,8 @@ class TSPAgentAssistant:
|
||||
"""停止主动监控"""
|
||||
try:
|
||||
self.ai_monitoring_active = False
|
||||
logger.info("主动监控已停止")
|
||||
return True
|
||||
logger.info("主动监控已停止")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"停止主动监控失败: {e}")
|
||||
return False
|
||||
@@ -261,14 +261,14 @@ class TSPAgentAssistant:
|
||||
recent_executions = self.get_action_history(20)
|
||||
|
||||
# 生成分析报告
|
||||
analysis = {
|
||||
analysis = {
|
||||
"tool_performance": tool_performance,
|
||||
"recent_activity": len(recent_executions),
|
||||
"success_rate": tool_performance.get("success_rate", 0),
|
||||
"recommendations": self._generate_recommendations(tool_performance)
|
||||
}
|
||||
|
||||
return analysis
|
||||
}
|
||||
|
||||
return analysis
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"运行智能分析失败: {e}")
|
||||
@@ -357,8 +357,8 @@ class TSPAgentAssistant:
|
||||
try:
|
||||
logger.info(f"保存知识条目 {i+1}: {entry.get('question', '')[:50]}...")
|
||||
# 这里应该调用知识库管理器保存
|
||||
saved_count += 1
|
||||
logger.info(f"知识条目 {i+1} 保存成功")
|
||||
saved_count += 1
|
||||
logger.info(f"知识条目 {i+1} 保存成功")
|
||||
except Exception as save_error:
|
||||
logger.error(f"保存知识条目 {i+1} 时出错: {save_error}")
|
||||
|
||||
@@ -380,9 +380,9 @@ class TSPAgentAssistant:
|
||||
with open(file_path, 'r', encoding='utf-8') as f:
|
||||
return f.read()
|
||||
elif file_ext == '.pdf':
|
||||
return "PDF文件需要安装PyPDF2库"
|
||||
return "PDF文件需要安装PyPDF2库"
|
||||
elif file_ext in ['.doc', '.docx']:
|
||||
return "Word文件需要安装python-docx库"
|
||||
return "Word文件需要安装python-docx库"
|
||||
else:
|
||||
return "不支持的文件格式"
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user