{escape(item.get("tagline", ""))}
import json
import os
import re
from collections import OrderedDict
from html import escape
from pathlib import Path
import gradio as gr
import uvicorn
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel, Field
from meltmind_engine import MeltMindEngine
from space_runtime import backend_status, start_space_backend
ROOT = Path(__file__).parent
MENU = json.loads((ROOT / "data" / "menu.json").read_text())
ADD_ONS = json.loads((ROOT / "data" / "meltmind" / "add_ons.json").read_text())["add_ons"]
INGREDIENTS = json.loads((ROOT / "data" / "meltmind" / "ingredients.json").read_text())["ingredients"]
BUSINESS = json.loads((ROOT / "data" / "meltmind" / "business_profile.json").read_text())
POLICIES = json.loads((ROOT / "data" / "meltmind" / "operations_and_policies.json").read_text())
CSS = (ROOT / "styles.css").read_text()
ENGINE = MeltMindEngine()
SPACE_BACKEND = start_space_backend()
LOGO_PATH = "assets/brand/Meltroom.jpeg"
HERO_PATH = "assets/hero/meltroom_special1.jpg"
WHATSAPP_NUMBER = "917780534935"
class ChatRequest(BaseModel):
message: str = Field(min_length=1, max_length=2000)
history: list = Field(default_factory=list)
class DesignerRequest(BaseModel):
budget_inr: int = Field(default=500, ge=99, le=50000)
group_size: int = Field(default=1, ge=1, le=50)
flavours: list[str] = Field(default_factory=list)
textures: list[str] = Field(default_factory=list)
premium: bool = False
variety: bool = False
less_sweet: bool = False
allergen_ids: list[str] = Field(default_factory=list)
severe_allergy: bool = False
request: str = ""
def asset_url(path: str) -> str:
return f"/{path}"
def numeric_price(value) -> int:
match = re.search(r"\d+", str(value))
return int(match.group()) if match else 0
def slug(value: str) -> str:
return re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
def add_on_matches_product(add_on: dict, product: dict) -> bool:
product_id = slug(product["name"])
explicit_ids = {slug(value) for value in add_on.get("compatible_product_ids", [])}
if product_id in explicit_ids:
return True
if product["category"] in add_on.get("compatible_categories", []):
return True
aliases = {
"choco_chips": ("chocolate chips", "extra chocolate chips"),
"chocolate_sauce": ("chocolate sauce", "extra chocolate drizzle"),
"white_chocolate_sauce": ("white chocolate sauce", "extra white chocolate drizzle"),
"pista": ("extra pistachio filling", "extra pistachio cream", "pistachio"),
"kunafa": ("kunafa",),
"banana_slices": ("extra banana", "banana slices"),
"mango": ("extra mango", "fresh mango"),
"dark_chocolate_filling": ("extra dark chocolate", "dark chocolate filling"),
"brownie_crumbs": ("brownie chunks", "brownie crumbs"),
"whipped_cream": ("extra cream filling", "whipped cream"),
}
listed = {value.strip().lower() for value in product["ordering_information"].get("available_add_ons", [])}
return any(alias in listed for alias in aliases.get(add_on["add_on_id"], (add_on["name"].lower(),)))
def js_data() -> str:
products = []
for item in MENU:
compatible_add_ons = [
add_on["add_on_id"]
for add_on in ADD_ONS
if add_on["availability"] == "available" and add_on_matches_product(add_on, item)
]
products.append(
{
"id": slug(item["name"]),
"name": item["name"],
"category": item["category"],
"price": numeric_price(item["price"]),
"image": asset_url(item["image"]) if item.get("image") else "",
"tagline": item.get("tagline", ""),
"description": item.get("detailed_description") or item.get("description", ""),
"short": item.get("one_line_description") or item.get("description", ""),
"serves": item.get("can_be_served_for", ""),
"sweetness": item["taste_profile"].get("sweetness", ""),
"chocolate": item["taste_profile"].get("chocolate_intensity", ""),
"textures": item["taste_profile"].get("textures", []),
"flavours": item["taste_profile"].get("flavours", []),
"bestFor": [value for value in item["taste_profile"].get("best_for", []) if value],
"tags": item.get("tags", []),
"availableAddOns": compatible_add_ons,
}
)
add_ons = [
{
"id": item["add_on_id"],
"name": item["name"],
"price": item["price_inr"],
"description": item["description"],
"flavours": item["flavour_contribution"],
"textures": item["texture_contribution"],
"allergens": item["allergen_ids"],
"premium": item["premium_add_on"],
"compatibleProductIds": [slug(value) for value in item.get("compatible_product_ids", [])],
"compatibleCategories": item.get("compatible_categories", []),
"message": item.get("upsell_message", ""),
}
for item in ADD_ONS
if item["availability"] == "available"
]
return json.dumps({"products": products, "addOns": add_ons}, ensure_ascii=False).replace("", "<\\/")
CATEGORY_DETAILS = {
"Brownie": ("01", "The originals", "Fudgy, focused, and made for the first perfect bite."),
"Melt Creation": ("02", "Playful by design", "Unexpected formats made for sharing, snacking, and showing off."),
"Dessert Sandwich": ("03", "Layered obsession", "Two brownie layers, rich fillings, and a gloriously substantial bite."),
"Brownie Bowl": ("04", "The signature bowls", "Loaded, spoonable MeltRoom experiences for one or two."),
}
def product_card(item: dict) -> str:
product_id = slug(item["name"])
image = asset_url(item["image"]) if item.get("image") else ""
flavours = " · ".join(item["taste_profile"].get("flavours", [])[:2])
badges = [
f'{escape(item.get("can_be_served_for", ""))}',
"Gluten-free",
"Eggless",
]
if "tree_nuts" in item["dietary_information"].get("allergens", []):
badges.append("Contains nuts")
return f"""
{escape(item.get("tagline", ""))}
{escape(item["description"])}
Finish it your way
Add extra chocolate, cream, fruit, pistachio, or crunch. MeltBasket keeps every finishing touch clear and separate.
{escape(item["plain_explanation"])}
Inside every MeltRoom creation
Explore the ingredients that shape MeltRoom's flavour, texture, and character. Our brownie base is gluten-free and eggless, made without maida or refined sugar, then finished with premium chocolate, fruits, creams, and thoughtful contrasts.
MeltMind AI · Choose your experience
Ask anything about MeltRoom, compare products, understand flavours and textures, explore ingredients, or get thoughtful guidance in natural conversation.
Best when you want to explore, ask questions, or compare before deciding.Choose your flavour, texture, people, budget, and moment. MeltMind creates multiple valid plans with clear prices and serving guidance.
Best when you want a complete recommendation or group order.MeltRoom · Signature dessert studio
Gluten-free, eggless brownie experiences built around rich chocolate, playful formats, and the mood you arrived with.
Your journey through this experience
Everything happens in one clear flow: discover, understand, customize, confirm, and receive.
Open product cards to understand flavour, texture, serving guidance, and price before choosing.
Explore menu ↗Ask questions naturally, compare options, or create a complete plan around your craving, people, and budget.
Meet MeltMind ↗Add products, adjust quantities, and attach compatible finishing touches to the exact dessert you want.
Place Order creates a clean WhatsApp message. MeltRoom reviews availability and shares the owner's payment QR.
After payment, MeltRoom updates the order and delivery status. Choose Rapido delivery or pickup near KLN Reddy Colony.