修改前端显示逻辑

This commit is contained in:
2026-01-22 22:26:04 +08:00
parent b1d0cc5462
commit 162f5c4da4
10 changed files with 828 additions and 581 deletions

View File

@@ -19,7 +19,7 @@ from utils.data_loader import load_and_profile_data
from utils.llm_helper import LLMHelper
from utils.code_executor import CodeExecutor
from config.llm_config import LLMConfig
from prompts import data_analysis_system_prompt, final_report_system_prompt
from prompts import data_analysis_system_prompt, final_report_system_prompt, data_analysis_followup_prompt
class DataAnalysisAgent:
@@ -324,8 +324,20 @@ class DataAnalysisAgent:
try: # 获取当前执行环境的变量信息
notebook_variables = self.executor.get_environment_info()
# Select prompt based on mode
if self.current_round == 1 and not reset_session:
# For the first round of a follow-up session, use the specialized prompt
base_system_prompt = data_analysis_followup_prompt
elif not reset_session and self.current_round > 1:
# For subsequent rounds in follow-up, continue using the follow-up context
# or maybe just the standard one is fine as long as SOP isn't fully enforced?
# Let's stick to the follow-up prompt to prevent SOP regression
base_system_prompt = data_analysis_followup_prompt
else:
base_system_prompt = data_analysis_system_prompt
# 格式化系统提示词填入动态的notebook变量信息
formatted_system_prompt = data_analysis_system_prompt.format(
formatted_system_prompt = base_system_prompt.format(
notebook_variables=notebook_variables
)
print(f"🐛 [DEBUG] System Prompt Head:\n{formatted_system_prompt[:500]}...\n[...]")