Built by Anes Lachemi Β· Powered by n8n Β· LLM: Llama 4 Scout 17B via Groq Β· Vector DB: Supabase pgvector Β· Search: Apify Β· Image Gen: FLUX.1-schnell
Nami-AI is not a generic chatbot. It is an intelligent AI marketing consultant and entrepreneur advisor built specifically for the Algerian market.
It understands local consumer psychology, Algerian platforms (Ouedkniss, Yassir, BaridiMob, Temtem), wilaya-based targeting, Ramadan seasonality, cash-on-delivery dominance, and informal economy dynamics that no international AI tool accounts for.
Nami speaks Darija, French, Arabic, and English β automatically matching the user's language β and grounds every answer in DZ-specific context. It can also generate images directly in the chat via FLUX.1-schnell.
ββββββββββββββββββββββββββββββββββββββββββββββββ
β Static Web UI β
β index.html + script.js + style.css β
βββββββββββββββββββββ¬βββββββββββββββββββββββββββ
β POST FormData
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β n8n Chat Webhook β
β β Get User Prefs (Supabase) β
β β Format Prefs β
β β Has File? β
β YES β Extract PDF β File Agent β
β NO β Main Agent β
ββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββ΄βββββββββββββ
βΌ βΌ
Main Agent File Agent
β’ Groq Llama 4 β’ Groq Llama 4
β’ RAG (Supabase) β’ RAG (Supabase)
β’ Apify Web Search β’ Apify Web Search
β’ FLUX Image Gen β’ FLUX Image Gen
Google Drive Folder
β
Loop Over Files β Filter (PDF / CSV / TXT)
β
Download β Extract Text
β
Embed with HuggingFace (768-dim)
β
Insert into Supabase pgvector
Chat Trigger (public webhook, file upload enabled)
β
Get User Prefs β Format User Prefs
β
Has file attached?
YES β Extract PDF β File Agent (Groq + RAG + Image Gen)
NO β Main Agent (Groq + RAG + Web Search + Image Gen)
| Layer | Tool |
|---|---|
| Workflow Engine | n8n |
| LLM | Meta Llama 4 Scout 17B via Groq |
| Vector Database | Supabase (pgvector) |
| Embeddings | HuggingFace Inference API β 768 dimensions |
| Knowledge Source | Google Drive folder (PDF / CSV / TXT) |
| Web Search | Apify β Google Search Results Scraper |
| Image Generation | FLUX.1-schnell via HuggingFace Inference Router |
| Chat Interface | n8n Chat Trigger + Custom Web UI |
| User Memory | Supabase user_preferences table |
| Feature | Details |
|---|---|
| π§ RAG | Queries Supabase vector store before every answer |
| π Multilingual | Auto-detects Darija / French / Arabic / English |
| π©πΏ DZ Context | References local platforms, payments, wilayas, seasons |
| πΌοΈ Image Generation | FLUX.1-schnell β generates images on natural language request |
| π File Upload | Users attach PDFs; Nami reads and analyzes them live |
| π Web Search | Real-time Google search for prices, news, and trends |
| πΎ User Memory | Session preferences persisted in Supabase |
| π Honest | Never fabricates statistics, influencer names, or platform data |
nami-ai/
βββ README.md
βββ index.html β Static chat UI
βββ script.js β Frontend logic (fetch, state, rendering)
βββ style.css β UI styles
βββ workflow/
β βββ nami-ai.json β Exported n8n workflow (import into n8n)
βββ supabase/
βββ setup.sql β SQL schema: documents table + match function
| Service | Purpose | Link |
|---|---|---|
| n8n | Workflow engine | n8n.io |
| Groq | LLM inference (free tier available) | console.groq.com |
| Supabase | Vector DB + user memory | supabase.com |
| HuggingFace | Embeddings + image generation | huggingface.co |
| Google Drive | Knowledge base file storage | β |
| Apify | Web search scraper | apify.com |
Run supabase/setup.sql in your Supabase project's SQL editor. It creates:
documentstable β stores embedded knowledge base chunks (768-dim vectors)user_preferencestable β stores per-session user contextmatch_documents()function β cosine similarity search via pgvector
In n8n β Settings β Credentials, add the following:
| Credential Type | Notes |
|---|---|
| Google Drive OAuth2 | Authorize via Google Cloud Console OAuth client |
| Groq API | API key from your Groq console |
| Supabase | Use the service role key (not the anon key) |
| HuggingFace Token | Token with Inference API access enabled |
| Apify API | Token from your Apify account |
- In n8n β Workflows β Import from file
- Upload
workflow/nami-ai.json - Assign your credentials to each node
- In the "Search files and folders" node, replace the folder ID with your own Google Drive knowledge base folder ID
- Upload
.pdf,.csv, or.txtfiles to your Google Drive folder - In n8n, click "Test workflow" on the manual trigger (Pipeline 1)
- The workflow loops through all files, embeds them via HuggingFace, and stores chunks in Supabase
- Verify records appear in your
documentstable
β οΈ The ingestion pipeline does not deduplicate. Clear thedocumentstable before re-running to avoid duplicate vectors.
- Activate the workflow in n8n (toggle β ON)
- Open the "When chat message received" node β copy the Production URL
- In
script.js, updatePROXY_URLto your webhook production URL:
const PROXY_URL = 'https://your-n8n-instance.com/webhook/YOUR-WEBHOOK-ID/chat'- Deploy
index.html,script.js, andstyle.cssto any static host (GitHub Pages, Vercel, Netlify, etc.)
Both agents share the same core behavioral rules:
- Always query the knowledge base first before answering
- Respond in the user's exact language β Darija, French, Arabic, or English
- Never invent statistics, influencer names, or platform data
- Use web search only for time-sensitive queries (prices, news, trends)
- Simple questions β 1β3 sentences, no headers
- Marketing / business questions β numbered steps + one
π‘ DZ Pro Tip - Image requests β call FLUX tool once, return result immediately
Payment: BaridiMob, CCP, Cash on Delivery (dominates e-commerce), Dahabia
Platforms: Ouedkniss, Yassir Business, Instagram/Facebook (primary), Telegram groups
Trust: Phone number visibility, wilaya targeting, word-of-mouth (chka)
Seasons: Ramadan (peak), AΓ―d el-Fitr, AΓ―d el-Adha, rentrΓ©e scolaire (Sept)
Barriers: Low card penetration, delivery trust gaps, price sensitivity
| Parameter | Value |
|---|---|
| Chunk size | 600 characters |
| Chunk overlap | 100 characters |
| Splitter | Recursive Character Text Splitter |
| Top K results | 20 |
| Similarity | Cosine via pgvector <=> operator |
| Embedding model | HuggingFace Inference API (768-dim) |
Nami uses FLUX.1-schnell via the HuggingFace Inference Router. When a user requests an image in any language, the agent crafts a detailed English prompt and calls the tool.
Endpoint: https://router.huggingface.co/hf-inference/models/black-forest-labs/FLUX.1-schnell
Method: POST
Headers: Authorization: Bearer <YOUR_HF_TOKEN>
Content-Type: application/json
Accept: image/jpeg
Body: { "inputs": "<detailed English prompt>" }
The interface is a fully static single-page application with no backend dependencies:
- Sidebar with chat history persisted in
localStorage - Welcome screen with suggested DZ-relevant prompts
- PDF file attachment support
- Markdown-lite rendering in bot responses
- Inline image rendering for generated images
- Mobile responsive with hamburger sidebar
- 90-second timeout for image generation with contextual loading message
| Issue | Notes |
|---|---|
| Web search query | Apify uses raw chatInput as query β append "AlgΓ©rie" or "DZ" for better local results |
| File upload | Chat UI supports PDF only |
| Session memory | Loaded manually β no automatic cross-session history persistence |
| Ingestion deduplication | Re-running on already-indexed files creates duplicates β clear documents table first |
| Node | Purpose |
|---|---|
| Manual Trigger | Starts ingestion on demand |
| Google Drive β Search | Lists all files in the knowledge base folder |
| Split In Batches | Processes files one by one |
| IF | Filters to PDF / CSV / TXT; skips placeholder files |
| Google Drive β Download | Downloads binary file content |
| Switch | Routes PDF vs plain text paths |
| Extract From File | Extracts text content from PDFs |
| Merge | Combines output from both text paths |
| Supabase β Create Record | Inserts filename metadata into documents |
| Supabase Vector Store | Embeds and stores chunks into pgvector |
| HuggingFace Embeddings | Generates 768-dim embedding vectors |
| Document Loader | Loads extracted text for chunking |
| Recursive Text Splitter | Splits at 600 chars with 100 char overlap |
| Node | Purpose |
|---|---|
| Chat Trigger | Public webhook β accepts text and file uploads |
| Supabase β Get Prefs | Loads session user preferences |
| Set β Format Prefs | Formats preferences into a prompt context string |
| IF | Routes file vs text-only messages |
| Extract From File | Extracts user-uploaded PDF content |
| AI Agent (Main) | Handles all text-only chat |
| AI Agent (File) | Handles messages with attached files |
| Groq Chat Model | Llama 4 Scout 17B inference |
| Supabase Vector Store | RAG retrieval tool (Top K = 20) |
| Apify Tool | Live Google search for real-time queries |
| HTTP Request Tool | FLUX.1-schnell image generation |
To extend Nami:
- Add new tools β Ouedkniss scraper, CRM integration, product price tracker
- Expand the knowledge base β Algerian market research, sector reports, competitor analyses
- Improve multilingual search β pre-process queries to append "AlgΓ©rie" / "DZ" automatically
- Add ingestion deduplication β hash-based check before inserting vectors
- Automate session memory β write preferences back to Supabase at conversation end
This project is proprietary. All rights reserved by Anes Lachemi.
Nami-AI β Algeria's #1 AI marketing consultant π©πΏ
Built with precision. Designed for the DZ market.