:(
Build, push image, and notify Watchtower / build-image (push) Successful in 39s
Build, push image, and notify Watchtower / notify (push) Successful in 12s

This commit is contained in:
2026-08-23 18:43:16 +02:00
parent 6e2f849ee2
commit eb80d13300
+11 -16
View File
@@ -4,17 +4,14 @@ from APIs.aichat import generate
import shared.config as config
class DishSafetyResult(BaseModel):
step_1_visible_items: list[str] = Field(
description="List ONLY 2-3 broad visible items (e.g., ['ceramic bowl', 'brown stew']). Do NOT guess objects if blurry."
)
step_2_has_metal_or_cutlery: bool = Field(
description="Is a metal spoon, fork, knife, or foil clearly visible? True ONLY if distinct metal is seen, otherwise False."
)
detected_hazards: list[str] = Field(
description="List ONLY physical metal items (e.g. ['metal spoon']). MUST be an empty list [] if step_2 is False."
image_description: str = Field(
description="Describe the food and container in 1 simple sentence."
)
is_safe: bool = Field(
description="MUST be True if step_2 is False. Set to False ONLY if metal cutlery/foil is present."
description="Set to True if safe. Set to False ONLY if a physical metallic utensil or aluminum foil is clearly visible."
)
detected_hazards: list[str] = Field(
description="List any metallic objects found (e.g. ['metal utensil']). If is_safe is True, this MUST be empty []."
)
warning_message: str = Field(
description="Short warning if unsafe, otherwise empty string ''."
@@ -22,12 +19,11 @@ class DishSafetyResult(BaseModel):
def check_dish_safety(image_path: str) -> dict:
prompt = (
"You are a strict microwave safety vision inspector analyzing a top-down frame.\n\n"
"RULES:\n"
"1. First, list basic items in `step_1_visible_items`.\n"
"2. Examine the dish for shiny metallic cutlery, forks, spoons, or aluminum foil.\n"
"3. Set `step_2_has_metal_or_cutlery` to True ONLY if clear metallic cutlery is visible.\n"
"4. If the image is blurry and no metal is clearly identified, assume NO metal is present (step_2 = False, is_safe = True)."
"Analyze this top-down photo inside a microwave.\n\n"
"TASK:\n"
"1. Describe what is visible in `image_description`.\n"
"2. If the container holds strictly food with no physical metal objects, set `is_safe` to True and `detected_hazards` to [].\n"
"3. Mark `is_safe` as False ONLY if an actual metal object or metallic handle is present in the container."
)
response_raw = generate(
@@ -40,7 +36,6 @@ def check_dish_safety(image_path: str) -> dict:
if config.DEBUG_MESSAGES:
print(f"[Debug] Raw response from AI generator: {response_raw}")
# Handling response mapping...
if isinstance(response_raw, str):
try:
validated_result = DishSafetyResult.model_validate_json(response_raw)