18 lines
548 B
Python
18 lines
548 B
Python
from __future__ import annotations
|
|
|
|
from app.core.constants import RISK_LEVEL_HIGH, RISK_LEVEL_LOW, RISK_LEVEL_MEDIUM
|
|
|
|
|
|
class RiskService:
|
|
def evaluate(self, parsed_intent: dict[str, str | None]) -> str:
|
|
env = parsed_intent.get("env")
|
|
action_type = parsed_intent.get("action_type")
|
|
|
|
if env == "prod":
|
|
return RISK_LEVEL_HIGH
|
|
if action_type == "DEPLOY":
|
|
if env in {"test", "staging"}:
|
|
return RISK_LEVEL_MEDIUM
|
|
return RISK_LEVEL_LOW
|
|
return RISK_LEVEL_LOW
|