botserver/docs/src/chapter-01/README.md

213 lines
6.3 KiB
Markdown
Raw Normal View History

2025-11-21 12:13:48 -03:00
# Chapter 01: Run and Talk
2025-11-23 20:12:09 -03:00
Welcome to General Bots - your journey to AI independence starts here. In a world dominated by expensive, proprietary AI solutions, General Bots offers a refreshing alternative: a complete, open-source AI platform that you control entirely.
## Why General Bots?
Before diving into installation, let's understand what makes General Bots different:
1. **Complete Ownership**: Unlike SaaS solutions that lock your data in the cloud, General Bots runs on your infrastructure. Your conversations, your data, your rules.
2. **Zero-to-AI in Minutes**: Our bootstrap process sets up everything - database, storage, vector search, and AI models - with a single command. No DevOps expertise required.
3. **Cost-Effective**: Running your own AI infrastructure can be 10x cheaper than cloud services at scale.
4. **Privacy First**: Your data never leaves your servers. Perfect for healthcare, finance, or any privacy-conscious application.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## The One-Command Install
```bash
2025-11-21 12:13:48 -03:00
./botserver
```
2025-11-23 17:02:22 -03:00
That's literally it. First run triggers auto-bootstrap that:
- Installs PostgreSQL, cache, storage, vector DB
- Downloads AI models
- Creates default bot
2025-11-23 20:12:09 -03:00
- Starts UI server
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
Takes 2-5 minutes. Grab coffee. Come back to a running bot.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## Your First Chat
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
Once bootstrap finishes:
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
1. Open browser to `http://localhost:8080`
2. Write a simple tool (see below)
3. Bot responds using GPT-3.5 (or local model)
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
No configuration. No API keys (for local). It just works.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## What's Actually Happening
2025-11-23 17:02:22 -03:00
Behind that simple `./botserver` command:
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
```
Installing PostgreSQL 16.2... ✓
Installing Valkey cache... ✓
Installing SeaweedFS storage... ✓
Installing Qdrant vectors... ✓
Downloading embeddings... ✓
Creating database schema... ✓
Generating secure credentials... ✓
Loading bot templates... ✓
2025-11-23 20:12:09 -03:00
Starting UI server on :8080 ✓
2025-11-23 17:02:22 -03:00
```
2025-11-23 13:46:55 -03:00
2025-11-23 17:02:22 -03:00
Everything lands in `botserver-stack/` directory. Fully self-contained.
2025-11-23 13:46:55 -03:00
2025-11-23 17:02:22 -03:00
## Make Your Own Bot in 2 Minutes
2025-11-23 13:46:55 -03:00
2025-11-23 17:02:22 -03:00
### Step 1: Create Package
2025-11-23 13:46:55 -03:00
```bash
2025-11-23 17:02:22 -03:00
mkdir templates/my-bot.gbai
mkdir templates/my-bot.gbai/my-bot.gbdialog
2025-11-23 13:46:55 -03:00
```
2025-11-23 17:02:22 -03:00
### Step 2: Write Start Script
```bash
cat > templates/my-bot.gbai/my-bot.gbdialog/start.bas << 'EOF'
TALK "Hi! I'm your personal assistant."
TALK "What can I help you with?"
answer = HEAR
TALK "I can help you with: " + answer
EOF
2025-11-21 12:13:48 -03:00
```
2025-11-23 17:02:22 -03:00
### Step 3: Restart & Test
```bash
./botserver restart
# Visit http://localhost:8080/my-bot
2025-11-23 13:46:55 -03:00
```
2025-11-23 17:02:22 -03:00
Your bot is live.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## Adding Intelligence
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
### Give It Knowledge
Drop PDFs into knowledge base:
```bash
mkdir templates/my-bot.gbai/my-bot.gbkb
cp ~/Documents/policies.pdf templates/my-bot.gbai/my-bot.gbkb/
```
2025-11-23 13:46:55 -03:00
2025-11-23 17:02:22 -03:00
Bot instantly answers questions from your documents.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
### Give It Tools
Create a tool for booking meetings:
```bash
cat > templates/my-bot.gbai/my-bot.gbdialog/book-meeting.bas << 'EOF'
PARAM person, date, time
DESCRIPTION "Books a meeting"
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
SAVE "meetings.csv", person, date, time
TALK "Meeting booked with " + person + " on " + date
EOF
2025-11-21 12:13:48 -03:00
```
2025-11-23 17:02:22 -03:00
Now just say "Book a meeting with John tomorrow at 2pm" - AI handles the rest.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## Optional Components
2025-11-23 13:46:55 -03:00
2025-11-23 17:02:22 -03:00
Want email? Video calls? Better models?
2025-11-23 17:02:22 -03:00
```bash
./botserver install email # Full email server
./botserver install meeting # Video conferencing
./botserver install llm # Local AI models
2025-11-21 12:13:48 -03:00
```
2025-11-23 17:02:22 -03:00
Each adds specific functionality. None required to start.
## File Structure After Bootstrap
2025-11-21 12:13:48 -03:00
```
2025-11-23 17:02:22 -03:00
botserver-stack/
postgres/ # Database files
valkey/ # Cache data
seaweedfs/ # Object storage
qdrant/ # Vector database
models/ # Embeddings
templates/
default.gbai/ # Default bot
my-bot.gbai/ # Your bot
.env # Auto-generated config
2025-11-21 12:13:48 -03:00
```
2025-11-23 17:02:22 -03:00
## Troubleshooting Quick Fixes
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
**Port already in use?**
```bash
HTTP_PORT=3000 ./botserver
```
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
**Bootstrap fails?**
```bash
./botserver cleanup
./botserver # Try again
```
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
**Want fresh start?**
```bash
rm -rf botserver-stack .env
./botserver
```
**Check what's running:**
```bash
./botserver status
```
2025-11-21 12:13:48 -03:00
2025-11-23 20:12:09 -03:00
## See Also
### Documentation
- [Overview](./overview.md) - Architecture and concepts
- [Quick Start](./quick-start.md) - Get running in 5 minutes
- [Installation](./installation.md) - Detailed setup instructions
- [First Conversation](./first-conversation.md) - Build your first bot
- [Sessions and Channels](./sessions.md) - Multi-user support
- [Chapter 2: Packages](../chapter-02/README.md) - Understanding bot components
### Further Reading - Blog Posts
- [Why We Chose Open Source](https://pragmatismo.cloud/blog/why-pragmatismo-selected-open-source) - Philosophy behind General Bots
- [Escape from BigTech](https://pragmatismo.cloud/blog/escape-from-bigtech) - Breaking free from proprietary AI platforms
- [Cost-Effective Bot Orchestration](https://pragmatismo.cloud/blog/cost-effective-bot-orchestration) - Economic benefits of self-hosting
- [The Hidden Costs of SaaS](https://pragmatismo.cloud/blog/saas-hidden-costs) - Why owning your stack matters
- [LLM Boom Is Over](https://pragmatismo.cloud/blog/llm-boom-is-over) - Focus on practical AI applications
### Next Chapter
Continue to [Chapter 2: About Packages](../chapter-02/README.md) to learn about the template system that makes General Bots so powerful.
- [Chapter 3: Knowledge Base](../chapter-03/README.md) - Document management
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Complete command list
2025-11-23 17:02:22 -03:00
## Container Deployment
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
Prefer containers? Use LXC mode:
```bash
./botserver --container
```
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
Creates isolated LXC containers for each component. Same auto-bootstrap, better isolation.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## What You've Learned
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
✅ BotServer installs itself completely
✅ Default bot works immediately
✅ Create new bots in minutes
✅ Add documents for instant knowledge
✅ Write tools for custom actions
2025-11-21 12:13:48 -03:00
## Next Steps
2025-11-23 17:02:22 -03:00
- **[Quick Start](./quick-start.md)** - Build a real bot
- **[Installation Details](./installation.md)** - How bootstrap works
- **[First Conversation](./first-conversation.md)** - Chat interface tour
- **[Sessions](./sessions.md)** - How conversations persist
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
## The Philosophy
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
We believe setup should be invisible. You want a bot, not a DevOps degree. That's why everything auto-configures. Focus on your bot's personality and knowledge, not infrastructure.
2025-11-21 12:13:48 -03:00
2025-11-23 17:02:22 -03:00
Ready for more? Continue to [Quick Start](./quick-start.md) to build something real.