Tìm kiếm công thức nấu ăn trên internet, trích lọc dữ liệu chuẩn hoá, rồi chuyển giao cho skill openclaw-food-system-orchestrator để lưu đúng cấu trúc recipes + recipe_ingredients + recipe_steps trong database.
Skill này chịu trách nhiệm:
openclaw-food-system-orchestrator để ghi dữ liệu vào DB.Skill này không tự chạy SQL.
public.recipesLưu metadata công thức:
title, descriptionsource_url, image_urlcook_time_minutes, prep_time_minutes, servingsdifficulty (easy|medium|hard)visibilityprivate|sharedsource (user|system)tags (text[])public.recipe_ingredientsLưu nguyên liệu theo recipe:
recipe_id, name, normalized_namequantity, unit, optional, sort_orderpublic.recipe_stepsLưu các bước nấu:
recipe_id, step_number, instruction, estimated_minutesKhông có cột
ingredientshayinstructionstrực tiếp trong bảngrecipes.
Thu thập:
Query gợi ý:
"{tên món} recipe"
"{tên món} công thức nấu ăn"
"{tên món} {ẩm thực} recipe ingredients instructions"
Fallback:
"best {tên món} recipe site:cookpad.com OR site:dienmayxanh.com OR site:allrecipes.com"
Nguồn ưu tiên: cookpad, dienmayxanh/vao-bep, cooky, allrecipes, serious eats, budgetbytes.
Mỗi candidate cần cố gắng trích các field:
title (required)description (optional)ingredients (required)steps (required)prepTimeMinutes (optional)cookTimeMinutes (optional)servings (optional)sourceUrl (required)imageUrl (optional)tags (optional)Payload trao cho orchestrator nên theo format app-level (camelCase):
{
"title": "Phở bò Hà Nội",
"description": "Công thức phở bò truyền thống",
"sourceUrl": "https://example.com/pho-bo",
"imageUrl": "https://example.com/pho-bo.jpg",
"cookTimeMinutes": 240,
"prepTimeMinutes": 30,
"servings": 6,
"difficulty": "medium",
"visibility": "private",
"source": "user",
"tags": ["món việt", "món nước", "thịt bò"],
"ingredients": [
{ "name": "xương bò", "quantity": 1.5, "unit": "kg", "optional": false },
{ "name": "gừng", "quantity": 1, "unit": "nhánh", "optional": false }
],
"steps": [
{ "instruction": "Chần xương bò", "estimatedMinutes": 15 },
{ "instruction": "Ninh nước dùng", "estimatedMinutes": 180 }
]
}
Rules:
sourceUrl phải là URL gốc bài công thức.ingredients[].name bắt buộc, giữ thứ tự xuất hiện.steps[].instruction bắt buộc, giữ thứ tự bước.difficulty nếu không chắc: dùng easy.tags luôn là tiếng Việt, viết thường, không trộn tiếng Anh.món nước, chiên, hải sản, ăn sáng).Luôn tóm tắt:
📋 Công thức: {title}
🔗 Nguồn: {sourceUrl}
🥬 Nguyên liệu: {n} mục
🧾 Các bước: {m} bước
⏱️ Thời gian: chuẩn bị {prepTimeMinutes} phút, nấu {cookTimeMinutes} phút
🍽️ Khẩu phần: {servings}
Hỏi rõ: “Bạn muốn lưu công thức này vào hệ thống không?”
Khi user đồng ý, chuyển payload cho openclaw-food-system-orchestrator với yêu cầu ghi multi-table:
recipes.recipe_ingredients theo recipe_id vừa tạo.recipe_steps theo recipe_id vừa tạo.Kèm nhắc orchestrator:
source_url từ payload sourceUrl.apply_migration nếu phải đổi schema.execute_sql cho DML.| Tình huống | Cách xử lý |
|---|---|
| Không có kết quả phù hợp | Đổi query, nới nguồn tìm kiếm |
| Fetch lỗi / trang chặn bot | Bỏ qua và thử nguồn khác |
| Thiếu ingredients hoặc steps | Báo user là nguồn không đủ dữ liệu để lưu |
| User từ chối lưu | Hỏi có muốn tìm công thức khác |
| Nghi ngờ trùng công thức | Báo orchestrator dedupe theo title trước khi insert |