first commit

This commit is contained in:
2026-03-19 22:54:29 +03:30
parent 1a178f39b7
commit 035bc6f74d
91 changed files with 3821 additions and 130 deletions
+60
View File
@@ -15,3 +15,63 @@ def rag_ingest_task(recreate: bool = True):
"""
result = ingest(recreate=recreate)
return result
@app.task(bind=True)
def irrigation_recommendation_task(
self,
sensor_uuid: str,
plant_name: str | None = None,
growth_stage: str | None = None,
irrigation_method_name: str | None = None,
query: str | None = None,
) -> dict:
"""
تسک Celery برای تولید توصیه آبیاری.
داده‌های سنسور، گیاه و روش آبیاری را از DB بارگذاری کرده
و از سرویس RAG توصیه می‌گیرد.
"""
from rag.services.irrigation import get_irrigation_recommendation
self.update_state(
state="PROGRESS",
meta={"message": "در حال پردازش توصیه آبیاری..."},
)
result = get_irrigation_recommendation(
sensor_uuid=sensor_uuid,
plant_name=plant_name,
growth_stage=growth_stage,
irrigation_method_name=irrigation_method_name,
query=query,
)
result["status"] = "completed"
return result
@app.task(bind=True)
def fertilization_recommendation_task(
self,
sensor_uuid: str,
plant_name: str | None = None,
growth_stage: str | None = None,
query: str | None = None,
) -> dict:
"""
تسک Celery برای تولید توصیه کودهی.
داده‌های سنسور و گیاه را از DB بارگذاری کرده
و از سرویس RAG توصیه می‌گیرد.
"""
from rag.services.fertilization import get_fertilization_recommendation
self.update_state(
state="PROGRESS",
meta={"message": "در حال پردازش توصیه کودهی..."},
)
result = get_fertilization_recommendation(
sensor_uuid=sensor_uuid,
plant_name=plant_name,
growth_stage=growth_stage,
query=query,
)
result["status"] = "completed"
return result