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:
parent
fde61592ab
commit
49eb6696ea
61 changed files with 501 additions and 275 deletions
|
|
@ -51,6 +51,7 @@
|
||||||
|
|
||||||
- [Chapter 04: .gbui Interface Reference](./chapter-04-gbui/README.md)
|
- [Chapter 04: .gbui Interface Reference](./chapter-04-gbui/README.md)
|
||||||
- [Suite User Manual](./chapter-04-gbui/suite-manual.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)
|
- [UI Structure](./chapter-04-gbui/ui-structure.md)
|
||||||
- [single.gbui - Simple Chat](./chapter-04-gbui/single-gbui.md)
|
- [single.gbui - Simple Chat](./chapter-04-gbui/single-gbui.md)
|
||||||
- [Console Mode](./chapter-04-gbui/console-mode.md)
|
- [Console Mode](./chapter-04-gbui/console-mode.md)
|
||||||
|
|
@ -240,42 +241,42 @@
|
||||||
|
|
||||||
# Part IX - Tools and Integration
|
# Part IX - Tools and Integration
|
||||||
|
|
||||||
- [Chapter 09: API and Tooling](./chapter-09-api/README.md)
|
- [Chapter 09: LLM Tools](./chapter-09-tools/README.md)
|
||||||
- [Tool Definition](./chapter-09-api/tool-definition.md)
|
- [Tool Definition](./chapter-09-tools/tool-definition.md)
|
||||||
- [PARAM Declaration](./chapter-09-api/param-declaration.md)
|
- [PARAM Declaration](./chapter-09-tools/param-declaration.md)
|
||||||
- [Tool Compilation](./chapter-09-api/compilation.md)
|
- [Tool Compilation](./chapter-09-tools/compilation.md)
|
||||||
- [MCP Format](./chapter-09-api/mcp-format.md)
|
- [MCP Format](./chapter-09-tools/mcp-format.md)
|
||||||
- [Tool Format](./chapter-09-api/openai-format.md)
|
- [Tool Format](./chapter-09-tools/openai-format.md)
|
||||||
- [GET Keyword Integration](./chapter-09-api/get-integration.md)
|
- [GET Keyword Integration](./chapter-09-tools/get-integration.md)
|
||||||
- [External APIs](./chapter-09-api/external-apis.md)
|
- [External APIs](./chapter-09-tools/external-apis.md)
|
||||||
- [LLM REST Server](./chapter-09-api/llm-rest-server.md)
|
- [LLM REST Server](./chapter-09-tools/llm-rest-server.md)
|
||||||
- [NVIDIA GPU Setup for LXC](./chapter-09-api/nvidia-gpu-setup.md)
|
- [NVIDIA GPU Setup for LXC](./chapter-09-tools/nvidia-gpu-setup.md)
|
||||||
|
|
||||||
- [Chapter 10: REST API Reference](./chapter-10-api/README.md)
|
- [Chapter 10: REST Endpoints](./chapter-10-rest/README.md)
|
||||||
- [Files API](./chapter-10-api/files-api.md)
|
- [Files API](./chapter-10-rest/files-api.md)
|
||||||
- [Document Processing API](./chapter-10-api/document-processing.md)
|
- [Document Processing API](./chapter-10-rest/document-processing.md)
|
||||||
- [Users API](./chapter-10-api/users-api.md)
|
- [Users API](./chapter-10-rest/users-api.md)
|
||||||
- [User Security API](./chapter-10-api/user-security.md)
|
- [User Security API](./chapter-10-rest/user-security.md)
|
||||||
- [Groups API](./chapter-10-api/groups-api.md)
|
- [Groups API](./chapter-10-rest/groups-api.md)
|
||||||
- [Group Membership API](./chapter-10-api/group-membership.md)
|
- [Group Membership API](./chapter-10-rest/group-membership.md)
|
||||||
- [Conversations API](./chapter-10-api/conversations-api.md)
|
- [Conversations API](./chapter-10-rest/conversations-api.md)
|
||||||
- [Calls API](./chapter-10-api/calls-api.md)
|
- [Calls API](./chapter-10-rest/calls-api.md)
|
||||||
- [Whiteboard API](./chapter-10-api/whiteboard-api.md)
|
- [Whiteboard API](./chapter-10-rest/whiteboard-api.md)
|
||||||
- [Email API](./chapter-10-api/email-api.md)
|
- [Email API](./chapter-10-rest/email-api.md)
|
||||||
- [Notifications API](./chapter-10-api/notifications-api.md)
|
- [Notifications API](./chapter-10-rest/notifications-api.md)
|
||||||
- [Calendar API](./chapter-10-api/calendar-api.md)
|
- [Calendar API](./chapter-10-rest/calendar-api.md)
|
||||||
- [Tasks API](./chapter-10-api/tasks-api.md)
|
- [Tasks API](./chapter-10-rest/tasks-api.md)
|
||||||
- [Storage API](./chapter-10-api/storage-api.md)
|
- [Storage API](./chapter-10-rest/storage-api.md)
|
||||||
- [Backup API](./chapter-10-api/backup-api.md)
|
- [Backup API](./chapter-10-rest/backup-api.md)
|
||||||
- [Analytics API](./chapter-10-api/analytics-api.md)
|
- [Analytics API](./chapter-10-rest/analytics-api.md)
|
||||||
- [Reports API](./chapter-10-api/reports-api.md)
|
- [Reports API](./chapter-10-rest/reports-api.md)
|
||||||
- [Admin API](./chapter-10-api/admin-api.md)
|
- [Admin API](./chapter-10-rest/admin-api.md)
|
||||||
- [Monitoring API](./chapter-10-api/monitoring-api.md)
|
- [Monitoring API](./chapter-10-rest/monitoring-api.md)
|
||||||
- [AI API](./chapter-10-api/ai-api.md)
|
- [AI API](./chapter-10-rest/ai-api.md)
|
||||||
- [ML API](./chapter-10-api/ml-api.md)
|
- [ML API](./chapter-10-rest/ml-api.md)
|
||||||
- [Security API](./chapter-10-api/security-api.md)
|
- [Security API](./chapter-10-rest/security-api.md)
|
||||||
- [Compliance API](./chapter-10-api/compliance-api.md)
|
- [Compliance API](./chapter-10-rest/compliance-api.md)
|
||||||
- [Example Integrations](./chapter-10-api/examples.md)
|
- [Example Integrations](./chapter-10-rest/examples.md)
|
||||||
|
|
||||||
# Part X - Feature Deep Dive
|
# Part X - Feature Deep Dive
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -437,4 +437,4 @@ llm-log-timing,true
|
||||||
|
|
||||||
- [LLM Configuration](../chapter-08-config/llm-config.md) - Detailed configuration guide
|
- [LLM Configuration](../chapter-08-config/llm-config.md) - Detailed configuration guide
|
||||||
- [Semantic Caching](../chapter-03/caching.md) - Cache configuration
|
- [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
|
||||||
|
|
@ -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>
|
<defs>
|
||||||
<marker id="arrow" markerWidth="10" markerHeight="10" refX="9" refY="3" orient="auto" markerUnits="strokeWidth">
|
<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"/>
|
<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 |
|
|
@ -10,10 +10,10 @@ Get General Bots running and have your first conversation.
|
||||||
|
|
||||||
By the end of this chapter, you will:
|
By the end of this chapter, you will:
|
||||||
|
|
||||||
- ✅ Have General Bots running on your machine
|
- Have General Bots running on your machine
|
||||||
- ✅ Understand what happens during bootstrap
|
- Understand what happens during bootstrap
|
||||||
- ✅ Complete your first conversation with a bot
|
- Complete your first conversation with a bot
|
||||||
- ✅ Know how sessions and channels work
|
- Know how sessions and channels work
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -68,10 +68,10 @@ Everything installs automatically on first run—PostgreSQL, storage, cache, and
|
||||||
</div>
|
</div>
|
||||||
<div class="wa-message bot">
|
<div class="wa-message bot">
|
||||||
<div class="wa-bubble">
|
<div class="wa-bubble">
|
||||||
<p>📦 PostgreSQL (database)</p>
|
<p>PostgreSQL (database)</p>
|
||||||
<p>📦 MinIO (file storage)</p>
|
<p>MinIO (file storage)</p>
|
||||||
<p>📦 Cache (Redis-compatible)</p>
|
<p>Cache (Redis-compatible)</p>
|
||||||
<p>📦 Default bot templates</p>
|
<p>Default bot templates</p>
|
||||||
<p>All in <code>botserver-stack/</code> — no system-wide installation!</p>
|
<p>All in <code>botserver-stack/</code> — no system-wide installation!</p>
|
||||||
<div class="wa-time">09:01</div>
|
<div class="wa-time">09:01</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ The bot automatically indexes all documents, creates vector embeddings, searches
|
||||||
|
|
||||||
Create `enrollment.bas`:
|
Create `enrollment.bas`:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM name AS string LIKE "John Smith" DESCRIPTION "Student full name"
|
PARAM name AS string LIKE "John Smith" DESCRIPTION "Student full name"
|
||||||
PARAM email AS string LIKE "john@example.com" DESCRIPTION "Contact email"
|
PARAM email AS string LIKE "john@example.com" DESCRIPTION "Contact email"
|
||||||
PARAM course AS string LIKE "Computer Science" DESCRIPTION "Course to enroll in"
|
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`:
|
Example tool in `mybot.gbdialog/my-tool.bas`:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM user_name AS string
|
PARAM user_name AS string
|
||||||
PARAM request 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):
|
Traditional approach (don't do this):
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Complex multi-step dialog
|
' Complex multi-step dialog
|
||||||
IF intent = "enrollment" THEN
|
IF intent = "enrollment" THEN
|
||||||
TALK "Let me help you enroll. What's your name?"
|
TALK "Let me help you enroll. What's your name?"
|
||||||
|
|
@ -142,7 +142,7 @@ ENDIF
|
||||||
|
|
||||||
BotServer approach (just create the tool):
|
BotServer approach (just create the tool):
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' In enrollment.bas - becomes a tool automatically
|
' In enrollment.bas - becomes a tool automatically
|
||||||
PARAM name AS string
|
PARAM name AS string
|
||||||
PARAM email AS string
|
PARAM email AS string
|
||||||
|
|
|
||||||
|
|
@ -28,24 +28,16 @@ The bootstrap process automatically:
|
||||||
|
|
||||||
**First run takes 2-5 minutes.**
|
**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
|
```csv
|
||||||
DATABASE_URL=postgres://gbuser:RANDOM@localhost:5432/botserver
|
name,value
|
||||||
DRIVE_SERVER=http://localhost:9000
|
database-url,postgres://myuser:mypass@myhost:5432/mydb
|
||||||
DRIVE_ACCESSKEY=GENERATED_KEY
|
drive-server,http://my-drive:9000
|
||||||
DRIVE_SECRET=GENERATED_SECRET
|
drive-accesskey,my-access-key
|
||||||
```
|
drive-secret,my-secret-key
|
||||||
|
|
||||||
### 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
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Default Ports
|
## Default Ports
|
||||||
|
|
|
||||||
|
|
@ -15,21 +15,20 @@ That's it! No configuration needed.
|
||||||
You'll see:
|
You'll see:
|
||||||
|
|
||||||
```
|
```
|
||||||
🚀 BotServer starting...
|
BotServer starting...
|
||||||
📦 Bootstrap: Detecting system...
|
Bootstrap: Detecting system...
|
||||||
📦 Installing PostgreSQL...
|
Installing PostgreSQL...
|
||||||
✓ Database created
|
Database created
|
||||||
✓ Schema initialized
|
Schema initialized
|
||||||
✓ Credentials saved to .env
|
Installing Drive...
|
||||||
📦 Installing Drive...
|
Object storage ready
|
||||||
✓ Object storage ready
|
Buckets created
|
||||||
✓ Buckets created
|
Installing Cache...
|
||||||
📦 Installing Cache...
|
Cache server running
|
||||||
✓ Cache server running
|
Creating bots from templates...
|
||||||
🤖 Creating bots from templates...
|
default.gbai deployed
|
||||||
✓ default.gbai → Default bot
|
announcements.gbai deployed
|
||||||
✓ announcements.gbai → Announcements bot
|
BotServer ready at http://localhost:8080
|
||||||
✅ BotServer ready at http://localhost:8080
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Open Browser
|
### 3. Open Browser
|
||||||
|
|
@ -50,27 +49,27 @@ Start chatting with your bot!
|
||||||
|
|
||||||
The **automatic bootstrap** process:
|
The **automatic bootstrap** process:
|
||||||
|
|
||||||
1. ✅ Detected your OS (Linux/macOS/Windows)
|
1. Detected your OS (Linux/macOS/Windows)
|
||||||
2. ✅ Downloaded PostgreSQL database to botserver-stack/
|
2. Downloaded PostgreSQL database to botserver-stack/
|
||||||
3. ✅ Downloaded drive (S3-compatible storage) to botserver-stack/
|
3. Downloaded drive (S3-compatible storage) to botserver-stack/
|
||||||
4. ✅ Downloaded cache component to botserver-stack/
|
4. Downloaded cache component to botserver-stack/
|
||||||
5. ✅ Generated secure credentials → `.env` (from blank environment)
|
5. Generated secure credentials
|
||||||
6. ✅ Created database schema
|
6. Created database schema
|
||||||
7. ✅ Deployed default bots to object storage
|
7. Deployed default bots to object storage
|
||||||
8. ✅ Started UI server on port 8080
|
8. Started UI server on port 8080
|
||||||
|
|
||||||
**Zero manual configuration required!**
|
**Zero manual configuration required!**
|
||||||
|
|
||||||
### Using Existing Services
|
### 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
|
```csv
|
||||||
# Point to your existing services
|
name,value
|
||||||
DATABASE_URL=postgres://myuser:mypass@myhost:5432/mydb
|
database-url,postgres://myuser:mypass@myhost:5432/mydb
|
||||||
DRIVE_SERVER=http://my-drive:9000
|
drive-server,http://my-drive:9000
|
||||||
DRIVE_ACCESSKEY=my-access-key
|
drive-accesskey,my-access-key
|
||||||
DRIVE_SECRET=my-secret-key
|
drive-secret,my-secret-key
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -83,7 +82,7 @@ DRIVE_SECRET=my-secret-key
|
||||||
|
|
||||||
Tools are just `.bas` files. Create `enrollment.bas`:
|
Tools are just `.bas` files. Create `enrollment.bas`:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Student enrollment tool
|
' Student enrollment tool
|
||||||
PARAM name, email, course
|
PARAM name, email, course
|
||||||
DESCRIPTION "Processes student enrollment"
|
DESCRIPTION "Processes student enrollment"
|
||||||
|
|
@ -133,10 +132,10 @@ lxc-attach -n botserver
|
||||||
```
|
```
|
||||||
|
|
||||||
**Benefits**:
|
**Benefits**:
|
||||||
- ✅ Process isolation
|
- Process isolation
|
||||||
- ✅ Resource control
|
- Resource control
|
||||||
- ✅ Easy management
|
- Easy management
|
||||||
- ✅ Lightweight virtualization
|
- Lightweight virtualization
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -212,7 +211,7 @@ mybot.gbkb/
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Create Tools (Optional)
|
### 2. Create Tools (Optional)
|
||||||
```bas
|
```basic
|
||||||
' enrollment.bas - just define what it does
|
' enrollment.bas - just define what it does
|
||||||
PARAM name AS string
|
PARAM name AS string
|
||||||
PARAM course AS string
|
PARAM course AS string
|
||||||
|
|
@ -234,17 +233,7 @@ The LLM handles ALL conversation logic automatically!
|
||||||
|
|
||||||
## Configuration (Optional)
|
## Configuration (Optional)
|
||||||
|
|
||||||
Bootstrap automatically generates `.env` from a blank environment with secure random credentials:
|
Configure per-bot settings in `config.csv`:
|
||||||
|
|
||||||
```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`:
|
|
||||||
|
|
||||||
```csv
|
```csv
|
||||||
name,value
|
name,value
|
||||||
|
|
@ -299,20 +288,20 @@ rm .env
|
||||||
## The Magic Formula
|
## The Magic Formula
|
||||||
|
|
||||||
```
|
```
|
||||||
📚 Documents + 🔧 Tools + 🤖 LLM = ✨ Intelligent Bot
|
Documents + Tools + LLM = Intelligent Bot
|
||||||
```
|
```
|
||||||
|
|
||||||
### What You DON'T Need:
|
### What You DON'T Need:
|
||||||
- ❌ IF/THEN logic
|
- IF/THEN logic
|
||||||
- ❌ Intent detection
|
- Intent detection
|
||||||
- ❌ Dialog flow charts
|
- Dialog flow charts
|
||||||
- ❌ State machines
|
- State machines
|
||||||
- ❌ Complex routing
|
- Complex routing
|
||||||
|
|
||||||
### What You DO:
|
### What You DO:
|
||||||
- ✅ Drop documents in `.gbkb/`
|
- Drop documents in `.gbkb/`
|
||||||
- ✅ Create simple `.bas` tools (optional)
|
- Create simple `.bas` tools (optional)
|
||||||
- ✅ Start chatting!
|
- Start chatting!
|
||||||
|
|
||||||
The LLM understands context, calls tools, searches documents, and maintains conversation naturally.
|
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...
|
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!**
|
||||||
|
|
@ -193,22 +193,7 @@ Each bot:
|
||||||
- Runs independently
|
- Runs independently
|
||||||
- Shares infrastructure
|
- 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
|
## Naming Conventions
|
||||||
|
|
||||||
|
|
@ -226,9 +211,7 @@ templates/
|
||||||
|
|
||||||
When BotServer starts:
|
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;">
|
<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.
|
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
|
## Package Size Limits
|
||||||
|
|
||||||
Default limits (configurable):
|
Default limits (configurable in `config.csv`):
|
||||||
- Total package: 100MB
|
|
||||||
- Single document: 10MB
|
| Setting | Default | config.csv key |
|
||||||
- Number of files: 1000
|
|---------|---------|----------------|
|
||||||
- Script size: 1MB
|
| Total package | 100MB | `package-max-size` |
|
||||||
- Collection count: 50
|
| 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
|
## Troubleshooting
|
||||||
|
|
||||||
|
|
@ -270,16 +264,16 @@ Default limits (configurable):
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
### Do's
|
### Do's
|
||||||
✅ Keep packages under 50MB
|
- Keep packages under 50MB
|
||||||
✅ Organize knowledge by topic
|
- Organize knowledge by topic
|
||||||
✅ Use clear folder names
|
- Use clear folder names
|
||||||
✅ Test locally first
|
- Test locally first
|
||||||
|
|
||||||
### Don'ts
|
### Don'ts
|
||||||
❌ Don't nest `.gbai` folders
|
- Don't nest `.gbai` folders
|
||||||
❌ Don't mix test/prod in same folder
|
- Don't mix test/prod in same folder
|
||||||
❌ Don't hardcode absolute paths
|
- Don't hardcode absolute paths
|
||||||
❌ Don't store secrets in scripts
|
- Don't store secrets in scripts
|
||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
|
|
|
||||||
211
src/chapter-04-gbui/admin-user-views.md
Normal file
211
src/chapter-04-gbui/admin-user-views.md
Normal 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
|
||||||
|
|
@ -174,4 +174,4 @@ To add a new app to the Suite:
|
||||||
- [Suite Manual](../suite-manual.md) - Complete user guide
|
- [Suite Manual](../suite-manual.md) - Complete user guide
|
||||||
- [HTMX Architecture](../htmx-architecture.md) - Technical details
|
- [HTMX Architecture](../htmx-architecture.md) - Technical details
|
||||||
- [UI Structure](../ui-structure.md) - File organization
|
- [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
|
||||||
|
|
@ -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
|
- [Suite Manual](../suite-manual.md) - Complete user guide
|
||||||
- [Tasks App](./tasks.md) - Task integration
|
- [Tasks App](./tasks.md) - Task integration
|
||||||
- [Meet App](./meet.md) - Video meetings
|
- [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
|
||||||
|
|
@ -61,6 +61,40 @@ Drive is your personal cloud storage within General Bots Suite. Upload, organize
|
||||||
| Projects | 🟡 | Project-specific files |
|
| Projects | 🟡 | Project-specific files |
|
||||||
| Custom | 🟣 | Create your own |
|
| 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
|
## Keyboard Shortcuts
|
||||||
|
|
@ -291,6 +325,7 @@ drive-quota-gb,10
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
- [Suite Manual](../suite-manual.md) - Complete user guide
|
- [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
|
- [Chat App](./chat.md) - Upload files via chat
|
||||||
- [Player App](./player.md) - View files in Player
|
- [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
|
||||||
|
|
@ -309,5 +309,5 @@ email-from,Your Name <you@gmail.com>
|
||||||
|
|
||||||
- [Suite Manual](../suite-manual.md) - Complete user guide
|
- [Suite Manual](../suite-manual.md) - Complete user guide
|
||||||
- [Chat App](./chat.md) - Send quick emails via chat
|
- [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
|
- [SEND MAIL Keyword](../../chapter-06-gbdialog/keyword-send-mail.md) - BASIC integration
|
||||||
|
|
@ -313,4 +313,4 @@ Allow browser access to:
|
||||||
- [Suite Manual](../suite-manual.md) - Complete user guide
|
- [Suite Manual](../suite-manual.md) - Complete user guide
|
||||||
- [Calendar App](./calendar.md) - Schedule meetings
|
- [Calendar App](./calendar.md) - Schedule meetings
|
||||||
- [Chat App](./chat.md) - Quick calls from chat
|
- [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
|
||||||
|
|
@ -270,4 +270,4 @@ Player is fully responsive:
|
||||||
|
|
||||||
- [Drive App](./drive.md) - File management
|
- [Drive App](./drive.md) - File management
|
||||||
- [Drive Integration](../../chapter-08-config/drive.md) - File storage configuration
|
- [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
|
||||||
|
|
@ -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
|
- [Suite Manual](../suite-manual.md) - Complete user guide
|
||||||
- [Chat App](./chat.md) - Create tasks from chat
|
- [Chat App](./chat.md) - Create tasks from chat
|
||||||
- [Calendar App](./calendar.md) - View tasks in calendar
|
- [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
|
||||||
|
|
@ -4,7 +4,7 @@ The `TABLE` keyword defines database tables directly in your `.bas` files. Table
|
||||||
|
|
||||||
## Syntax
|
## Syntax
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
TABLE TableName ON connection
|
TABLE TableName ON connection
|
||||||
FieldName dataType[(length[,precision])] [key] [references OtherTable]
|
FieldName dataType[(length[,precision])] [key] [references OtherTable]
|
||||||
...
|
...
|
||||||
|
|
@ -69,7 +69,7 @@ conn-maria-Driver,mariadb
|
||||||
|
|
||||||
### Basic Table Definition
|
### Basic Table Definition
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
TABLE Contacts ON maria
|
TABLE Contacts ON maria
|
||||||
Id number key
|
Id number key
|
||||||
Nome string(150)
|
Nome string(150)
|
||||||
|
|
@ -81,7 +81,7 @@ END TABLE
|
||||||
|
|
||||||
### Table with Multiple Field Types
|
### Table with Multiple Field Types
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
TABLE Produtos ON maria
|
TABLE Produtos ON maria
|
||||||
Id number key
|
Id number key
|
||||||
Nome string(150)
|
Nome string(150)
|
||||||
|
|
@ -97,7 +97,7 @@ END TABLE
|
||||||
|
|
||||||
### Table with Foreign Key References
|
### Table with Foreign Key References
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
TABLE Pedidos ON maria
|
TABLE Pedidos ON maria
|
||||||
Id number key
|
Id number key
|
||||||
Numero integer
|
Numero integer
|
||||||
|
|
@ -120,7 +120,7 @@ END TABLE
|
||||||
|
|
||||||
### Complete CRM Tables Example
|
### Complete CRM Tables Example
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Contact management tables
|
' Contact management tables
|
||||||
TABLE Contatos ON maria
|
TABLE Contatos ON maria
|
||||||
Id number key
|
Id number key
|
||||||
|
|
@ -172,7 +172,7 @@ Once tables are defined, you can use standard BASIC keywords to work with the da
|
||||||
|
|
||||||
### Inserting Data
|
### Inserting Data
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
data = NEW OBJECT
|
data = NEW OBJECT
|
||||||
data.Nome = "João Silva"
|
data.Nome = "João Silva"
|
||||||
data.Email = "joao@example.com"
|
data.Email = "joao@example.com"
|
||||||
|
|
@ -182,7 +182,7 @@ INSERT "Contatos", data
|
||||||
|
|
||||||
### Finding Data
|
### Finding Data
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
contacts = FIND "Contatos", "Situacao='A'"
|
contacts = FIND "Contatos", "Situacao='A'"
|
||||||
FOR EACH contact IN contacts
|
FOR EACH contact IN contacts
|
||||||
TALK "Name: " + contact.Nome
|
TALK "Name: " + contact.Nome
|
||||||
|
|
@ -191,13 +191,13 @@ NEXT
|
||||||
|
|
||||||
### Updating Data
|
### Updating Data
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
UPDATE "Contatos", "Id=123", "Telefone='11988888888'"
|
UPDATE "Contatos", "Id=123", "Telefone='11988888888'"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Deleting Data
|
### Deleting Data
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
DELETE "Contatos", "Id=123"
|
DELETE "Contatos", "Id=123"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -230,29 +230,11 @@ llm-cache,false
|
||||||
episodic-memory-threshold,2
|
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
|
## Configuration Priority
|
||||||
|
|
||||||
Settings are applied in this order (later overrides earlier):
|
Settings are applied in this order (later overrides earlier):
|
||||||
1. Default values in code
|
1. Default values in code
|
||||||
2. config.csv settings
|
2. config.csv settings
|
||||||
3. Environment variables (for system settings only)
|
|
||||||
|
|
||||||
## Best Practices
|
## Best Practices
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
# Chapter 09: API and Tooling
|
# Chapter 09: LLM Tools
|
||||||
|
|
||||||
Define tools that LLMs can call from your BASIC scripts.
|
Define tools that LLMs can call from your BASIC scripts.
|
||||||
|
|
||||||
|
|
@ -65,4 +65,4 @@ Tools compile to multiple formats:
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
- [BASIC Dialogs](../chapter-06-gbdialog/README.md) - Scripting reference
|
- [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
|
||||||
|
|
@ -15,7 +15,7 @@ By defining PARAM declarations and a DESCRIPTION in your `.bas` file, General Bo
|
||||||
|
|
||||||
Every LLM-callable tool follows this structure:
|
Every LLM-callable tool follows this structure:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM parameter_name AS type LIKE "example" DESCRIPTION "What this parameter is for"
|
PARAM parameter_name AS type LIKE "example" DESCRIPTION "What this parameter is for"
|
||||||
|
|
||||||
DESCRIPTION "What this tool does. Called when user wants to [action]."
|
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:
|
Here's how easy it is to create a chatbot for a store:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM operator AS number LIKE 12312312
|
PARAM operator AS number LIKE 12312312
|
||||||
DESCRIPTION "Operator code."
|
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:
|
Creating a REST API server for any business process is equally straightforward:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM name AS string LIKE "João Silva"
|
PARAM name AS string LIKE "João Silva"
|
||||||
DESCRIPTION "Required full name of the individual."
|
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:
|
You can combine LLM tools with external API calls:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM location AS string LIKE "Seattle"
|
PARAM location AS string LIKE "Seattle"
|
||||||
DESCRIPTION "City for weather lookup"
|
DESCRIPTION "City for weather lookup"
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ TALK weather
|
||||||
|
|
||||||
3. **Validation**: Add validation logic to handle edge cases:
|
3. **Validation**: Add validation logic to handle edge cases:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
PARAM email AS string LIKE "user@example.com"
|
PARAM email AS string LIKE "user@example.com"
|
||||||
DESCRIPTION "Email address"
|
DESCRIPTION "Email address"
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ END IF
|
||||||
|
|
||||||
4. **Error Handling**: Always handle potential errors gracefully:
|
4. **Error Handling**: Always handle potential errors gracefully:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
result = GET "https://api.example.com/data"
|
result = GET "https://api.example.com/data"
|
||||||
IF result.error THEN
|
IF result.error THEN
|
||||||
TALK "Unable to fetch data. Please try again."
|
TALK "Unable to fetch data. Please try again."
|
||||||
|
|
@ -219,7 +219,7 @@ END IF
|
||||||
|
|
||||||
5. **Secure Credentials**: Use BOT MEMORY for API keys:
|
5. **Secure Credentials**: Use BOT MEMORY for API keys:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
api_key = GET BOT MEMORY "my_api_key"
|
api_key = GET BOT MEMORY "my_api_key"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ In BotServer, a **tool** is simply a `.bas` file. That's it!
|
||||||
|
|
||||||
Create `get-weather.bas`:
|
Create `get-weather.bas`:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' This tool gets weather information
|
' This tool gets weather information
|
||||||
' The LLM will call this when users ask about weather
|
' 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`:
|
Create `send-email.bas`:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Send an email to someone
|
' Send an email to someone
|
||||||
PARAM to AS STRING
|
PARAM to AS STRING
|
||||||
PARAM subject AS STRING
|
PARAM subject AS STRING
|
||||||
|
|
@ -122,7 +122,7 @@ mybot.gbai/
|
||||||
|
|
||||||
In your `start.bas`, explicitly add tools:
|
In your `start.bas`, explicitly add tools:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Register tools for this conversation
|
' Register tools for this conversation
|
||||||
USE TOOL "get-weather"
|
USE TOOL "get-weather"
|
||||||
USE TOOL "send-email"
|
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:
|
Let the LLM decide which tools to use naturally:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' In start.bas
|
' In start.bas
|
||||||
' Load all available tools - LLM decides when to use them
|
' Load all available tools - LLM decides when to use them
|
||||||
USE TOOL "weather"
|
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`:
|
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 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 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."
|
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:
|
The LLM reads your comments to understand the tool:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' This tool books a meeting room
|
' This tool books a meeting room
|
||||||
' It checks availability and sends calendar invites
|
' It checks availability and sends calendar invites
|
||||||
PARAM room_name AS STRING
|
PARAM room_name AS STRING
|
||||||
|
|
@ -272,7 +272,7 @@ PARAM attendees AS ARRAY
|
||||||
|
|
||||||
Always validate input:
|
Always validate input:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
IF room_name IS NULL THEN
|
IF room_name IS NULL THEN
|
||||||
TALK "Please specify which room you want to book."
|
TALK "Please specify which room you want to book."
|
||||||
RETURN
|
RETURN
|
||||||
|
|
@ -283,7 +283,7 @@ ENDIF
|
||||||
|
|
||||||
Let users know what's happening:
|
Let users know what's happening:
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
TALK "Checking room availability..."
|
TALK "Checking room availability..."
|
||||||
available = GET "/calendar/check" WITH room_name, date
|
available = GET "/calendar/check" WITH room_name, date
|
||||||
|
|
||||||
|
|
@ -320,7 +320,7 @@ This is generated automatically from your `.bas` file!
|
||||||
## Removing Tools
|
## Removing Tools
|
||||||
### Dynamic Tool Management
|
### Dynamic Tool Management
|
||||||
|
|
||||||
```bas
|
```basic
|
||||||
' Remove a specific tool
|
' Remove a specific tool
|
||||||
REMOVE TOOL "send-email"
|
REMOVE TOOL "send-email"
|
||||||
|
|
||||||
|
|
@ -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
|
|
||||||
86
src/chapter-10-rest/README.md
Normal file
86
src/chapter-10-rest/README.md
Normal 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
|
||||||
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
|
|
@ -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
|
- [Quick Start](../chapter-01/quick-start.md) - Deploy in minutes
|
||||||
- [Keywords Reference](../chapter-06-gbdialog/keywords.md) - Full BASIC reference
|
- [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
|
- [Migration Guide](../chapter-14-migration/README.md) - Detailed migration steps
|
||||||
|
|
@ -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
|
- [Quick Start](../chapter-01/quick-start.md) - Get running in minutes
|
||||||
- [Keywords Reference](../chapter-06-gbdialog/keywords.md) - Full BASIC reference
|
- [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
|
- [Projects](./projects.md) - Team collaboration features
|
||||||
|
|
@ -342,7 +342,7 @@ CREATE TASK "Design review" IN PROJECT project_id
|
||||||
|
|
||||||
## See Also
|
## See Also
|
||||||
|
|
||||||
- [Tasks API](../chapter-10-api/tasks-api.md) - Task management endpoints
|
- [Tasks API](../chapter-10-rest/tasks-api.md) - Task management endpoints
|
||||||
- [Conversations API](../chapter-10-api/conversations-api.md) - Chat history
|
- [Conversations API](../chapter-10-rest/conversations-api.md) - Chat history
|
||||||
- [Groups API](../chapter-10-api/groups-api.md) - User group management
|
- [Groups API](../chapter-10-rest/groups-api.md) - User group management
|
||||||
- [SET CONTEXT](../chapter-06-gbdialog/keyword-set-context.md) - AI context configuration
|
- [SET CONTEXT](../chapter-06-gbdialog/keyword-set-context.md) - AI context configuration
|
||||||
|
|
@ -66,5 +66,5 @@ auth-lockout-duration,900
|
||||||
|
|
||||||
## See Also
|
## 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
|
- [Configuration](../chapter-08-config/README.md) - Auth settings
|
||||||
Loading…
Add table
Reference in a new issue