Reorganize chapters and add admin/user views documentation

Chapter renames:
- chapter-09-api -> chapter-09-tools (LLM Tools)
- chapter-10-api -> chapter-10-rest (REST Endpoints)

New documentation:
- chapter-04-gbui/admin-user-views.md: Complete guide to User vs Admin interfaces
  - User Settings (/api/user/*): profile, security, notifications, storage
  - Admin Panel (/api/admin/*): users, groups, bots, DNS, audit
  - Permission levels: guest, user, manager, admin
  - Desktop sync considerations

Updated:
- Drive app docs with sync feature (rclone, desktop-only)
- All cross-references to renamed chapters
- SUMMARY.md with new structure and admin-user-views entry
This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-12-05 06:50:56 -03:00
parent fde61592ab
commit 49eb6696ea
61 changed files with 501 additions and 275 deletions

View file

@ -51,6 +51,7 @@
- [Chapter 04: .gbui Interface Reference](./chapter-04-gbui/README.md)
- [Suite User Manual](./chapter-04-gbui/suite-manual.md)
- [Admin vs User Views](./chapter-04-gbui/admin-user-views.md)
- [UI Structure](./chapter-04-gbui/ui-structure.md)
- [single.gbui - Simple Chat](./chapter-04-gbui/single-gbui.md)
- [Console Mode](./chapter-04-gbui/console-mode.md)
@ -240,42 +241,42 @@
# Part IX - Tools and Integration
- [Chapter 09: API and Tooling](./chapter-09-api/README.md)
- [Tool Definition](./chapter-09-api/tool-definition.md)
- [PARAM Declaration](./chapter-09-api/param-declaration.md)
- [Tool Compilation](./chapter-09-api/compilation.md)
- [MCP Format](./chapter-09-api/mcp-format.md)
- [Tool Format](./chapter-09-api/openai-format.md)
- [GET Keyword Integration](./chapter-09-api/get-integration.md)
- [External APIs](./chapter-09-api/external-apis.md)
- [LLM REST Server](./chapter-09-api/llm-rest-server.md)
- [NVIDIA GPU Setup for LXC](./chapter-09-api/nvidia-gpu-setup.md)
- [Chapter 09: LLM Tools](./chapter-09-tools/README.md)
- [Tool Definition](./chapter-09-tools/tool-definition.md)
- [PARAM Declaration](./chapter-09-tools/param-declaration.md)
- [Tool Compilation](./chapter-09-tools/compilation.md)
- [MCP Format](./chapter-09-tools/mcp-format.md)
- [Tool Format](./chapter-09-tools/openai-format.md)
- [GET Keyword Integration](./chapter-09-tools/get-integration.md)
- [External APIs](./chapter-09-tools/external-apis.md)
- [LLM REST Server](./chapter-09-tools/llm-rest-server.md)
- [NVIDIA GPU Setup for LXC](./chapter-09-tools/nvidia-gpu-setup.md)
- [Chapter 10: REST API Reference](./chapter-10-api/README.md)
- [Files API](./chapter-10-api/files-api.md)
- [Document Processing API](./chapter-10-api/document-processing.md)
- [Users API](./chapter-10-api/users-api.md)
- [User Security API](./chapter-10-api/user-security.md)
- [Groups API](./chapter-10-api/groups-api.md)
- [Group Membership API](./chapter-10-api/group-membership.md)
- [Conversations API](./chapter-10-api/conversations-api.md)
- [Calls API](./chapter-10-api/calls-api.md)
- [Whiteboard API](./chapter-10-api/whiteboard-api.md)
- [Email API](./chapter-10-api/email-api.md)
- [Notifications API](./chapter-10-api/notifications-api.md)
- [Calendar API](./chapter-10-api/calendar-api.md)
- [Tasks API](./chapter-10-api/tasks-api.md)
- [Storage API](./chapter-10-api/storage-api.md)
- [Backup API](./chapter-10-api/backup-api.md)
- [Analytics API](./chapter-10-api/analytics-api.md)
- [Reports API](./chapter-10-api/reports-api.md)
- [Admin API](./chapter-10-api/admin-api.md)
- [Monitoring API](./chapter-10-api/monitoring-api.md)
- [AI API](./chapter-10-api/ai-api.md)
- [ML API](./chapter-10-api/ml-api.md)
- [Security API](./chapter-10-api/security-api.md)
- [Compliance API](./chapter-10-api/compliance-api.md)
- [Example Integrations](./chapter-10-api/examples.md)
- [Chapter 10: REST Endpoints](./chapter-10-rest/README.md)
- [Files API](./chapter-10-rest/files-api.md)
- [Document Processing API](./chapter-10-rest/document-processing.md)
- [Users API](./chapter-10-rest/users-api.md)
- [User Security API](./chapter-10-rest/user-security.md)
- [Groups API](./chapter-10-rest/groups-api.md)
- [Group Membership API](./chapter-10-rest/group-membership.md)
- [Conversations API](./chapter-10-rest/conversations-api.md)
- [Calls API](./chapter-10-rest/calls-api.md)
- [Whiteboard API](./chapter-10-rest/whiteboard-api.md)
- [Email API](./chapter-10-rest/email-api.md)
- [Notifications API](./chapter-10-rest/notifications-api.md)
- [Calendar API](./chapter-10-rest/calendar-api.md)
- [Tasks API](./chapter-10-rest/tasks-api.md)
- [Storage API](./chapter-10-rest/storage-api.md)
- [Backup API](./chapter-10-rest/backup-api.md)
- [Analytics API](./chapter-10-rest/analytics-api.md)
- [Reports API](./chapter-10-rest/reports-api.md)
- [Admin API](./chapter-10-rest/admin-api.md)
- [Monitoring API](./chapter-10-rest/monitoring-api.md)
- [AI API](./chapter-10-rest/ai-api.md)
- [ML API](./chapter-10-rest/ml-api.md)
- [Security API](./chapter-10-rest/security-api.md)
- [Compliance API](./chapter-10-rest/compliance-api.md)
- [Example Integrations](./chapter-10-rest/examples.md)
# Part X - Feature Deep Dive

View file

@ -437,4 +437,4 @@ llm-log-timing,true
- [LLM Configuration](../chapter-08-config/llm-config.md) - Detailed configuration guide
- [Semantic Caching](../chapter-03/caching.md) - Cache configuration
- [NVIDIA GPU Setup](../chapter-09-api/nvidia-gpu-setup.md) - GPU configuration for local models
- [NVIDIA GPU Setup](../chapter-09-tools/nvidia-gpu-setup.md) - GPU configuration for local models

View file

@ -1,4 +1,4 @@
<svg width="600" height="800" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
<svg width="600" height="850" xmlns="http://www.w3.org/2000/svg" style="max-width: 100%; height: auto;">
<defs>
<marker id="arrow" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#4B5563"/>

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -10,10 +10,10 @@ Get General Bots running and have your first conversation.
By the end of this chapter, you will:
- Have General Bots running on your machine
- Understand what happens during bootstrap
- Complete your first conversation with a bot
- Know how sessions and channels work
- Have General Bots running on your machine
- Understand what happens during bootstrap
- Complete your first conversation with a bot
- Know how sessions and channels work
---
@ -68,10 +68,10 @@ Everything installs automatically on first run—PostgreSQL, storage, cache, and
</div>
<div class="wa-message bot">
<div class="wa-bubble">
<p>📦 PostgreSQL (database)</p>
<p>📦 MinIO (file storage)</p>
<p>📦 Cache (Redis-compatible)</p>
<p>📦 Default bot templates</p>
<p>PostgreSQL (database)</p>
<p>MinIO (file storage)</p>
<p>Cache (Redis-compatible)</p>
<p>Default bot templates</p>
<p>All in <code>botserver-stack/</code> — no system-wide installation!</p>
<div class="wa-time">09:01</div>
</div>

View file

@ -41,7 +41,7 @@ The bot automatically indexes all documents, creates vector embeddings, searches
Create `enrollment.bas`:
```bas
```basic
PARAM name AS string LIKE "John Smith" DESCRIPTION "Student full name"
PARAM email AS string LIKE "john@example.com" DESCRIPTION "Contact email"
PARAM course AS string LIKE "Computer Science" DESCRIPTION "Course to enroll in"
@ -113,7 +113,7 @@ mkdir -p mybot.gbai/mybot.gbot
Example tool in `mybot.gbdialog/my-tool.bas`:
```bas
```basic
PARAM user_name AS string
PARAM request AS string
@ -129,7 +129,7 @@ Traditional chatbots require complex logic with IF/THEN statements, intent detec
Traditional approach (don't do this):
```bas
```basic
' Complex multi-step dialog
IF intent = "enrollment" THEN
TALK "Let me help you enroll. What's your name?"
@ -142,7 +142,7 @@ ENDIF
BotServer approach (just create the tool):
```bas
```basic
' In enrollment.bas - becomes a tool automatically
PARAM name AS string
PARAM email AS string

View file

@ -28,24 +28,16 @@ The bootstrap process automatically:
**First run takes 2-5 minutes.**
## Environment Configuration
## Using Existing Services
The `.env` file is **auto-generated** with secure random credentials:
If you have existing infrastructure, configure it in your bot's `config.csv`:
```bash
DATABASE_URL=postgres://gbuser:RANDOM@localhost:5432/botserver
DRIVE_SERVER=http://localhost:9000
DRIVE_ACCESSKEY=GENERATED_KEY
DRIVE_SECRET=GENERATED_SECRET
```
### Using Existing Services
Point to your own infrastructure in `.env`:
```bash
DATABASE_URL=postgres://myuser:mypass@myhost:5432/mydb
DRIVE_SERVER=http://my-drive:9000
```csv
name,value
database-url,postgres://myuser:mypass@myhost:5432/mydb
drive-server,http://my-drive:9000
drive-accesskey,my-access-key
drive-secret,my-secret-key
```
## Default Ports

View file

@ -15,21 +15,20 @@ That's it! No configuration needed.
You'll see:
```
🚀 BotServer starting...
📦 Bootstrap: Detecting system...
📦 Installing PostgreSQL...
✓ Database created
✓ Schema initialized
✓ Credentials saved to .env
📦 Installing Drive...
✓ Object storage ready
✓ Buckets created
📦 Installing Cache...
✓ Cache server running
🤖 Creating bots from templates...
✓ default.gbai → Default bot
✓ announcements.gbai → Announcements bot
✅ BotServer ready at http://localhost:8080
BotServer starting...
Bootstrap: Detecting system...
Installing PostgreSQL...
Database created
Schema initialized
Installing Drive...
Object storage ready
Buckets created
Installing Cache...
Cache server running
Creating bots from templates...
default.gbai deployed
announcements.gbai deployed
BotServer ready at http://localhost:8080
```
### 3. Open Browser
@ -50,27 +49,27 @@ Start chatting with your bot!
The **automatic bootstrap** process:
1. Detected your OS (Linux/macOS/Windows)
2. Downloaded PostgreSQL database to botserver-stack/
3. Downloaded drive (S3-compatible storage) to botserver-stack/
4. Downloaded cache component to botserver-stack/
5. Generated secure credentials`.env` (from blank environment)
6. Created database schema
7. Deployed default bots to object storage
8. Started UI server on port 8080
1. Detected your OS (Linux/macOS/Windows)
2. Downloaded PostgreSQL database to botserver-stack/
3. Downloaded drive (S3-compatible storage) to botserver-stack/
4. Downloaded cache component to botserver-stack/
5. Generated secure credentials
6. Created database schema
7. Deployed default bots to object storage
8. Started UI server on port 8080
**Zero manual configuration required!**
### Using Existing Services
If you already have PostgreSQL or drive storage running, update `.env`:
If you already have PostgreSQL or drive storage running, configure them in `config.csv` of your bot:
```bash
# Point to your existing services
DATABASE_URL=postgres://myuser:mypass@myhost:5432/mydb
DRIVE_SERVER=http://my-drive:9000
DRIVE_ACCESSKEY=my-access-key
DRIVE_SECRET=my-secret-key
```csv
name,value
database-url,postgres://myuser:mypass@myhost:5432/mydb
drive-server,http://my-drive:9000
drive-accesskey,my-access-key
drive-secret,my-secret-key
```
---
@ -83,7 +82,7 @@ DRIVE_SECRET=my-secret-key
Tools are just `.bas` files. Create `enrollment.bas`:
```bas
```basic
' Student enrollment tool
PARAM name, email, course
DESCRIPTION "Processes student enrollment"
@ -133,10 +132,10 @@ lxc-attach -n botserver
```
**Benefits**:
- Process isolation
- Resource control
- Easy management
- Lightweight virtualization
- Process isolation
- Resource control
- Easy management
- Lightweight virtualization
---
@ -212,7 +211,7 @@ mybot.gbkb/
```
### 2. Create Tools (Optional)
```bas
```basic
' enrollment.bas - just define what it does
PARAM name AS string
PARAM course AS string
@ -234,17 +233,7 @@ The LLM handles ALL conversation logic automatically!
## Configuration (Optional)
Bootstrap automatically generates `.env` from a blank environment with secure random credentials:
```env
# Auto-generated during bootstrap
DATABASE_URL=postgres://gbuser:RANDOM_PASS@localhost:5432/botserver
DRIVE_SERVER=http://localhost:9000
DRIVE_ACCESSKEY=GENERATED_KEY
DRIVE_SECRET=GENERATED_SECRET
```
You can also configure per-bot settings in `config.csv`:
Configure per-bot settings in `config.csv`:
```csv
name,value
@ -299,20 +288,20 @@ rm .env
## The Magic Formula
```
📚 Documents + 🔧 Tools + 🤖 LLM = Intelligent Bot
Documents + Tools + LLM = Intelligent Bot
```
### What You DON'T Need:
- IF/THEN logic
- Intent detection
- Dialog flow charts
- State machines
- Complex routing
- IF/THEN logic
- Intent detection
- Dialog flow charts
- State machines
- Complex routing
### What You DO:
- Drop documents in `.gbkb/`
- Create simple `.bas` tools (optional)
- Start chatting!
- Drop documents in `.gbkb/`
- Create simple `.bas` tools (optional)
- Start chatting!
The LLM understands context, calls tools, searches documents, and maintains conversation naturally.
@ -354,4 +343,4 @@ The LLM understands context, calls tools, searches documents, and maintains conv
Bot: [Calls enrollment.bas] Let me help you enroll...
```
**No programming logic needed - the LLM handles everything!** 🎉
**No programming logic needed - the LLM handles everything!**

View file

@ -193,22 +193,7 @@ Each bot:
- Runs independently
- Shares infrastructure
## Template Inheritance
Bots can share common resources:
```
templates/
_shared/
knowledge/ # Shared documents
tools/ # Shared functions
bot1.gbai/
bot1.gbot/
config.csv # includes: _shared
bot2.gbai/
bot2.gbot/
config.csv # includes: _shared
```
## Naming Conventions
@ -226,9 +211,7 @@ templates/
When BotServer starts:
```
<img src="../assets/chapter-02/template-deployment-flow.svg" alt="Template Deployment Flow" style="max-height: 400px; width: 100%; object-fit: contain;">
```
Takes about 5-10 seconds per bot.
@ -243,12 +226,23 @@ The web interface uses **HTMX with server-side rendering** - minimal client-side
## Package Size Limits
Default limits (configurable):
- Total package: 100MB
- Single document: 10MB
- Number of files: 1000
- Script size: 1MB
- Collection count: 50
Default limits (configurable in `config.csv`):
| Setting | Default | config.csv key |
|---------|---------|----------------|
| Total package | 100MB | `package-max-size` |
| Single document | 10MB | `user-file-limit` |
| Number of files | 1000 | `user-file-count` |
| Script size | 1MB | `script-max-size` |
| Collection count | 50 | `kb-max-collections` |
Example override in your bot's `config.csv`:
```csv
name,value
package-max-size,209715200
user-file-limit,52428800
```
## Troubleshooting
@ -270,16 +264,16 @@ Default limits (configurable):
## Best Practices
### Do's
Keep packages under 50MB
Organize knowledge by topic
Use clear folder names
Test locally first
- Keep packages under 50MB
- Organize knowledge by topic
- Use clear folder names
- Test locally first
### Don'ts
Don't nest `.gbai` folders
Don't mix test/prod in same folder
Don't hardcode absolute paths
Don't store secrets in scripts
- Don't nest `.gbai` folders
- Don't mix test/prod in same folder
- Don't hardcode absolute paths
- Don't store secrets in scripts
## Summary

View file

@ -0,0 +1,211 @@
# Admin vs User Views
The General Bots Suite separates functionality into two distinct interfaces: the **User View** for personal productivity and the **Admin View** for organization management. This separation ensures users only see features relevant to their role while administrators have access to system-wide controls.
## Overview
| View | Access | Purpose |
|------|--------|---------|
| **User View** | All authenticated users | Personal settings, files, tasks, calendar |
| **Admin View** | Users with `admin` role | Organization management, user provisioning, DNS |
## User View
The User View is the default interface for all authenticated users. It provides access to personal productivity tools and settings.
### Accessing User Settings
1. Click your **avatar** in the top-right corner
2. Select **Settings**
### User Settings Sections
**Profile**
- Display name and avatar
- Email address
- Language and timezone
**Security**
- Change password
- Two-factor authentication (2FA)
- Active sessions management
- Trusted devices
**Appearance**
- Theme selection (dark, light, blue, purple, green, orange)
- Accent color
- Font size preferences
**Notifications**
- Email notification preferences
- Desktop alerts
- Sound settings
**Storage**
- View storage quota usage
- Manage connected storage providers
- Clear cache
**Integrations**
- API keys for external access
- Webhook configurations
- Connected OAuth providers
**Privacy**
- Data visibility settings
- Online status preferences
- Data export and account deletion
### User API Endpoints
All user endpoints use the `/api/user/` prefix:
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/user/profile` | GET, PUT | User profile data |
| `/api/user/password` | POST | Change password |
| `/api/user/security/2fa/status` | GET | 2FA status |
| `/api/user/security/2fa/enable` | POST | Enable 2FA |
| `/api/user/security/sessions` | GET | Active sessions |
| `/api/user/notifications/preferences` | GET, PUT | Notification settings |
| `/api/user/storage` | GET | Storage quota |
| `/api/user/api-keys` | GET, POST, DELETE | API key management |
| `/api/user/webhooks` | GET, POST, DELETE | Webhook management |
| `/api/user/data/export` | POST | Request data export |
## Admin View
The Admin View provides organization-wide management capabilities. Access requires the `admin` role.
### Accessing Admin Panel
1. Click your **avatar** in the top-right corner
2. Select **Admin Panel**
If you don't see "Admin Panel", you don't have administrator privileges.
### Admin Panel Sections
**Dashboard**
- Quick statistics (users, groups, bots, storage)
- System health overview
- Recent activity feed
- Quick action buttons
**Users**
- View all organization users
- Create new users
- Edit user details and roles
- Disable or delete accounts
- Reset user passwords
**Groups**
- Create and manage groups
- Assign users to groups
- Set group permissions
- Manage group invitations
**Bots**
- View deployed bots
- Bot configuration management
- Usage statistics per bot
**DNS**
- Register custom hostnames
- Manage DNS records
- SSL certificate status
**Audit Log**
- View all system events
- Filter by user, action, or date
- Export audit reports
**Organization Billing** (Admin-level)
- Organization subscription status
- Usage across all users
- Payment methods for organization
- Invoice history
### Admin API Endpoints
All admin endpoints use the `/api/admin/` prefix and require `admin` role:
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/admin/dashboard` | GET | Dashboard statistics |
| `/api/admin/users` | GET, POST | List/create users |
| `/api/admin/users/:id` | GET, PUT, DELETE | Manage specific user |
| `/api/admin/groups` | GET, POST | List/create groups |
| `/api/admin/groups/:id` | GET, PUT, DELETE | Manage specific group |
| `/api/admin/bots` | GET | List organization bots |
| `/api/admin/dns` | GET, POST, DELETE | DNS management |
| `/api/admin/audit` | GET | Audit log entries |
| `/api/admin/stats/*` | GET | Various statistics |
| `/api/admin/health` | GET | System health status |
| `/api/admin/activity/recent` | GET | Recent activity feed |
## Permission Levels
The system uses role-based access control (RBAC):
| Role | User View | Admin View | Description |
|------|-----------|------------|-------------|
| `guest` | Limited | ❌ | Read-only chat access |
| `user` | ✅ | ❌ | Standard user features |
| `manager` | ✅ | Partial | Can view monitoring |
| `admin` | ✅ | ✅ | Full system access |
### Checking User Role
In BASIC scripts, check the user's role:
```basic
role = user.role
IF role = "admin" THEN
TALK "Welcome, administrator!"
ELSE
TALK "Welcome, " + user.name
END IF
```
## Desktop App Considerations
When running the Suite as a desktop application (via Tauri), additional features become available:
**Desktop-Only Features**
- Local file system access
- Rclone-based file synchronization
- System tray integration
- Native notifications
**Sync Feature**
The desktop app can sync local folders with cloud Drive using rclone:
1. Configure remote in Settings → Storage → Sync
2. Select local folder to sync
3. Start/stop sync from Drive sidebar
Note: Sync controls (`/files/sync/start`, `/files/sync/stop`) communicate with the local rclone process on the desktop. These features are not available in the web-only version.
## Security Best Practices
**For Users**
- Enable 2FA on your account
- Review active sessions regularly
- Use strong, unique passwords
- Revoke unused API keys
**For Administrators**
- Follow principle of least privilege
- Review audit logs regularly
- Rotate service account credentials
- Monitor for unusual activity
- Keep user list current (remove departed employees)
## Related Documentation
- [Permissions Matrix](../chapter-12-auth/permissions-matrix.md) - Detailed permission definitions
- [User Authentication](../chapter-12-auth/user-auth.md) - Login and session management
- [REST Endpoints](../chapter-10-rest/README.md) - Complete API reference
- [Suite User Manual](./suite-manual.md) - End-user guide

View file

@ -174,4 +174,4 @@ To add a new app to the Suite:
- [Suite Manual](../suite-manual.md) - Complete user guide
- [HTMX Architecture](../htmx-architecture.md) - Technical details
- [UI Structure](../ui-structure.md) - File organization
- [Chapter 10: REST API](../../chapter-10-api/README.md) - API reference
- [Chapter 10: REST API](../../chapter-10-rest/README.md) - API reference

View file

@ -260,4 +260,4 @@ Tasks with due dates automatically appear on your calendar. When you complete a
- [Suite Manual](../suite-manual.md) - Complete user guide
- [Tasks App](./tasks.md) - Task integration
- [Meet App](./meet.md) - Video meetings
- [Calendar API](../../chapter-10-api/calendar-api.md) - API reference
- [Calendar API](../../chapter-10-rest/calendar-api.md) - API reference

View file

@ -61,6 +61,40 @@ Drive is your personal cloud storage within General Bots Suite. Upload, organize
| Projects | 🟡 | Project-specific files |
| Custom | 🟣 | Create your own |
### File Sync (Desktop Only)
The desktop app provides bidirectional file synchronization between your local machine and cloud Drive using [rclone](https://rclone.org/).
**Requirements:**
- General Bots desktop app (Tauri)
- rclone installed on your system
**Setup:**
1. Install rclone: `https://rclone.org/install/`
2. Open Drive in the desktop app
3. Click **Settings** → **Sync**
4. Configure your sync folder (default: `~/GeneralBots`)
5. Click **Start Sync**
**Sync Controls:**
Located in the Drive sidebar under "Sync Status"
| Control | Description |
|---------|-------------|
| **Start** | Begin synchronization |
| **Stop** | Stop current sync |
| **Status** | Shows idle, syncing, or error |
**Sync Modes:**
| Mode | Description |
|------|-------------|
| **Push** | Local → Cloud only |
| **Pull** | Cloud → Local only |
| **Bisync** | Bidirectional (default) |
**Note:** Sync features are only available in the desktop app. Web users see an "unavailable" status as sync requires local filesystem access.
---
## Keyboard Shortcuts
@ -291,6 +325,7 @@ drive-quota-gb,10
## See Also
- [Suite Manual](../suite-manual.md) - Complete user guide
- [Admin vs User Views](../admin-user-views.md) - Permission levels
- [Chat App](./chat.md) - Upload files via chat
- [Player App](./player.md) - View files in Player
- [Storage API](../../chapter-10-api/storage-api.md) - API reference
- [Storage API](../../chapter-10-rest/storage-api.md) - API reference

View file

@ -309,5 +309,5 @@ email-from,Your Name <you@gmail.com>
- [Suite Manual](../suite-manual.md) - Complete user guide
- [Chat App](./chat.md) - Send quick emails via chat
- [Email API](../../chapter-10-api/email-api.md) - API reference
- [Email API](../../chapter-10-rest/email-api.md) - API reference
- [SEND MAIL Keyword](../../chapter-06-gbdialog/keyword-send-mail.md) - BASIC integration

View file

@ -313,4 +313,4 @@ Allow browser access to:
- [Suite Manual](../suite-manual.md) - Complete user guide
- [Calendar App](./calendar.md) - Schedule meetings
- [Chat App](./chat.md) - Quick calls from chat
- [Calls API](../../chapter-10-api/calls-api.md) - API reference
- [Calls API](../../chapter-10-rest/calls-api.md) - API reference

View file

@ -270,4 +270,4 @@ Player is fully responsive:
- [Drive App](./drive.md) - File management
- [Drive Integration](../../chapter-08-config/drive.md) - File storage configuration
- [Storage API](../../chapter-10-api/storage-api.md) - File management API
- [Storage API](../../chapter-10-rest/storage-api.md) - File management API

View file

@ -227,4 +227,4 @@ Tasks with due dates automatically appear in your Calendar view, helping you vis
- [Suite Manual](../suite-manual.md) - Complete user guide
- [Chat App](./chat.md) - Create tasks from chat
- [Calendar App](./calendar.md) - View tasks in calendar
- [Tasks API](../../chapter-10-api/tasks-api.md) - API reference
- [Tasks API](../../chapter-10-rest/tasks-api.md) - API reference

View file

@ -4,7 +4,7 @@ The `TABLE` keyword defines database tables directly in your `.bas` files. Table
## Syntax
```bas
```basic
TABLE TableName ON connection
FieldName dataType[(length[,precision])] [key] [references OtherTable]
...
@ -69,7 +69,7 @@ conn-maria-Driver,mariadb
### Basic Table Definition
```bas
```basic
TABLE Contacts ON maria
Id number key
Nome string(150)
@ -81,7 +81,7 @@ END TABLE
### Table with Multiple Field Types
```bas
```basic
TABLE Produtos ON maria
Id number key
Nome string(150)
@ -97,7 +97,7 @@ END TABLE
### Table with Foreign Key References
```bas
```basic
TABLE Pedidos ON maria
Id number key
Numero integer
@ -120,7 +120,7 @@ END TABLE
### Complete CRM Tables Example
```bas
```basic
' Contact management tables
TABLE Contatos ON maria
Id number key
@ -172,7 +172,7 @@ Once tables are defined, you can use standard BASIC keywords to work with the da
### Inserting Data
```bas
```basic
data = NEW OBJECT
data.Nome = "João Silva"
data.Email = "joao@example.com"
@ -182,7 +182,7 @@ INSERT "Contatos", data
### Finding Data
```bas
```basic
contacts = FIND "Contatos", "Situacao='A'"
FOR EACH contact IN contacts
TALK "Name: " + contact.Nome
@ -191,13 +191,13 @@ NEXT
### Updating Data
```bas
```basic
UPDATE "Contatos", "Id=123", "Telefone='11988888888'"
```
### Deleting Data
```bas
```basic
DELETE "Contatos", "Id=123"
```

View file

@ -230,29 +230,11 @@ llm-cache,false
episodic-memory-threshold,2
```
## Environment Variables
System-level configuration uses environment variables:
```bash
# Database
DATABASE_URL=postgres://gbuser:password@localhost:5432/botserver
# Object Storage
DRIVE_SERVER=http://localhost:9000
DRIVE_ACCESSKEY=minioadmin
DRIVE_SECRET=minioadmin
# Optional
LOG_LEVEL=debug
```
## Configuration Priority
Settings are applied in this order (later overrides earlier):
1. Default values in code
2. config.csv settings
3. Environment variables (for system settings only)
## Best Practices

View file

@ -1,4 +1,4 @@
# Chapter 09: API and Tooling
# Chapter 09: LLM Tools
Define tools that LLMs can call from your BASIC scripts.
@ -65,4 +65,4 @@ Tools compile to multiple formats:
## See Also
- [BASIC Dialogs](../chapter-06-gbdialog/README.md) - Scripting reference
- [REST API](../chapter-10-api/README.md) - HTTP endpoints
- [REST Endpoints](../chapter-10-rest/README.md) - HTTP endpoints

View file

@ -15,7 +15,7 @@ By defining PARAM declarations and a DESCRIPTION in your `.bas` file, General Bo
Every LLM-callable tool follows this structure:
```bas
```basic
PARAM parameter_name AS type LIKE "example" DESCRIPTION "What this parameter is for"
DESCRIPTION "What this tool does. Called when user wants to [action]."
@ -27,7 +27,7 @@ DESCRIPTION "What this tool does. Called when user wants to [action]."
Here's how easy it is to create a chatbot for a store:
```bas
```basic
PARAM operator AS number LIKE 12312312
DESCRIPTION "Operator code."
@ -75,7 +75,7 @@ This call acts like talking to the LLM, but it can be used for anything that Gen
Creating a REST API server for any business process is equally straightforward:
```bas
```basic
PARAM name AS string LIKE "João Silva"
DESCRIPTION "Required full name of the individual."
@ -175,7 +175,7 @@ Also generates OpenAI function calling format:
You can combine LLM tools with external API calls:
```bas
```basic
PARAM location AS string LIKE "Seattle"
DESCRIPTION "City for weather lookup"
@ -197,7 +197,7 @@ TALK weather
3. **Validation**: Add validation logic to handle edge cases:
```bas
```basic
PARAM email AS string LIKE "user@example.com"
DESCRIPTION "Email address"
@ -209,7 +209,7 @@ END IF
4. **Error Handling**: Always handle potential errors gracefully:
```bas
```basic
result = GET "https://api.example.com/data"
IF result.error THEN
TALK "Unable to fetch data. Please try again."
@ -219,7 +219,7 @@ END IF
5. **Secure Credentials**: Use BOT MEMORY for API keys:
```bas
```basic
api_key = GET BOT MEMORY "my_api_key"
```

View file

@ -76,7 +76,7 @@ In BotServer, a **tool** is simply a `.bas` file. That's it!
Create `get-weather.bas`:
```bas
```basic
' This tool gets weather information
' The LLM will call this when users ask about weather
@ -91,7 +91,7 @@ That's a tool! The LLM now knows it can call this when users ask about weather.
Create `send-email.bas`:
```bas
```basic
' Send an email to someone
PARAM to AS STRING
PARAM subject AS STRING
@ -122,7 +122,7 @@ mybot.gbai/
In your `start.bas`, explicitly add tools:
```bas
```basic
' Register tools for this conversation
USE TOOL "get-weather"
USE TOOL "send-email"
@ -135,7 +135,7 @@ TALK "Hello! I can help with weather, email, and tasks."
Let the LLM decide which tools to use naturally:
```bas
```basic
' In start.bas
' Load all available tools - LLM decides when to use them
USE TOOL "weather"
@ -218,7 +218,7 @@ You never write these formats manually - just write `.bas` files!
Here's a real tool from the codebase - `enrollment.bas`:
```bas
```basic
PARAM name AS string LIKE "Abreu Silva" DESCRIPTION "Required full name of the individual."
PARAM birthday AS date LIKE "23/09/2001" DESCRIPTION "Required birth date of the individual in DD/MM/YYYY format."
PARAM email AS string LIKE "abreu.silva@example.com" DESCRIPTION "Required email address for contact purposes."
@ -260,7 +260,7 @@ No JSON schemas, no manual registration, no complex configuration. Just write BA
The LLM reads your comments to understand the tool:
```bas
```basic
' This tool books a meeting room
' It checks availability and sends calendar invites
PARAM room_name AS STRING
@ -272,7 +272,7 @@ PARAM attendees AS ARRAY
Always validate input:
```bas
```basic
IF room_name IS NULL THEN
TALK "Please specify which room you want to book."
RETURN
@ -283,7 +283,7 @@ ENDIF
Let users know what's happening:
```bas
```basic
TALK "Checking room availability..."
available = GET "/calendar/check" WITH room_name, date
@ -320,7 +320,7 @@ This is generated automatically from your `.bas` file!
## Removing Tools
### Dynamic Tool Management
```bas
```basic
' Remove a specific tool
REMOVE TOOL "send-email"

View file

@ -1,64 +0,0 @@
# Chapter 10: REST API Reference
HTTP API endpoints for integrating with BotServer.
## Base URL
```
http://localhost:8000/api/v1
```
## Authentication
```bash
Authorization: Bearer <token>
```
## Core Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/chat` | POST | Send message, get response |
| `/sessions` | GET | List active sessions |
| `/sessions/:id` | GET | Get session details |
| `/files` | POST | Upload file |
| `/files/:id` | GET | Download file |
## Quick Example
```bash
curl -X POST http://localhost:8000/api/v1/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Hello", "session_id": "abc123"}'
```
## Response Format
```json
{
"success": true,
"data": { ... },
"error": null
}
```
## Chapter Contents
- [Files API](./files-api.md) - Upload/download
- [Document Processing](./document-processing.md) - Text extraction
- [Users API](./users-api.md) - User management
- [Groups API](./groups-api.md) - Group management
- [Conversations API](./conversations-api.md) - Chat sessions
- [Calendar API](./calendar-api.md) - Scheduling
- [Tasks API](./tasks-api.md) - Task management
- [Storage API](./storage-api.md) - Object storage
- [Analytics API](./analytics-api.md) - Metrics
- [Admin API](./admin-api.md) - Administration
- [AI API](./ai-api.md) - LLM endpoints
- [Example Integrations](./examples.md) - Code samples
## See Also
- [API and Tooling](../chapter-09-api/README.md) - Tool definitions
- [Authentication](../chapter-12-auth/README.md) - Security

View file

@ -0,0 +1,86 @@
# Chapter 10: REST Endpoints
HTTP API endpoints for integrating with BotServer.
## Overview
BotServer exposes REST endpoints organized by functional area. All endpoints follow consistent patterns for authentication, pagination, and error handling.
## Base URL
```
http://localhost:8000/api/v1
```
## Authentication
```bash
Authorization: Bearer <token>
```
## API Categories
| Category | Prefix | Description |
|----------|--------|-------------|
| **User APIs** | `/api/user/*` | Personal settings, profile, preferences |
| **Admin APIs** | `/api/admin/*` | Organization management (requires admin role) |
| **Files** | `/files/*` | Drive operations |
| **Chat** | `/chat/*` | Conversations and messages |
## User vs Admin Endpoints
The API separates user-level and admin-level operations:
**User Endpoints** (`/api/user/*`):
- Personal profile and settings
- User's own files and data
- Individual preferences
- Accessible by all authenticated users
**Admin Endpoints** (`/api/admin/*`):
- Organization-wide settings
- User management
- Group management
- DNS, billing, audit logs
- Requires `admin` role
## Quick Example
```bash
curl -X POST http://localhost:8000/api/v1/chat \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Hello", "session_id": "abc123"}'
```
## Response Format
```json
{
"success": true,
"data": { ... },
"error": null
}
```
## Chapter Contents
- [Files API](./files-api.md) - Upload/download
- [Document Processing](./document-processing.md) - Text extraction
- [Users API](./users-api.md) - User management
- [User Security API](./user-security.md) - 2FA, sessions
- [Groups API](./groups-api.md) - Group management
- [Conversations API](./conversations-api.md) - Chat sessions
- [Calendar API](./calendar-api.md) - Scheduling
- [Tasks API](./tasks-api.md) - Task management
- [Storage API](./storage-api.md) - Object storage
- [Analytics API](./analytics-api.md) - Metrics
- [Admin API](./admin-api.md) - Administration
- [AI API](./ai-api.md) - LLM endpoints
- [Example Integrations](./examples.md) - Code samples
## See Also
- [LLM Tools](../chapter-09-tools/README.md) - Tool definitions
- [Authentication](../chapter-12-auth/README.md) - Security
- [Permissions Matrix](../chapter-12-auth/permissions-matrix.md) - Access control

View file

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View file

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

View file

@ -290,5 +290,5 @@ The choice between cloud and self-hosted depends on organizational priorities. F
- [Quick Start](../chapter-01/quick-start.md) - Deploy in minutes
- [Keywords Reference](../chapter-06-gbdialog/keywords.md) - Full BASIC reference
- [REST API Reference](../chapter-10-api/README.md) - Complete API documentation
- [REST API Reference](../chapter-10-rest/README.md) - Complete API documentation
- [Migration Guide](../chapter-14-migration/README.md) - Detailed migration steps

View file

@ -171,5 +171,5 @@ For organizations that need more than a simple chatbot—those requiring custom
- [Quick Start](../chapter-01/quick-start.md) - Get running in minutes
- [Keywords Reference](../chapter-06-gbdialog/keywords.md) - Full BASIC reference
- [REST API](../chapter-10-api/README.md) - API documentation
- [REST API](../chapter-10-rest/README.md) - API documentation
- [Projects](./projects.md) - Team collaboration features

View file

@ -342,7 +342,7 @@ CREATE TASK "Design review" IN PROJECT project_id
## See Also
- [Tasks API](../chapter-10-api/tasks-api.md) - Task management endpoints
- [Conversations API](../chapter-10-api/conversations-api.md) - Chat history
- [Groups API](../chapter-10-api/groups-api.md) - User group management
- [Tasks API](../chapter-10-rest/tasks-api.md) - Task management endpoints
- [Conversations API](../chapter-10-rest/conversations-api.md) - Chat history
- [Groups API](../chapter-10-rest/groups-api.md) - User group management
- [SET CONTEXT](../chapter-06-gbdialog/keyword-set-context.md) - AI context configuration

View file

@ -66,5 +66,5 @@ auth-lockout-duration,900
## See Also
- [REST API](../chapter-10-api/README.md) - API authentication
- [REST API](../chapter-10-rest/README.md) - API authentication
- [Configuration](../chapter-08-config/README.md) - Auth settings