AI UPDATE

This commit is contained in:
2026-03-21 23:50:36 +03:30
parent 292fd88e5a
commit c37b5c8558
15 changed files with 614 additions and 23 deletions
+15 -9
View File
@@ -17,10 +17,18 @@ KB_NAME = "fertilization"
DEFAULT_FERTILIZATION_PROMPT = (
"بر اساس داده‌های خاک (NPK، pH)، مشخصات گیاه، مرحله رشد و پایگاه دانش کودهی، "
"یک توصیه کودهی دقیق بده. "
"پاسخ حتماً به فرمت JSON با فیلدهای زیر باشد:\n"
"fertilizer_needed (bool), fertilizer_type (str), amount_kg_per_hectare (float), "
"reason (str), npk_status (dict با کلیدهای nitrogen, phosphorus, potassium و مقادیر low/normal/high)\n"
"فقط JSON خروجی بده، بدون توضیح اضافی."
"پاسخ حتماً به فرمت JSON با ساختار زیر باشد:\n"
'{\n'
' "plan": {\n'
' "npkRatio": "<str>",\n'
' "amountPerHectare": "<str>",\n'
' "applicationMethod": "<str>",\n'
' "applicationInterval": "<str>",\n'
' "reasoning": "<str>"\n'
' }\n'
'}\n'
"فقط JSON خروجی بده، بدون توضیح اضافی. "
"مقادیر را بر اساس شرایط واقعی خاک و گیاه محاسبه کن."
)
@@ -101,11 +109,9 @@ def get_fertilization_recommendation(
result = json.loads(cleaned)
except (json.JSONDecodeError, ValueError):
result = {
"fertilizer_needed": None,
"fertilizer_type": None,
"amount_kg_per_hectare": None,
"reason": raw,
"npk_status": None,
"plan": {
"reasoning": raw,
},
}
result["raw_response"] = raw
+15 -7
View File
@@ -17,9 +17,18 @@ KB_NAME = "irrigation"
DEFAULT_IRRIGATION_PROMPT = (
"بر اساس داده‌های خاک، هواشناسی، مشخصات گیاه، روش آبیاری و پایگاه دانش آبیاری، "
"یک توصیه آبیاری دقیق بده. "
"پاسخ حتماً به فرمت JSON با فیلدهای زیر باشد:\n"
"irrigation_needed (bool), amount_mm (float), reason (str), next_check_date (str)\n"
"فقط JSON خروجی بده، بدون توضیح اضافی."
"پاسخ حتماً به فرمت JSON با ساختار زیر باشد:\n"
'{\n'
' "plan": {\n'
' "frequencyPerWeek": <int>,\n'
' "durationMinutes": <int>,\n'
' "bestTimeOfDay": "<str>",\n'
' "moistureLevel": <int>,\n'
' "warning": "<str>"\n'
' }\n'
'}\n'
"فقط JSON خروجی بده، بدون توضیح اضافی. "
"مقادیر عددی را بر اساس شرایط واقعی محاسبه کن."
)
@@ -105,10 +114,9 @@ def get_irrigation_recommendation(
result = json.loads(cleaned)
except (json.JSONDecodeError, ValueError):
result = {
"irrigation_needed": None,
"amount_mm": None,
"reason": raw,
"next_check_date": None,
"plan": {
"warning": raw,
},
}
result["raw_response"] = raw