Live Demo: https://my-angular-app.sidharthak25.workers.dev
This project is a real-time, stateful AI chat application built entirely on Cloudflare's edge infrastructure. It features a modern, responsive UI built with Angular SSR (Server Side Rendering) that supports both text and voice interactions, utilizing Cloudflare Workers AI for natural language processing and Durable Objects for isolated, auto-cleaning session memory.
-
1. LLM (Large Language Model):
- Uses Cloudflare Workers AI to run Meta's
Llama 3for text responses and OpenAI'sWhisperfor audio transcription directly at the edge.
- Uses Cloudflare Workers AI to run Meta's
-
2. Workflow / Coordination:
- A Cloudflare Worker serves as the central orchestrator, routing HTTP requests, handling multipart audio files, and sequencing the AI models.
-
3. User Input (Chat & Voice):
- A custom Angular UI captures text or records voice via the native MediaRecorder API, transcribing audio for user review before prompting the LLM.
-
4. Memory / State:
- Cloudflare Durable Objects (SQLite backend) provide isolated session histories tied to unique user UUIDs, utilizing the Alarms API for automatic self-deletion of abandoned chats.
- Node.js installed.
- Wrangler CLI authenticated (
npx wrangler login).
-
Install dependencies:
npm install
-
Build the Angular frontend and SSR engine:
npm run build
-
Test locally:
npx wrangler dev
-
Deploy to Cloudflare:
npx wrangler deploy
(Note: Ensure your
wrangler.jsonincludes thenew_sqlite_classesmigration array for free-tier Durable Object compatibility).