Merge branch 'main' of http://jeason.online:3000/zhaojie/iov_data_analysis_agent
This commit is contained in:
@@ -131,6 +131,10 @@ class DataAnalysisAgent:
|
|||||||
print(f" 📝 描述: {description}")
|
print(f" 📝 描述: {description}")
|
||||||
print(f" 🔍 分析: {analysis}")
|
print(f" 🔍 分析: {analysis}")
|
||||||
|
|
||||||
|
# 验证文件是否存在
|
||||||
|
# 只有文件真正存在时才加入列表,防止报告出现裂图
|
||||||
|
if file_path and os.path.exists(file_path):
|
||||||
|
print(f" ✅ 文件存在: {file_path}")
|
||||||
# 记录图片信息
|
# 记录图片信息
|
||||||
collected_figures.append(
|
collected_figures.append(
|
||||||
{
|
{
|
||||||
@@ -141,6 +145,11 @@ class DataAnalysisAgent:
|
|||||||
"analysis": analysis,
|
"analysis": analysis,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
if file_path:
|
||||||
|
print(f" ⚠️ 文件不存在: {file_path}")
|
||||||
|
else:
|
||||||
|
print(f" ⚠️ 未提供文件路径")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"action": "collect_figures",
|
"action": "collect_figures",
|
||||||
@@ -317,7 +326,11 @@ class DataAnalysisAgent:
|
|||||||
elif process_result["action"] == "collect_figures":
|
elif process_result["action"] == "collect_figures":
|
||||||
# 记录图片收集结果
|
# 记录图片收集结果
|
||||||
collected_figures = process_result.get("collected_figures", [])
|
collected_figures = process_result.get("collected_figures", [])
|
||||||
feedback = f"已收集 {len(collected_figures)} 个图片及其分析"
|
missing_figures = process_result.get("missing_figures", [])
|
||||||
|
|
||||||
|
feedback = f"已收集 {len(collected_figures)} 个有效图片及其分析。"
|
||||||
|
if missing_figures:
|
||||||
|
feedback += f"\n⚠️ 以下图片未找到,请检查代码是否成功保存了这些图片: {missing_figures}"
|
||||||
self.conversation_history.append(
|
self.conversation_history.append(
|
||||||
{
|
{
|
||||||
"role": "user",
|
"role": "user",
|
||||||
@@ -331,6 +344,7 @@ class DataAnalysisAgent:
|
|||||||
"round": self.current_round,
|
"round": self.current_round,
|
||||||
"action": "collect_figures",
|
"action": "collect_figures",
|
||||||
"collected_figures": collected_figures,
|
"collected_figures": collected_figures,
|
||||||
|
"missing_figures": missing_figures,
|
||||||
"response": response,
|
"response": response,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user