# Octopus AI

> Web App · 2026-07-27
> Live: https://octopus-ai.pages.dev


An AI customer support turnkey platform. A single codebase serves simultaneously as the public landing page, client administration backend, and embeddable live chat widget—the demo chat widget on the landing page is the actual product runtime, not a video mock or static screenshot. Runs serverless on Cloudflare Pages Functions with zero build steps, zero frontend frameworks, and zero client bundle dependencies.

## Features

- **RAG Customer Support API** — Retrieves client knowledge base chunks to generate answers via LLM with cited reference sources.
- **Embeddable Chat Widget** — Easily embedded onto client websites with a single script tag, utilizing Shadow DOM isolation to prevent CSS leakage.
- **Admin Dashboard** — Knowledge base document management, conversation inbox, human agent takeover, and lead tracking.
- **LINE Official Account Integration** — Messaging API webhook integration allowing the identical knowledge base to serve LINE inquiries directly.
- **Pre-Handoff Health Check** — Diagnostic `/api/admin/status` endpoint detailing any missing environment variables or configuration gaps.

## Three-Tier Retrieval Fallback Strategy

Designed around progressive resilience: "More configuration unlocks higher fidelity, but missing configuration never breaks the system." When no external API keys are configured, it performs keyword matching against the knowledge base with built-in fallback FAQs, enabling offline demonstrations without external API dependencies. Once an LLM endpoint is provided, responses are synthesized by generative models. Supplying an embedding endpoint upgrades retrieval to semantic vector search. Given traditional Chinese lacks natural whitespace word segmentation, keyword retrieval utilizes bigram matching.

## Technical Architecture

Cloudflare Pages Functions + D1 (conversations, knowledge bases, leads) + R2 (file uploads). LLM and embedding endpoints are configured via environment variables, integrating seamlessly with any OpenAI-compatible provider. Vector embeddings are stored in D1's `chunks.embedding` column, loaded into memory at query time to compute cosine similarity.

## Security & Protection

Admin endpoints and sensitive APIs are strictly guarded by HTTP Basic Authentication; empty password configurations hard-fail rather than defaulting to open access. Public chat and submission endpoints implement IP rate limiting (30 chats / 10 minutes, 5 form submissions / 10 minutes), storing only SHA-256 hashed IP addresses. Any database lookup failure during rate limiting strictly denies requests to prevent database anomalies from triggering unmetered calls to paid LLM endpoints.

Tags: cloudflare, d1, rag, llm, line, chatbot, saas
Canonical: https://labangram.kamera-ichi.com/en/projects/octopus-ai/
Author: Cheng Jung Chen (Laban) — https://labangram.kamera-ichi.com/en/about
