Initial implementation of the bot: - cmd/chat-bot: CLI entrypoint (serve, reindex, ask, version) - internal/agent: LLM provider client + agent runner with RAG injection - internal/config: YAML config loader (providers, RAG, persona, server) - internal/i18n: response-language detection (EN/ES) - internal/persona: persona system prompt assembly from YAML - internal/portfolio: heading-based chunker + SQLite FTS5 indexer - internal/server: chi router with /api/chat (SSE), /api/health, /api/info, /api/reindex, middleware (RequestID, Logging, CORS, RateLimit) - internal/streaming: SSE protocol helpers (start, chunk, sources, done, error) - web/: drop-in vanilla-JS chat widget (no build, no deps) + demo + README - bench/: reproducible driver benchmark (modernc vs mattn SQLite) - configs/portfolio-bot.yaml: llama.cpp default provider, SQLite RAG, canine persona - docs/architecture.md / .es.md: aligned with SQLite FTS5 + llama.cpp decisions - data/projects/README*.md: project data documentation - README.md / .es.md: updated for current implementation All tests pass (go test ./...). Bot is functional end-to-end with the configured LLM provider.
113 lines
No EOL
4.2 KiB
Markdown
113 lines
No EOL
4.2 KiB
Markdown
# Rony Chat Bot — HTTP Portfolio Bot
|
|
|
|
> 🌐 **Language:** [English](./README.md) | [Español](./README.es.md)
|
|
>
|
|
> 🤖 **HTTP chatbot that presents your portfolio and answers questions about your projects.**
|
|
|
|
**Rony Chat Bot** is a chatbot based on [`rony-llm-agent`](https://github.com/VictorVargas/rony-llm-agent) that integrates with an Astro/React site to answer questions about Victor Hugo Vargas and his projects, using **RAG over markdown files**.
|
|
|
|
## ✨ Features
|
|
|
|
- 🌐 **HTTP server** with SSE (Server-Sent Events) streaming
|
|
- 🧠 **RAG over markdown** — automatically indexes `.md` in `data/projects/` (SQLite FTS5, no embeddings)
|
|
- 🎭 **Customizable persona** — responds as "Victor's assistant"
|
|
- ⚡ **Self-hosted** with llama.cpp (default) or Ollama (no cloud API key required)
|
|
- 💬 **Drop-in chat widget** — vanilla JS, no build step, works in any site
|
|
- 🛡️ **Rate limiting** and structured logging
|
|
- 📦 **Portable** — adaptable to other contexts (clients, products, etc.)
|
|
|
|
## 🚀 Quick start
|
|
|
|
```bash
|
|
# 1. Install
|
|
git clone https://github.com/VictorVargas/rony-chat-bot.git
|
|
cd rony-chat-bot
|
|
|
|
# 2. Resolve dependencies (creates go.sum with hashes)
|
|
go mod tidy
|
|
|
|
# 3. Configure provider (llama.cpp by default)
|
|
# Download a GGUF model, e.g.:
|
|
# https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct-GGUF
|
|
export RONY_MODELS_PATH=/path/to/models
|
|
|
|
# 4. Load your projects in data/projects/
|
|
echo "# My Cool Project\nDescription..." > data/projects/my-project.md
|
|
|
|
# 5. Build
|
|
go build -o bin/chat-bot ./cmd/chat-bot
|
|
|
|
# 6. Run
|
|
./bin/chat-bot serve
|
|
# → Serves on http://localhost:7331
|
|
```
|
|
|
|
## 📁 Structure
|
|
|
|
```
|
|
rony-chat-bot/
|
|
├── cmd/chat-bot/ # Entry point (CLI)
|
|
├── internal/
|
|
│ ├── server/ # HTTP handlers + SSE
|
|
│ ├── agent/ # LLM client + RAG + persona runner
|
|
│ ├── portfolio/ # Data loader (markdown → RAG)
|
|
│ ├── persona/ # Persona override
|
|
│ ├── streaming/ # SSE helpers
|
|
│ └── i18n/ # Language detection (EN/ES)
|
|
├── web/ # ← DROP-IN CHAT WIDGET
|
|
│ ├── chat-widget.js
|
|
│ ├── chat-widget.css
|
|
│ └── example.html
|
|
├── data/projects/ # ← YOUR PROJECTS IN MARKDOWN
|
|
│ ├── rony-harness.md
|
|
│ ├── rony-llm-agent.md
|
|
│ └── ...
|
|
├── configs/
|
|
│ └── portfolio-bot.yaml # Provider + RAG + persona config
|
|
├── docs/
|
|
│ └── architecture.md # ← Complete technical specification
|
|
└── go.mod # require rony-llm-agent
|
|
```
|
|
|
|
## 🎯 Embed in any site
|
|
|
|
The bot ships with a drop-in chat widget. Add two files and a `<script>` tag:
|
|
|
|
```html
|
|
<link rel="stylesheet" href="/chat-widget.css">
|
|
<script src="/chat-widget.js"
|
|
data-api-url="https://chat.example.com"
|
|
data-title="Ask me anything"
|
|
data-position="bottom-right"
|
|
data-theme="auto"
|
|
defer></script>
|
|
```
|
|
|
|
See [`web/README.md`](./web/README.md) for the full configuration reference and Astro/Next.js integration snippets. Full architecture in [`docs/architecture.md`](./docs/architecture.md) §5.
|
|
|
|
## 🔄 Adapt to another client
|
|
|
|
This bot is designed to be **atomic** and reusable. To adapt it (e.g., chatbot for a car dealership):
|
|
|
|
1. Fork/clone this repo
|
|
2. Replace `data/projects/` with `data/inventory/` (or another domain)
|
|
3. Update `configs/portfolio-bot.yaml` with the new persona
|
|
4. Deploy
|
|
|
|
The `rony-llm-agent` library doesn't change.
|
|
|
|
## 📚 Documentation
|
|
|
|
- [**Architecture doc**](./docs/architecture.md) — Complete technical specification
|
|
- [Library: `rony-llm-agent`](https://github.com/VictorVargas/rony-llm-agent) — Reusable core
|
|
- [Rony Harness](https://github.com/VictorVargas/rony-harness) — The other project using the same library
|
|
|
|
## 📄 License
|
|
|
|
MIT — see [`LICENSE`](./LICENSE).
|
|
|
|
## 🔗 Workspace projects
|
|
|
|
- [`rony-llm-agent`](https://github.com/VictorVargas/rony-llm-agent) — Core library
|
|
- [`rony-harness`](https://github.com/VictorVargas/rony-harness) — AI agent harness (TUI)
|
|
- [`portfolio`](https://github.com/VictorVargas/portfolio) — Astro + React site (integrates this bot) |