测试修改

This commit is contained in:
DXC
2026-06-25 18:11:50 +08:00
parent d327c6c267
commit 429ed3c1c1
3 changed files with 83 additions and 72 deletions

View File

@ -91,6 +91,7 @@ class ReportGenerationConfig:
self.on_step = on_step
self.n = 0
self._render()
@ -164,8 +165,11 @@ class WaterQualityReportGenerator:
# 通用
ai_provider: Optional[str] = None # "ollama" | "minimax",默认 "minimax"
ai_provider: Optional[str] = None # "ollama" | "minimax",默认 "minimax"
enable_ai_analysis: Optional[bool] = None
# Ollama 专属
ollama_base_url: Optional[str] = None
@ -332,8 +336,6 @@ class WaterQualityReportGenerator:
self.minimax_base_url = (
cfg.minimax_base_url.rstrip("/")
)
if cfg and getattr(cfg, 'minimax_base_url', None)
@ -382,11 +384,11 @@ class WaterQualityReportGenerator:
else:
self.enable_ai_analysis = os.environ.get("ENABLE_AI_ANALYSIS", "1") not in {
"0",
"false",
"False",
}
@ -399,8 +401,6 @@ class WaterQualityReportGenerator:
self.parameter_descriptions = {
"Chlorophyll": """叶绿素(Chlorophyll)是浮游植物进行光合作用的关键色素,直接反映水体中藻类的生物量与初级生产力水平。它是评价水体富营养化程度最常用的指标之一。当叶绿素浓度持续升高时,表明藻类大量增殖,水华风险显著增加,并可能引发溶解氧剧烈波动、水体透明度下降及底栖生态系统退化。因此,通过遥感手段反演叶绿素浓度,可为水华预警、水质改善及生态修复提供重要科学依据。""",
@ -464,11 +464,11 @@ class WaterQualityReportGenerator:
"NH3-N", "BGA", "TT"]
self.parameter_images = {
param: [
f"{param}_histogram.png",
f"{param}_spectrum_comparison.png",
f"{param}_scatter_with_confidence.png",
@ -480,13 +480,13 @@ class WaterQualityReportGenerator:
] for param in params_list
}
# ========== 新增:缓存线程锁 ==========
self._cache_lock = Lock()
cfg = ai_config
def apply_ai_config(self, ai_config: ReportGenerationConfig) -> None: