← Chat demo Admin → SDK

LiLa ChatAI SDK v1

Thư viện nhúng đa môi trường — widget UI, headless API, tùy theme/prompt/tính năng theo từng profile công ty.

Quick start (JavaScript)

<link rel="stylesheet" href="/sdk/lila-sdk.css">
<div id="lila-chat"></div>
<script src="/sdk/lila-sdk.js"></script>
<script>
LilaSDK.create({
  company: 'SaoDo',        // slug công ty
  profile: 'sdk_xxx',      // profile ID (Admin → SDK)
  apiKey: 'lila_...',      // API key profile
  container: '#lila-chat',
  // mode: 'headless',     // không UI — chỉ API
  theme: { primary: '#6366f1' },
  prompts: {
    system: 'Bạn là tư vấn viên cho shop X...',
    greeting: 'Xin chào!'
  },
  features: { attach: true, voice: true, streaming: true },
  onResponse: (r) => console.log(r.answer)
});
</script>

Live demo

Thêm query: ?company=SaoDo&profile=...&key=lila_...

Chế độ tích hợp

widget (mặc định)

Hộp chat native — attach, voice, stream, theme CSS variables. Giống chat premium.

headless / api

mode: 'headless' — không render UI. Dùng send(), sendStream() nhận JSON.

legacy iframe

LilaWidget.init({...}) — iframe embed đơn giản (tương thích cũ).

Samples

📦 Widget đầy đủ + event log 🔌 Headless — chỉ API, không UI 🎨 Custom theme & quick replies

Python: public/sdk/samples/python_headless.py

API Reference

GET /api/sdk/v1/init
POST /api/sdk/v1/chat
POST /api/sdk/v1/chat/stream
POST /api/sdk/v1/session/end

Header: X-Lila-Api-Key: lila_...

Cấu hình profile (Admin)

Admin → Tích hợp → SDK: tạo profile theo môi trường (website, app mobile, kiosk...). Mỗi profile có API key, system prompt, theme, bật/tắt attach/voice/sources.