# -*- coding: utf-8 -*- """ ================================================== 🚀 DEPLOY-AUTO — Cristal AI All-in-One File เวอร์ชัน: 1.0.0 เจ้าของ: TPS Group · Thanwa Phupingbut (Rufio D'noto) ใช้งาน: รันไฟล์นี้ได้เลย หรือ Deploy บน Railway, Vercel, Render, Hang ฯลฯ ================================================== """ from fastapi import FastAPI, Request, Form from fastapi.responses import HTMLResponse, JSONResponse from fastapi.staticfiles import StaticFiles from fastapi.templating import Jinja2Templates from pathlib import Path import os import sys # ========================================== # ✅ สร้างแอป — สำคัญที่สุด ต้องมาก่อน! # ========================================== BASE_DIR = Path(__file__).resolve().parent app = FastAPI( title="Cristal AI", version="1.0.0", description="Cristal is the creator of world-class AI" ) # ========================================== # 📁 สร้างโฟลเดอร์และไฟล์อัตโนมัติ # ========================================== def ensure_folders(): """สร้างโฟลเดอร์ที่จำเป็นถ้ายังไม่มี""" folders = [ BASE_DIR / "templates", BASE_DIR / "static" / "css", BASE_DIR / "static" / "js" ] for f in folders: f.mkdir(parents=True, exist_ok=True) ensure_folders() # ========================================== # 📝 เนื้อหาไฟล์หน้าเว็บ — ฝังในโค้ดเลย # ========================================== FILES = { "templates/base.html": """
ออกแบบเทคโนโลยี การสนทนา และอนาคตของ AI ไปพร้อมกับคุณ