This commit is contained in:
2026-05-13 16:45:54 +03:30
parent 948c062b93
commit 46fe62fa04
96 changed files with 3834 additions and 155 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ import json
import logging
from typing import Any
from farm_data.services import get_farm_details
from farm_data.services import build_ai_farm_snapshot
from rag.api_provider import get_chat_client
from rag.chat import (
_build_content_parts,
@@ -106,7 +106,7 @@ def _clean_json(raw: str) -> dict[str, Any]:
def _load_farm_or_error(farm_uuid: str) -> dict[str, Any]:
farm_details = get_farm_details(farm_uuid)
farm_details = build_ai_farm_snapshot(farm_uuid)
if farm_details is None:
raise RAGServiceError(
error_code="farm_not_found",
@@ -134,8 +134,8 @@ def _build_service_client(cfg: RAGConfig):
def _weather_risk_summary(farm_details: dict[str, Any]) -> dict[str, Any]:
weather = farm_details.get("weather") or {}
soil = (farm_details.get("soil") or {}).get("resolved_metrics") or {}
weather = ((farm_details.get("weather") or {}).get("forecast") or {})
soil = (farm_details.get("farm_metrics") or {}).get("resolved_metrics") or {}
humidity = _safe_float(weather.get("humidity_mean"), 55.0)
temp = _safe_float(weather.get("temperature_mean"), 24.0)
rain = _safe_float(weather.get("precipitation"), 0.0)