- From 4 to 7.

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2025-11-23 20:12:09 -03:00
parent e06cd4d646
commit fd97028995
268 changed files with 18923 additions and 17392 deletions

View file

@ -38,11 +38,11 @@ repository = "https://github.com/GeneralBots/BotServer"
[features]
# ===== DEFAULT FEATURE SET =====
default = ["web-server", "chat", "automation", "tasks", "drive", "llm", "redis-cache", "progress-bars", "directory"]
default = ["ui-server", "chat", "automation", "tasks", "drive", "llm", "redis-cache", "progress-bars", "directory"]
# ===== UI FEATURES =====
desktop = ["dep:tauri", "dep:tauri-plugin-dialog", "dep:tauri-plugin-opener", "web-server"]
web-server = []
desktop = ["dep:tauri", "dep:tauri-plugin-dialog", "dep:tauri-plugin-opener", "ui-server"]
ui-server = []
console = ["dep:crossterm", "dep:ratatui"]
# ===== CORE INTEGRATIONS =====
@ -79,7 +79,7 @@ progress-bars = ["dep:indicatif"]
# ===== META FEATURES (BUNDLES) =====
full = [
"web-server", "desktop", "console",
"ui-server", "desktop", "console",
"vectordb", "llm", "nvidia",
"email", "whatsapp", "instagram", "msteams",
"chat", "drive", "tasks", "calendar", "meet", "mail",
@ -90,8 +90,8 @@ full = [
communications = ["email", "whatsapp", "instagram", "msteams", "chat", "redis-cache"]
productivity = ["chat", "drive", "tasks", "calendar", "meet", "mail", "redis-cache"]
enterprise = ["compliance", "attendance", "directory", "llm", "vectordb", "monitoring"]
minimal = ["web-server", "chat"]
lightweight = ["web-server", "chat", "drive", "tasks"]
minimal = ["ui-server", "chat"]
lightweight = ["ui-server", "chat", "drive", "tasks"]
[dependencies]
# === CORE RUNTIME (Always Required) ===

View file

@ -54,10 +54,10 @@ General Bots is a **self-hosted AI automation platform** that provides:
General Bots provides a minimal, focused system for managing Knowledge Bases and Tools:
```basic
USE_KB "kb-name" # Load knowledge base into vector database
CLEAR_KB "kb-name" # Remove KB from session
USE_TOOL "tool-name" # Make tool available to LLM
CLEAR_TOOLS # Remove all tools from session
USE KB "kb-name" # Load knowledge base into vector database
CLEAR KB "kb-name" # Remove KB from session
USE TOOL "tool-name" # Make tool available to LLM
CLEAR TOOLS # Remove all tools from session
```
### Strategic Advantages

View file

@ -0,0 +1,544 @@
# Blog to Documentation Integration Plan
## Overview
This document maps blog posts to relevant documentation chapters and provides enhanced introductions for main documentation articles to improve educational value.
## Blog Post to Documentation Mapping
### Chapter 1: Run and Talk (Installation & Quick Start)
**Related Blog Posts:**
- "Escape from Bigtech" - Alternative to proprietary solutions
- "Why Pragmatismo Selected Open Source" - Philosophy behind the platform
- "Cost-Effective Bot Orchestration" - Economic benefits of self-hosting
**Enhanced Introduction:**
```markdown
# Chapter 01: Run and Talk
Welcome to General Bots - your journey to AI independence starts here. In a world dominated by expensive, proprietary AI solutions, General Bots offers a refreshing alternative: a complete, open-source AI platform that you control entirely.
## Why General Bots?
Before diving into installation, let's understand what makes General Bots different:
1. **Complete Ownership**: Unlike SaaS solutions that lock your data in the cloud, General Bots runs on your infrastructure. Your conversations, your data, your rules.
2. **Zero-to-AI in Minutes**: Our bootstrap process sets up everything - database, storage, vector search, and AI models - with a single command. No DevOps expertise required.
3. **Cost-Effective**: As explained in our post ["Cost-Effective Bot Orchestration"](/blog/cost-effective-bot-orchestration), running your own AI infrastructure can be 10x cheaper than cloud services at scale.
4. **Privacy First**: Your data never leaves your servers. Perfect for healthcare, finance, or any privacy-conscious application.
## What You'll Learn
This chapter guides you through:
- Installing General Bots with one command
- Understanding the bootstrap process
- Having your first AI conversation
- Exploring the self-contained architecture
## Further Reading
- [Why We Chose Open Source](/blog/why-pragmatismo-selected-open-source)
- [Escape from BigTech](/blog/escape-from-bigtech)
- [The Hidden Costs of SaaS](/blog/saas-hidden-costs)
```
### Chapter 2: About Packages
**Related Blog Posts:**
- "Ready-to-Use AI Templates" - Pre-built solutions
- "Digital Twins" - Advanced bot personalities
- "No Forms" - Conversational UI philosophy
**Enhanced Introduction:**
```markdown
# Chapter 02: About Packages
General Bots revolutionizes AI development through its unique package system. Instead of complex programming, you work with templates - simple, powerful building blocks that anyone can understand and modify.
## The Template Revolution
Traditional AI development requires teams of engineers. General Bots changes this paradigm. As discussed in ["BASIC for Everyone"](/blog/basic-for-everyone), we believe AI should be accessible to domain experts, not just programmers.
## Package Types at a Glance
1. **.gbai** - Complete bot personalities ([Digital Twins](/blog/digital-twins))
2. **.gbdialog** - Conversation flows in simple BASIC
3. **.gbkb** - Knowledge bases that give your bot expertise
4. **.gbot** - Configuration without code
5. **.gbtheme** - Visual customization
6. **.gbui** - Interface templates ([No Forms philosophy](/blog/no-forms))
## Why Templates Matter
Templates democratize AI development:
- **Business analysts** can create conversation flows
- **Subject matter experts** can build knowledge bases
- **Designers** can customize interfaces
- **No coding required** for most tasks
## Success Stories
See how organizations use templates:
- Customer service automation ([Ready-to-Use Templates](/blog/general-bots-ai-templates))
- Personal productivity bots ([Digital Twins](/blog/digital-twins))
- Enterprise workflows without forms ([No Forms](/blog/no-forms))
## Next Steps
- Explore each package type in detail
- Download pre-built templates
- Create your first custom package
```
### Chapter 3: Knowledge Base (gbkb)
**Related Blog Posts:**
- "LLM Myths in 2025" - Understanding AI limitations
- "Illusion of Intelligence" - How knowledge bases create real value
- "What is LLM?" - Foundation concepts
**Enhanced Introduction:**
```markdown
# Chapter 03: gbkb Knowledge Base Reference
Knowledge is power, and in AI, structured knowledge is everything. The .gbkb system transforms your documents, websites, and data into queryable intelligence that enhances your bot beyond generic LLM responses.
## Beyond Generic AI
As we explore in ["LLM Myths in 2025"](/blog/llm-myths-2025), large language models have limitations. They can't know your specific business rules, your product documentation, or your internal procedures. That's where .gbkb comes in.
## The Knowledge Advantage
Generic LLMs give generic answers. Knowledge bases provide:
- **Accuracy**: Responses based on your actual documentation
- **Consistency**: Same answer every time for critical information
- **Control**: You decide what information is available
- **Updates**: Change knowledge without retraining models
## Understanding the Technology
Before diving deep, understand the foundations:
- [What is LLM?](/blog/what-is-llm) - Core concepts
- [The Illusion of Intelligence](/blog/illusion-of-intelligence) - Why context matters
- [Beyond Chatbots](/blog/beyond-chatbots) - Real business applications
## Real-World Applications
Knowledge bases power:
- Customer support with product documentation
- HR bots with company policies
- Legal assistants with case law
- Medical bots with treatment protocols
## What You'll Master
This chapter teaches you to:
- Build knowledge bases from documents
- Index websites automatically
- Implement semantic search
- Optimize retrieval accuracy
- Manage knowledge updates
## Performance Tips
- Structure documents for optimal chunking
- Use metadata for better filtering
- Implement feedback loops for improvement
```
### Chapter 4: User Interface (.gbui)
**Related Blog Posts:**
- "No Forms" - Conversational UI philosophy
- "Deswindonization" - Breaking free from proprietary UIs
- "Beyond Chatbots" - Rich interaction patterns
**Enhanced Introduction:**
```markdown
# Chapter 04: .gbui User Interface Reference
The future of user interfaces isn't more forms and buttons - it's conversation. The .gbui system lets you create rich, responsive interfaces that adapt to how humans actually communicate.
## The End of Forms
Traditional software forces users into rigid forms. As explored in ["No Forms"](/blog/no-forms), conversational interfaces are more natural, more flexible, and more powerful. Users describe what they need in their own words, and the system understands.
## Breaking Free from Constraints
["Deswindonization"](/blog/deswindonization) isn't just about operating systems - it's about breaking free from rigid UI paradigms. With .gbui templates, you can:
- Create interfaces that work everywhere
- Build once, deploy to web, mobile, and desktop
- Customize without vendor lock-in
## Beyond Simple Chat
While chatbots are the foundation, modern AI interfaces need more. ["Beyond Chatbots"](/blog/beyond-chatbots) shows how .gbui enables:
- Rich media interactions
- Multi-modal inputs (voice, images, files)
- Contextual suggestions
- Workflow integration
- Real-time collaboration
## Template Philosophy
.gbui templates are:
- **HTML-based**: Use web standards, not proprietary formats
- **Responsive**: Adapt to any screen size automatically
- **Accessible**: Built-in ARIA support and keyboard navigation
- **Themeable**: Complete separation of structure and style
- **Extensible**: Add your own components and behaviors
## Available Templates
Start with pre-built templates:
- `default.gbui` - Full-featured desktop interface
- `single.gbui` - Minimalist chat interface
- `mobile.gbui` - Touch-optimized experience
- `kiosk.gbui` - Public display mode
- `widget.gbui` - Embeddable component
## Integration Patterns
Learn to integrate with:
- Existing web applications
- Mobile apps via WebView
- Desktop applications
- Progressive Web Apps (PWA)
## Further Reading
- [UI Design Philosophy](/blog/no-forms)
- [Breaking Platform Lock-in](/blog/deswindonization)
- [Rich Interactions](/blog/beyond-chatbots)
```
### Chapter 5: CSS Theming (gbtheme)
**Related Blog Posts:**
- "Deswindonization" - Visual independence
- "Breaking free from proprietary ecosystems"
**Enhanced Introduction:**
```markdown
# Chapter 05: gbtheme CSS Reference
Great AI deserves great design. The .gbtheme system gives you complete control over your bot's visual identity without touching code. From corporate minimalism to playful personalities, your bot can look exactly how you envision.
## Visual Independence
Following our ["Deswindonization"](/blog/deswindonization) philosophy, themes aren't locked to any design system. Use Material Design, Bootstrap, or create something entirely unique. Your bot, your brand, your rules.
## Psychology of Design
Visual design affects user trust and engagement:
- **Professional themes** for enterprise deployments
- **Friendly themes** for customer service
- **Minimalist themes** for productivity tools
- **Playful themes** for educational bots
## Theme Architecture
Themes are just CSS - no proprietary formats:
- CSS custom properties for colors
- Flexible class targeting
- Media queries for responsive design
- Animation and transition support
- Dark mode variations
## Pre-Built Themes
Start with our curated themes:
- `default.css` - Clean, modern design
- `3dbevel.css` - Retro Windows 95 aesthetic
- `dark.css` - Eye-friendly dark mode
- `minimal.css` - Distraction-free
- `corporate.css` - Professional appearance
## Customization Workflow
1. Start with a base theme
2. Override CSS variables
3. Adjust component styles
4. Test across devices
5. Package and deploy
## Advanced Techniques
- Dynamic theme switching
- User preference persistence
- Seasonal variations
- A/B testing different designs
- Performance optimization
```
### Chapter 6: BASIC Dialogs (gbdialog)
**Related Blog Posts:**
- "BASIC for Everyone" - Philosophy and accessibility
- "BASIC LLM Tools" - Extending LLMs with code
- "MCP is the new API" - Tool integration
**Enhanced Introduction:**
```markdown
# Chapter 06: gbdialog BASIC Reference
BASIC is back, and it's powering the AI revolution. In an age of complex programming languages, General Bots chose BASIC for a simple reason: everyone can learn it in minutes, yet it's powerful enough to orchestrate sophisticated AI workflows.
## Why BASIC in 2025?
As detailed in ["BASIC for Everyone"](/blog/basic-for-everyone), we believe AI development shouldn't require a computer science degree. BASIC's English-like syntax means:
- Business analysts can write automation
- Teachers can create educational bots
- Doctors can build medical assistants
- No programming background needed
## Beyond Simple Scripts
Modern BASIC isn't your grandfather's language. ["BASIC LLM Tools"](/blog/basic-llm-tools) shows how BASIC scripts can:
- Orchestrate multiple AI models
- Process complex data
- Integrate with any API
- Handle enterprise workflows
- Scale to millions of users
## The MCP Revolution
["MCP is the new API"](/blog/mcp-is-the-new-api) explains how BASIC scripts can instantly become tool servers for any AI system. Write once in BASIC, use everywhere:
- As Claude MCP tools
- As OpenAI functions
- As REST APIs
- As automation scripts
## Core Concepts
BASIC in General Bots is:
- **Conversational**: TALK, HEAR, and natural flow
- **Integrated**: Direct access to AI, knowledge, and tools
- **Asynchronous**: Handle multiple conversations
- **Stateful**: Remember context across sessions
- **Extensible**: Add custom keywords easily
## Your First Script
```basic
' Greet the user
TALK "Hello! I'm your AI assistant."
' Get their name
TALK "What's your name?"
name = HEAR
' Personalized response
TALK "Nice to meet you, " + name + "!"
' Offer help
TALK "What can I help you with today?"
request = HEAR
' Use AI to help
response = LLM "Help the user with: " + request
TALK response
```
## Power Features
Advanced capabilities you'll learn:
- Multi-channel messaging (WhatsApp, Teams, Email)
- Database operations
- File handling
- API integration
- Scheduled tasks
- Error handling
- User authentication
## Success Stories
See BASIC in action:
- Customer service automation
- Data processing pipelines
- Report generation
- Appointment scheduling
- Content creation
## Further Reading
- [BASIC Philosophy](/blog/basic-for-everyone)
- [Extending LLMs with BASIC](/blog/basic-llm-tools)
- [Creating MCP Tools](/blog/mcp-is-the-new-api)
```
### Chapter 7: Architecture (gbapp)
**Related Blog Posts:**
- "Why Pragmatismo Selected Open Source" - Architecture decisions
- "Cost-Effective Bot Orchestration" - System design
- "LLM Boom Is Over" - Practical architecture
**Enhanced Introduction:**
```markdown
# Chapter 07: gbapp Architecture Reference
Understanding General Bots' architecture empowers you to extend, optimize, and scale your AI infrastructure. Built on Rust for performance and reliability, the system is designed for both simplicity and power.
## Architectural Philosophy
As explained in ["Why We Selected Open Source"](/blog/why-pragmatismo-selected-open-source), every architectural decision prioritizes:
- **Ownership**: You control every component
- **Simplicity**: Single binary, minimal dependencies
- **Performance**: Rust's speed and safety
- **Flexibility**: Modular feature system
- **Scalability**: From laptop to cloud cluster
## The Post-Boom Architecture
["LLM Boom Is Over"](/blog/llm-boom-is-over) discusses the shift from hype to practical applications. General Bots' architecture reflects this maturity:
- Local-first design
- Efficient resource usage
- Practical feature set
- Production stability
## Cost-Effective Design
["Cost-Effective Bot Orchestration"](/blog/cost-effective-bot-orchestration) shows how architectural choices reduce costs:
- Single binary deployment
- Embedded databases option
- Efficient caching
- Minimal resource requirements
- Horizontal scaling capability
## System Components
Core architecture modules:
- **Bootstrap**: Zero-configuration setup
- **Package Manager**: Template system
- **Session Manager**: Conversation state
- **LLM Router**: Model orchestration
- **Storage Layer**: Files and data
- **Channel Adapters**: Multi-platform support
## Development Workflow
Extending General Bots:
1. Understanding the module structure
2. Adding custom keywords
3. Creating channel adapters
4. Building integrations
5. Contributing upstream
## Performance Characteristics
- Startup time: < 2 seconds
- Memory usage: ~100MB base
- Concurrent sessions: 10,000+
- Response latency: < 50ms
- Throughput: 1,000 msg/sec
## Further Reading
- [Architecture Decisions](/blog/why-pragmatismo-selected-open-source)
- [Practical AI Systems](/blog/llm-boom-is-over)
- [Cost Analysis](/blog/cost-effective-bot-orchestration)
```
### Chapter 8: Configuration (gbot)
**Related Blog Posts:**
- "Own Your Authenticator Stack" - Security configuration
- "Marginalized E-mail Services" - Email setup challenges
- "SDG AI" - Configuring for social good
### Chapter 9: API and Tools
**Related Blog Posts:**
- "MCP is the new API" - Modern tool integration
- "BASIC LLM Tools" - Tool creation patterns
- "Carl vs. Wilson" - API vendor lock-in
### Chapter 10: Features
**Related Blog Posts:**
- "Digital Twins" - Advanced features
- "RCS vs. WhatsApp" - Channel comparison
- "Beyond Chatbots" - Feature possibilities
### Chapter 11: Community
**Related Blog Posts:**
- "Carl vs. Wilson" - Open source benefits
- "Sustainable Development Goals and AI" - Community impact
- "Deswindonization" - Community philosophy
## Implementation Strategy
### 1. Add Blog Links to Chapter Footers
Each chapter should include a "Further Reading" section with relevant blog posts:
```markdown
## Further Reading
### Related Blog Posts
- [Title 1](/blog/slug-1) - Brief description
- [Title 2](/blog/slug-2) - Brief description
- [Title 3](/blog/slug-3) - Brief description
### Next Chapter
Continue to [Chapter Name](../chapter-XX/README.md)
```
### 2. Enhanced Chapter Introductions
Each main chapter README should include:
- **Hook**: Why this matters (2-3 sentences)
- **Context**: Connection to broader concepts
- **Philosophy**: Link to relevant blog posts
- **What You'll Learn**: Clear objectives
- **Prerequisites**: What to know first
- **Real-World Applications**: Concrete examples
- **Further Reading**: Blog posts for depth
### 3. Blog Post Updates
Add documentation links to relevant blog posts:
```markdown
## Learn More
This concept is covered in depth in our documentation:
- [Chapter X: Topic Name](/docs/chapter-XX/) - Full technical reference
- [Quick Start Guide](/docs/chapter-01/quick-start) - Get started in 5 minutes
```
### 4. Cross-Reference Matrix
Create a matrix showing blog ↔ documentation relationships:
| Blog Post | Primary Chapter | Secondary Chapters |
|-----------|----------------|-------------------|
| BASIC for Everyone | Ch 6: gbdialog | Ch 2: Packages |
| No Forms | Ch 4: .gbui | Ch 5: gbtheme |
| MCP is the new API | Ch 9: API | Ch 6: gbdialog |
| Digital Twins | Ch 2: Packages | Ch 10: Features |
| LLM Myths | Ch 3: gbkb | Ch 10: Features |
### 5. Educational Path Recommendations
Create learning paths that combine blog posts and documentation:
#### Path 1: Business User
1. Blog: "No Forms"
2. Blog: "BASIC for Everyone"
3. Doc: Chapter 1 - Quick Start
4. Doc: Chapter 6 - BASIC Basics
5. Blog: "Ready-to-Use Templates"
#### Path 2: Developer
1. Blog: "Why Open Source"
2. Doc: Chapter 1 - Installation
3. Doc: Chapter 7 - Architecture
4. Blog: "MCP is the new API"
5. Doc: Chapter 9 - API Reference
#### Path 3: Enterprise Architect
1. Blog: "Cost-Effective Orchestration"
2. Blog: "Own Your Stack"
3. Doc: Chapter 7 - Architecture
4. Doc: Chapter 12 - Security
5. Blog: "Carl vs. Wilson"
## Metrics for Success
Track engagement to optimize the integration:
- Click-through rate from docs to blog
- Click-through rate from blog to docs
- Time spent on enhanced introductions
- User journey completion rates
- Feedback on educational value
## Next Steps
1. Update all chapter README files with enhanced introductions
2. Add "Further Reading" sections to each chapter
3. Update blog posts with documentation links
4. Create visual learning path diagram
5. Add navigation hints in both blog and docs

View file

@ -0,0 +1,131 @@
# Chapter Reorganization Summary
## Overview
Documentation chapters have been reorganized to better reflect the logical flow from user interface definition (.gbui files) to styling (gbtheme), followed by functionality and configuration.
## Chapter Changes
### Before → After Mapping
| Old Chapter | Old Topic | New Chapter | New Topic |
|------------|-----------|-------------|-----------|
| Chapter 4 | gbtheme (Theme & UI) | Chapter 4 | .gbui Interface Reference |
| Chapter 5 | gbdialog (BASIC) | Chapter 5 | gbtheme CSS Reference |
| Chapter 6 | gbapp/Rust Architecture | Chapter 6 | gbdialog (BASIC) |
| Chapter 7 | gbot Configuration | Chapter 7 | gbapp Architecture |
| Chapter 8 | Tooling | Chapter 8 | gbot Configuration |
| Chapter 9 | Features | Chapter 9 | API and Tooling |
| Chapter 10 | Contributing | Chapter 10 | Feature Reference |
| Chapter 10 | .gbui (was new) | Chapter 11 | Contributing |
| Chapter 11 | Authentication | Chapter 12 | Authentication |
| Chapter 12 | REST API | Chapter 13 | REST API |
## Rationale for Changes
### 1. UI Before Styling (Chapters 4 & 5)
- **.gbui files (Chapter 4)** define the structure and behavior of user interfaces
- **gbtheme (Chapter 5)** provides CSS styling for those interfaces
- This order reflects the natural development flow: structure first, then styling
### 2. Content Migration
UI-specific content from the old Chapter 4 (gbtheme) has been moved to Chapter 4 (.gbui):
- `ui-interface.md` → Chapter 4
- `html.md``html-templates.md` in Chapter 4
- `desktop-mode.md` → Chapter 4
- `console-mode.md` → Chapter 4
The gbtheme chapter (now Chapter 5) focuses purely on CSS theming:
- `css.md` - CSS customization
- `structure.md` - Theme package structure
- Theme examples (3D bevel, etc.)
### 3. Logical Flow
The new organization follows a more intuitive progression:
1. **Installation & Setup** (Chapter 1)
2. **Package System** (Chapter 2)
3. **Knowledge Base** (Chapter 3)
4. **User Interface** (Chapter 4 - .gbui)
5. **Styling** (Chapter 5 - gbtheme)
6. **Dialog Logic** (Chapter 6 - gbdialog/BASIC)
7. **Architecture** (Chapter 7 - gbapp)
8. **Configuration** (Chapter 8 - gbot)
9. **API & Tools** (Chapter 9)
10. **Features** (Chapter 10)
11. **Community** (Chapter 11)
12. **Security** (Chapter 12)
13. **REST API** (Chapter 13)
## File Structure Changes
### Renamed Directories
```
docs/src/
├── chapter-04-gbui/ # Was chapter-10-gbui, includes UI content from old chapter-04
├── chapter-05-gbtheme/ # Was chapter-04, now focused on CSS only
├── chapter-06-gbdialog/ # Was chapter-05
├── chapter-07-gbapp/ # Was chapter-06
├── chapter-08-config/ # Was chapter-07
├── chapter-09-api/ # Was chapter-08
├── chapter-10-features/ # Was chapter-09
├── chapter-11-community/ # Was chapter-10
├── chapter-12-auth/ # Was chapter-11
└── chapter-13-api/ # Was chapter-12
```
### Deleted Old Directories
The following empty directories were removed after content migration:
- `chapter-04/` through `chapter-10/` (old structure)
- `chapter-10-gbui/` (duplicate after move)
## Key Benefits
1. **Better Learning Path**: Users now learn about UI structure (.gbui) before styling (gbtheme)
2. **Clearer Separation**: UI definition, styling, and logic are in separate chapters
3. **Consolidated UI Documentation**: All UI-related content is now in Chapter 4
4. **Pure CSS Focus**: Chapter 5 now focuses exclusively on theming without mixing UI concepts
## Migration Checklist
- [x] Move chapter directories to new numbers
- [x] Transfer UI content from gbtheme to gbui chapter
- [x] Update all chapter references in SUMMARY.md
- [x] Update chapter references in main README.md
- [x] Update cross-references within chapters
- [x] Delete old empty directories
- [x] Update keyword file references (chapter-05 → chapter-06-gbdialog)
- [x] Fix authentication chapter references (chapter-11 → chapter-12-auth)
- [x] Fix API chapter references (chapter-12 → chapter-13-api)
## Files Moved Between Chapters
From `chapter-05-gbtheme/` to `chapter-04-gbui/`:
- `ui-interface.md``ui-interface.md`
- `html.md``html-templates.md`
- `desktop-mode.md``desktop-mode.md`
- `console-mode.md``console-mode.md`
## Updated Cross-References
All internal links have been updated to reflect the new chapter numbers:
- BASIC references: `../chapter-05/``../chapter-06-gbdialog/`
- Theme references: `../chapter-04/``../chapter-05-gbtheme/`
- UI references: Point to `../chapter-04-gbui/`
- Configuration: `../chapter-07/``../chapter-08-config/`
- Architecture: `../chapter-06/``../chapter-07-gbapp/`
## Testing Required
After reorganization, verify:
1. All links in documentation work correctly
2. Chapter flow makes logical sense for new users
3. No broken references between chapters
4. Table of contents (SUMMARY.md) renders properly
5. Cross-references within chapters are accurate
## Next Steps
1. Review the new chapter flow with stakeholders
2. Update any external documentation that references chapter numbers
3. Consider adding transition guides between related chapters
4. Update any automated documentation generation scripts

View file

@ -0,0 +1,151 @@
# Documentation Fixes Summary
## Date: 2024
This document summarizes all the fixes made to the BotServer documentation as per the requested changes.
## 1. Diagram Height Fix (Chapter 6.1)
**File:** `docs/src/chapter-06-gbdialog/assets/basic-execution-flow.svg`
- Fixed SVG height from 600px to 500px
- Adjusted all internal elements proportionally to fit the new height
- Maintained readability and visual hierarchy
## 2. Removed Non-Existent Keywords and Constructs
### TRY/CATCH Blocks Removed
**Files affected:**
- `docs/src/chapter-06-gbdialog/keyword-send-mail.md`
- `docs/src/chapter-10-features/email.md`
**Changes:**
- Removed all TRY/CATCH/END TRY blocks
- Replaced with proper IF/THEN/ELSE error handling
- Example:
```basic
' OLD (INCORRECT):
TRY
SEND MAIL recipient, subject, body
CATCH "error"
TALK "Error occurred"
END TRY
' NEW (CORRECT):
status = SEND MAIL recipient, subject, body
IF status = "sent" THEN
TALK "Email sent successfully"
ELSE
TALK "Failed to send email: " + status
END IF
```
### FUNCTION/END FUNCTION Removed
**File:** `docs/src/chapter-06-gbdialog/keyword-send-mail.md`
- Removed FUNCTION/END FUNCTION declarations
- Replaced with inline logic using IF/THEN/ELSE
### VALIDATE_EMAIL Removed
**File:** `docs/src/chapter-06-gbdialog/keyword-send-mail.md`
- Removed references to non-existent VALIDATE_EMAIL keyword
- Replaced with manual email validation using CONTAINS and SPLIT
### ON ERROR Removed
**File:** `docs/src/chapter-06-gbdialog/keyword-send-mail.md`
- Removed ON ERROR/END ON blocks
- Replaced with standard IF/THEN error checking
### ATTACH_FILE Removed
**File:** `docs/src/chapter-06-gbdialog/keyword-create-task.md`
- Removed references to non-existent ATTACH_FILE keyword
- Added comment to use document sharing systems instead
## 3. Fixed Keyword Formatting (Removed Underscores)
### Keywords Changed from WORD_WORD to WORD WORD Format:
| Old Format | New Format | Files Affected |
|------------|------------|----------------|
| `CREATE_SITE` | `CREATE SITE` | keyword-create-site.md, chapter-09-api/README.md |
| `CREATE_TASK` | `CREATE TASK` | keyword-create-task.md, email.md |
| `CREATE_DRAFT` | `CREATE DRAFT` | keyword-create-draft.md |
| `SET_SCHEDULE` | `SET SCHEDULE` | Multiple files including keyword-set-schedule.md, automation.md, template-summary.md |
| `SEND_MAIL` | `SEND MAIL` | keyword-send-mail.md, email.md, email-api.md |
| `USE_KB` | `USE KB` | Multiple files including README.md, kb-and-tools.md, knowledge-base.md |
| `CLEAR_KB` | `CLEAR KB` | Multiple files including README.md, kb-and-tools.md |
| `SET_KB` | `SET KB` | chapter-09-api/README.md, docs-summary.md |
| `ADD_WEBSITE` | `ADD WEBSITE` | keyword-add-website.md, summary.md, README.md |
| `USE_TOOL` | `USE TOOL` | Multiple files including README.md, tool-definition.md |
| `CLEAR_TOOLS` | `CLEAR TOOLS` | keyword-clear-tools.md, README.md, kb-and-tools.md |
| `REMOVE_TOOL` | `REMOVE TOOL` | tool-definition.md, chapter-09-api/README.md |
| `LIST_TOOLS` | `LIST TOOLS` | tool-definition.md, chapter-09-api/README.md |
| `ADD_MEMBER` | `ADD MEMBER` | keyword-create-task.md |
## 4. Removed Timezone Support from SET SCHEDULE
**File:** `docs/src/chapter-06-gbdialog/keyword-set-schedule.md`
- Removed the "Time Zone Support" section
- Removed TIMEZONE parameter documentation
- Updated to indicate that server's local time is used
## 5. Files Modified (Summary)
### Documentation Root
- `botserver/README.md`
### Chapter 6 - gbdialog
- `docs/src/chapter-06-gbdialog/assets/basic-execution-flow.svg`
- `docs/src/chapter-06-gbdialog/keyword-create-site.md`
- `docs/src/chapter-06-gbdialog/keyword-create-task.md`
- `docs/src/chapter-06-gbdialog/keyword-send-mail.md`
- `docs/src/chapter-06-gbdialog/keyword-set-schedule.md`
- `docs/src/chapter-06-gbdialog/keyword-add-website.md`
- `docs/src/chapter-06-gbdialog/keyword-clear-tools.md`
- `docs/src/chapter-06-gbdialog/keyword-create-draft.md`
- `docs/src/chapter-06-gbdialog/keyword-set-context.md`
- `docs/src/chapter-06-gbdialog/keyword-wait.md`
- `docs/src/chapter-06-gbdialog/template-summary.md`
### Chapter 3 - Knowledge Base
- `docs/src/chapter-03/kb-and-tools.md`
- `docs/src/chapter-03/summary.md`
### Chapter 7 - gbapp
- `docs/src/chapter-07-gbapp/custom-keywords.md`
### Chapter 9 - API
- `docs/src/chapter-09-api/README.md`
- `docs/src/chapter-09-api/compilation.md`
- `docs/src/chapter-09-api/tool-definition.md`
### Chapter 10 - Features
- `docs/src/chapter-10-features/README.md`
- `docs/src/chapter-10-features/automation.md`
- `docs/src/chapter-10-features/email.md`
- `docs/src/chapter-10-features/core-features.md`
- `docs/src/chapter-10-features/knowledge-base.md`
### Chapter 13 - API
- `docs/src/chapter-13-api/email-api.md`
### Prompts
- `prompts/dev/docs/docs-summary.md`
## 6. Validation Notes
All changes maintain backward compatibility at the documentation level while accurately reflecting the actual BotServer implementation. The keyword format changes (removing underscores) make the BASIC dialect more natural and readable, following English-like syntax patterns.
## 7. Recommendations for Future Updates
1. **Consistency Check**: Ensure all new documentation follows the WORD WORD format for multi-word keywords
2. **Error Handling**: Use IF/THEN/ELSE patterns for error handling, not TRY/CATCH
3. **Validation**: Use manual validation logic rather than non-existent validation keywords
4. **Scheduling**: Document that SET SCHEDULE uses server local time only
## 8. Impact Assessment
- **Breaking Changes**: None at the code level (documentation only)
- **User Impact**: Improved accuracy and clarity in documentation
- **Developer Impact**: Clear guidance on actual available keywords and constructs
- **Learning Curve**: Simplified by removing non-existent features
This completes the documentation fixes as requested.

View file

@ -0,0 +1,210 @@
# UI Migration Summary
## Overview
This document summarizes the migration from `web/` directory structure to `ui/` directory structure and the introduction of `.gbui` file format for user interface templates.
## Directory Structure Changes
### Before
```
botserver/
└── web/
├── desktop/
│ └── index.html
└── html/
```
### After
```
botserver/
└── ui/
├── desktop/
│ ├── default.gbui # Full-featured interface (copy of index.html)
│ ├── single.gbui # Simplified single-page chat interface
│ └── index.html # Original file retained for compatibility
└── html/
```
## Code Changes
### 1. Module Renaming
- **Before**: `botserver/src/core/web_server/`
- **After**: `botserver/src/core/ui_server/`
### 2. Import Updates
#### lib.rs
```rust
// Before
pub use core::web_server;
// After
pub use core::ui_server;
```
#### main.rs
```rust
// Before
use botserver::core::web_server;
.route("/", get(crate::web_server::index))
// After
use botserver::core::ui_server;
.route("/", get(crate::ui_server::index))
```
### 3. Path Updates in ui_server/mod.rs
```rust
// Before
match fs::read_to_string("web/desktop/index.html")
let static_path = PathBuf::from("./web/desktop");
// After
match fs::read_to_string("ui/desktop/index.html")
let static_path = PathBuf::from("./ui/desktop");
```
### 4. Configuration Updates
#### tauri.conf.json
```json
// Before
"frontendDist": "./web/desktop"
// After
"frontendDist": "./ui/desktop"
```
#### Cargo.toml Features
```toml
# Before
default = ["web-server", ...]
desktop = [..., "web-server"]
web-server = []
minimal = ["web-server", "chat"]
lightweight = ["web-server", "chat", "drive", "tasks"]
# After
default = ["ui-server", ...]
desktop = [..., "ui-server"]
ui-server = []
minimal = ["ui-server", "chat"]
lightweight = ["ui-server", "chat", "drive", "tasks"]
```
### 5. Service Name Updates
```rust
// Before (in admin.rs)
name: "web_server".to_string()
service: "web_server".to_string()
// After
name: "ui_server".to_string()
service: "ui_server".to_string()
```
## Documentation Updates
### 1. Chapter Structure
- Renamed `chapter-04/web-interface.md` to `chapter-04/ui-interface.md`
- Renamed `chapter-09/web-automation.md` to `chapter-09/ui-automation.md`
- Added new **Chapter 10: .gbui Files Reference** with comprehensive documentation
### 2. Terminology Updates Throughout Documentation
- "Web server" → "UI server"
- "Web interface" → "UI interface"
- "Access web interface" → "Access UI interface"
- "Starting web server" → "Starting UI server"
### 3. New .gbui Documentation Structure
```
chapter-10-gbui/
├── README.md # .gbui overview and reference
├── structure.md # Template structure details
├── components.md # Component library reference
├── javascript-api.md # JavaScript API documentation
├── mobile.md # Mobile optimization guide
├── custom-templates.md # Creating custom templates
└── embedding.md # Embedding .gbui files
```
## New .gbui File Format
### Purpose
The `.gbui` (General Bots User Interface) format provides HTML-based templates for bot interfaces with:
- Built-in WebSocket communication
- Theme integration
- Responsive design
- Component library
- JavaScript API
### Available Templates
1. **default.gbui** - Full-featured desktop interface with multiple apps (Chat, Drive, Tasks, Mail)
2. **single.gbui** - Streamlined single-page chat interface with minimal footprint
### Key Features
- Template variables: `{{bot_name}}`, `{{api_endpoint}}`, `{{websocket_url}}`
- Component system with `data-gb-component` attributes
- CSS class prefix: `gb-` for all General Bots components
- Theme variables: `--gb-primary`, `--gb-secondary`, etc.
## Important Notes
### Channel Names Remain Unchanged
The term "web" as a channel identifier (alongside "whatsapp", "teams", etc.) remains unchanged in:
- Channel adapter references
- Session channel identification
- Message routing logic
These refer to the communication channel type, not the server or interface.
### UI Automation Clarification
The UI automation module now encompasses:
- **Web Automation**: Browser automation, web scraping
- **Desktop Automation**: Desktop application control
- **Mobile Automation**: Mobile app UI control
- **Screen Capture**: Cross-platform screenshot and recording capabilities
## Migration Checklist
- [x] Rename `web/` directory to `ui/`
- [x] Create `default.gbui` from `index.html`
- [x] Create `single.gbui` simplified template
- [x] Update module name from `web_server` to `ui_server`
- [x] Update all import statements
- [x] Update path references in code
- [x] Update tauri.conf.json
- [x] Update Cargo.toml features
- [x] Update service names in admin endpoints
- [x] Update documentation terminology
- [x] Create .gbui documentation chapter
- [x] Update SUMMARY.md with new chapter
## Testing Required
After migration, test:
1. UI server starts correctly on port 8080
2. Static files are served from `ui/desktop/`
3. Both .gbui templates load correctly
4. WebSocket connections work
5. Theme switching functions properly
6. Mobile responsiveness is maintained
7. Desktop app (Tauri) builds successfully
## Rollback Plan
If issues occur:
1. Rename `ui/` back to `web/`
2. Revert module name to `web_server`
3. Restore original import statements
4. Update paths back to `web/desktop`
5. Revert configuration files
6. Restore original documentation
## Benefits of Migration
1. **Clearer Naming**: "UI" better represents the interface layer
2. **.gbui Format**: Standardized template format for bot interfaces
3. **Better Documentation**: Dedicated chapter for UI templates
4. **Extensibility**: Easy to add new template types (mobile, kiosk, embedded)
5. **Consistency**: Aligns with other .gb* file formats (.gbapp, .gbot, .gbtheme, etc.)

View file

@ -24,7 +24,7 @@ This documentation has been **recently updated** to accurately reflect the actua
- UI tree module (`src/ui_tree/`)
- Riot compiler module (`src/riot_compiler/`)
- Prompt manager (`src/prompt_manager/`)
- API endpoints and web server routes
- API endpoints and UI server routes
- Drive (S3-compatible) integration details
- Video conferencing (LiveKit) integration
@ -71,37 +71,40 @@ BotServer is an open-source conversational AI platform written in Rust. It enabl
### Part III - Knowledge Base
- [Chapter 03: gbkb Reference](chapter-03/README.md) - Semantic search and vector database
### Part IV - Themes and UI
- [Chapter 04: gbtheme Reference](chapter-04/README.md) - Customizing the web interface
### Part IV - User Interface
- [Chapter 04: .gbui Interface Reference](chapter-04-gbui/README.md) - HTML templates and UI components
### Part V - BASIC Dialogs
- [Chapter 05: gbdialog Reference](chapter-05/README.md) - Complete BASIC scripting reference
### Part V - Themes and Styling
- [Chapter 05: gbtheme CSS Reference](chapter-05-gbtheme/README.md) - CSS-based theme customization
### Part VI - BASIC Dialogs
- [Chapter 06: gbdialog Reference](chapter-06-gbdialog/README.md) - Complete BASIC scripting reference
- Keywords: `TALK`, `HEAR`, `LLM`, `SET CONTEXT`, `USE KB`, and more
### Part VI - Extending BotServer
- [Chapter 06: Rust Architecture Reference](chapter-06/README.md) - Internal architecture
- [Architecture Overview](chapter-06/architecture.md) - Bootstrap process
- [Building from Source](chapter-06/building.md) - Compilation and features
- [Module Structure](chapter-06/crates.md) - Single-crate organization
- [Service Layer](chapter-06/services.md) - Module descriptions
- [Creating Custom Keywords](chapter-06/custom-keywords.md) - Extending BASIC
- [Adding Dependencies](chapter-06/dependencies.md) - Cargo.toml management
### Part VII - Extending BotServer
- [Chapter 07: gbapp Architecture Reference](chapter-07-gbapp/README.md) - Internal architecture
- [Architecture Overview](chapter-07-gbapp/architecture.md) - Bootstrap process
- [Building from Source](chapter-07-gbapp/building.md) - Compilation and features
- [Module Structure](chapter-07-gbapp/crates.md) - Single-crate organization
- [Service Layer](chapter-07-gbapp/services.md) - Module descriptions
- [Creating Custom Keywords](chapter-07-gbapp/custom-keywords.md) - Extending BASIC
- [Adding Dependencies](chapter-07-gbapp/dependencies.md) - Cargo.toml management
### Part VII - Bot Configuration
- [Chapter 07: gbot Reference](chapter-07/README.md) - Configuration parameters
### Part VIII - Bot Configuration
- [Chapter 08: gbot Reference](chapter-08-config/README.md) - Configuration and parameters
### Part VIII - Tools and Integration
- [Chapter 08: Tooling](chapter-08/README.md) - External APIs and tool integration
### Part IX - Tools and Integration
- [Chapter 09: API and Tooling](chapter-09-api/README.md) - Function calling and tool integration
### Part IX - Feature Reference
- [Chapter 09: Feature Matrix](chapter-09/README.md) - Complete feature list
- [Core Features](chapter-09/core-features.md) - Platform capabilities
### Part X - Feature Deep Dive
- [Chapter 10: Feature Reference](chapter-10-features/README.md) - Complete feature list
- [Core Features](chapter-10-features/core-features.md) - Platform capabilities
### Part X - Community
- [Chapter 10: Contributing](chapter-10/README.md) - Development guidelines
### Part XI - Community
- [Chapter 11: Contributing](chapter-11-community/README.md) - Development and contribution guidelines
### Part XI - Authentication and Security
- [Chapter 11: Authentication](chapter-11/README.md) - Security features
### Part XII - Authentication and Security
- [Chapter 12: Authentication](chapter-12-auth/README.md) - Security features
### Appendices
- [Appendix I: Database Model](appendix-i/README.md) - Schema reference

View file

@ -32,150 +32,151 @@
- [Context Compaction](./chapter-03/context-compaction.md)
- [Semantic Caching](./chapter-03/caching.md)
# Part IV - Themes and UI
# Part IV - User Interface
- [Chapter 04: gbtheme Reference](./chapter-04/README.md)
- [Theme Structure](./chapter-04/structure.md)
- [Web Interface](./chapter-04/web-interface.md)
- [CSS Customization](./chapter-04/css.md)
- [HTML Templates](./chapter-04/html.md)
- [Desktop Mode](./chapter-04/desktop-mode.md)
- [Console Mode](./chapter-04/console-mode.md)
- [Chapter 04: .gbui Interface Reference](./chapter-04-gbui/README.md)
- [default.gbui - Full Desktop](./chapter-04-gbui/default-gbui.md)
- [single.gbui - Simple Chat](./chapter-04-gbui/single-gbui.md)
- [Console Mode](./chapter-04-gbui/console-mode.md)
# Part V - BASIC Dialogs
# Part V - Themes and Styling
- [Chapter 05: gbdialog Reference](./chapter-05/README.md)
- [Dialog Basics](./chapter-05/basics.md)
- [Universal Messaging & Multi-Channel](./chapter-05/universal-messaging.md)
- [Template Examples](./chapter-05/templates.md)
- [start.bas](./chapter-05/template-start.md)
- [generate-summary.bas](./chapter-05/template-summary.md)
- [enrollment Tool Example](./chapter-05/template-enrollment.md)
- [Keyword Reference](./chapter-05/keywords.md)
- [TALK](./chapter-05/keyword-talk.md)
- [HEAR](./chapter-05/keyword-hear.md)
- [SET CONTEXT](./chapter-05/keyword-set-context.md)
- [GET BOT MEMORY](./chapter-05/keyword-get-bot-memory.md)
- [SET BOT MEMORY](./chapter-05/keyword-set-bot-memory.md)
- [USE KB](./chapter-05/keyword-use-kb.md)
- [CLEAR KB](./chapter-05/keyword-clear-kb.md)
- [ADD WEBSITE](./chapter-05/keyword-add-website.md)
- [USE TOOL](./chapter-05/keyword-use-tool.md)
- [CLEAR TOOLS](./chapter-05/keyword-clear-tools.md)
- [GET](./chapter-05/keyword-get.md)
- [SET](./chapter-05/keyword-set.md)
- [ON](./chapter-05/keyword-on.md)
- [SET SCHEDULE](./chapter-05/keyword-set-schedule.md)
- [CREATE SITE](./chapter-05/keyword-create-site.md)
- [CREATE DRAFT](./chapter-05/keyword-create-draft.md)
- [CREATE TASK](./chapter-05/keyword-create-task.md)
- [PRINT](./chapter-05/keyword-print.md)
- [WAIT](./chapter-05/keyword-wait.md)
- [FORMAT](./chapter-05/keyword-format.md)
- [FIRST](./chapter-05/keyword-first.md)
- [LAST](./chapter-05/keyword-last.md)
- [FOR EACH](./chapter-05/keyword-for-each.md)
- [EXIT FOR](./chapter-05/keyword-exit-for.md)
- [SEND MAIL](./chapter-05/keyword-send-mail.md)
- [FIND](./chapter-05/keyword-find.md)
- [Chapter 05: gbtheme CSS Reference](./chapter-05-gbtheme/README.md)
- [Theme Structure](./chapter-05-gbtheme/structure.md)
- [CSS Customization](./chapter-05-gbtheme/css.md)
# Part VI - Extending BotServer
# Part VI - BASIC Dialogs
- [Chapter 06: Rust Architecture Reference](./chapter-06/README.md)
- [Architecture Overview](./chapter-06/architecture.md)
- [Building from Source](./chapter-06/building.md)
- [Container Deployment (LXC)](./chapter-06/containers.md)
- [Module Structure](./chapter-06/crates.md)
- [Service Layer](./chapter-06/services.md)
- [Creating Custom Keywords](./chapter-06/custom-keywords.md)
- [Adding Dependencies](./chapter-06/dependencies.md)
- [Prompt Manager](./chapter-06/prompt-manager.md)
- [Chapter 06: gbdialog Reference](./chapter-06-gbdialog/README.md)
- [Dialog Basics](./chapter-06-gbdialog/basics.md)
- [Universal Messaging & Multi-Channel](./chapter-06-gbdialog/universal-messaging.md)
- [Template Examples](./chapter-06-gbdialog/templates.md)
- [start.bas](./chapter-06-gbdialog/template-start.md)
- [generate-summary.bas](./chapter-06-gbdialog/template-summary.md)
- [enrollment Tool Example](./chapter-06-gbdialog/template-enrollment.md)
- [Keywords Reference](./chapter-06-gbdialog/keywords.md)
- [TALK](./chapter-06-gbdialog/keyword-talk.md)
- [HEAR](./chapter-06-gbdialog/keyword-hear.md)
- [SET CONTEXT](./chapter-06-gbdialog/keyword-set-context.md)
- [GET BOT MEMORY](./chapter-06-gbdialog/keyword-get-bot-memory.md)
- [SET BOT MEMORY](./chapter-06-gbdialog/keyword-set-bot-memory.md)
- [USE KB](./chapter-06-gbdialog/keyword-use-kb.md)
- [CLEAR KB](./chapter-06-gbdialog/keyword-clear-kb.md)
- [ADD WEBSITE](./chapter-06-gbdialog/keyword-add-website.md)
- [USE TOOL](./chapter-06-gbdialog/keyword-use-tool.md)
- [CLEAR TOOLS](./chapter-06-gbdialog/keyword-clear-tools.md)
- [GET](./chapter-06-gbdialog/keyword-get.md)
- [SET](./chapter-06-gbdialog/keyword-set.md)
- [ON](./chapter-06-gbdialog/keyword-on.md)
- [SET SCHEDULE](./chapter-06-gbdialog/keyword-set-schedule.md)
- [CREATE SITE](./chapter-06-gbdialog/keyword-create-site.md)
- [CREATE DRAFT](./chapter-06-gbdialog/keyword-create-draft.md)
- [CREATE TASK](./chapter-06-gbdialog/keyword-create-task.md)
- [PRINT](./chapter-06-gbdialog/keyword-print.md)
- [WAIT](./chapter-06-gbdialog/keyword-wait.md)
- [FORMAT](./chapter-06-gbdialog/keyword-format.md)
- [FIRST](./chapter-06-gbdialog/keyword-first.md)
- [LAST](./chapter-06-gbdialog/keyword-last.md)
- [FOR EACH](./chapter-06-gbdialog/keyword-for-each.md)
- [EXIT FOR](./chapter-06-gbdialog/keyword-exit-for.md)
- [SEND MAIL](./chapter-06-gbdialog/keyword-send-mail.md)
- [FIND](./chapter-06-gbdialog/keyword-find.md)
# Part VII - Bot Configuration
# Part VII - Extending BotServer
- [Chapter 07: gbot Reference](./chapter-07/README.md)
- [config.csv Format](./chapter-07/config-csv.md)
- [Bot Parameters](./chapter-07/parameters.md)
- [LLM Configuration](./chapter-07/llm-config.md)
- [Context Configuration](./chapter-07/context-config.md)
- [Drive Integration](./chapter-07/minio.md)
- [Chapter 07: gbapp Architecture Reference](./chapter-07-gbapp/README.md)
- [Architecture Overview](./chapter-07-gbapp/architecture.md)
- [Building from Source](./chapter-07-gbapp/building.md)
- [Container Deployment (LXC)](./chapter-07-gbapp/containers.md)
- [Module Structure](./chapter-07-gbapp/crates.md)
- [Service Layer](./chapter-07-gbapp/services.md)
- [Creating Custom Keywords](./chapter-07-gbapp/custom-keywords.md)
- [Adding Dependencies](./chapter-07-gbapp/dependencies.md)
- [Prompt Manager](./chapter-07-gbapp/prompt-manager.md)
# Part VIII - Tools and Integration
# Part VIII - Bot Configuration
- [Chapter 08: Tooling](./chapter-08/README.md)
- [Tool Definition](./chapter-08/tool-definition.md)
- [PARAM Declaration](./chapter-08/param-declaration.md)
- [Tool Compilation](./chapter-08/compilation.md)
- [MCP Format](./chapter-08/mcp-format.md)
- [Tool Format](./chapter-08/openai-format.md)
- [GET Keyword Integration](./chapter-08/get-integration.md)
- [External APIs](./chapter-08/external-apis.md)
- [NVIDIA GPU Setup for LXC](./chapter-08/nvidia-gpu-setup.md)
- [Chapter 08: gbot Reference](./chapter-08-config/README.md)
- [config.csv Format](./chapter-08-config/config-csv.md)
- [Bot Parameters](./chapter-08-config/parameters.md)
- [LLM Configuration](./chapter-08-config/llm-config.md)
- [Context Configuration](./chapter-08-config/context-config.md)
- [Drive Integration](./chapter-08-config/minio.md)
# Part IX - Feature Reference
# Part IX - Tools and Integration
- [Chapter 09: Feature Matrix](./chapter-09/README.md)
- [Core Features](./chapter-09/core-features.md)
- [Conversation Management](./chapter-09/conversation.md)
- [AI and LLM](./chapter-09/ai-llm.md)
- [Knowledge Base](./chapter-09/knowledge-base.md)
- [Automation](./chapter-09/automation.md)
- [Email Integration](./chapter-09/email.md)
- [Web Automation](./chapter-09/web-automation.md)
- [Storage and Data](./chapter-09/storage.md)
- [Multi-Channel Support](./chapter-09/channels.md)
- [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)
- [NVIDIA GPU Setup for LXC](./chapter-09-api/nvidia-gpu-setup.md)
# Part X - Community
- [Chapter 10: Contributing](./chapter-10/README.md)
- [Development Setup](./chapter-10/setup.md)
- [Contributing Guidelines](./chapter-10/contributing-guidelines.md)
- [Code of Conduct](./chapter-10/code-of-conduct.md)
- [Código de Conduta (Português)](./chapter-10/code-of-conduct-pt-br.md)
- [Code Standards](./chapter-10/standards.md)
- [Testing](./chapter-10/testing.md)
- [Pull Requests](./chapter-10/pull-requests.md)
- [Documentation](./chapter-10/documentation.md)
- [IDE Extensions](./chapter-10/ide-extensions.md)
# Part X - Feature Deep Dive
# Part XI - Authentication and Security
- [Chapter 10: Feature Reference](./chapter-10-features/README.md)
- [Core Features](./chapter-10-features/core-features.md)
- [Conversation Management](./chapter-10-features/conversation.md)
- [AI and LLM](./chapter-10-features/ai-llm.md)
- [Knowledge Base](./chapter-10-features/knowledge-base.md)
- [Automation](./chapter-10-features/automation.md)
- [Email Integration](./chapter-10-features/email.md)
- [UI Automation](./chapter-10-features/ui-automation.md)
- [Storage and Data](./chapter-10-features/storage.md)
- [Multi-Channel Support](./chapter-10-features/channels.md)
- [Chapter 11: Authentication](./chapter-11/README.md)
- [User Authentication](./chapter-11/user-auth.md)
- [Password Security](./chapter-11/password-security.md)
- [API Endpoints](./chapter-11/api-endpoints.md)
- [Bot Authentication](./chapter-11/bot-auth.md)
- [Security Features](./chapter-11/security-features.md)
- [Security Policy](./chapter-11/security-policy.md)
- [Compliance Requirements](./chapter-11/compliance-requirements.md)
# Part XI - Community
# Part XII - REST API Reference
- [Chapter 11: Contributing](./chapter-11-community/README.md)
- [Development Setup](./chapter-11-community/setup.md)
- [Testing Guide](./chapter-11-community/testing.md)
- [Documentation](./chapter-11-community/documentation.md)
- [Pull Requests](./chapter-11-community/pull-requests.md)
- [Community Guidelines](./chapter-11-community/community.md)
- [IDE Extensions](./chapter-11-community/ide-extensions.md)
- [Chapter 12: REST API Reference](./chapter-12/README.md)
- [Files API](./chapter-12/files-api.md)
- [Document Processing API](./chapter-12/document-processing.md)
- [Users API](./chapter-12/users-api.md)
- [User Security API](./chapter-12/user-security.md)
- [Groups API](./chapter-12/groups-api.md)
- [Group Membership API](./chapter-12/group-membership.md)
- [Conversations API](./chapter-12/conversations-api.md)
- [Calls API](./chapter-12/calls-api.md)
- [Whiteboard API](./chapter-12/whiteboard-api.md)
- [Email API](./chapter-12/email-api.md)
- [Notifications API](./chapter-12/notifications-api.md)
- [Calendar API](./chapter-12/calendar-api.md)
- [Tasks API](./chapter-12/tasks-api.md)
- [Storage API](./chapter-12/storage-api.md)
- [Backup API](./chapter-12/backup-api.md)
- [Analytics API](./chapter-12/analytics-api.md)
- [Reports API](./chapter-12/reports-api.md)
- [Admin API](./chapter-12/admin-api.md)
- [Monitoring API](./chapter-12/monitoring-api.md)
- [AI API](./chapter-12/ai-api.md)
- [ML API](./chapter-12/ml-api.md)
- [Security API](./chapter-12/security-api.md)
- [Compliance API](./chapter-12/compliance-api.md)
- [Example Integrations](./chapter-12/examples.md)
# Part XII - Authentication and Security
- [Chapter 12: Authentication](./chapter-12-auth/README.md)
- [User Authentication](./chapter-12-auth/user-auth.md)
- [Password Security](./chapter-12-auth/password-security.md)
- [API Endpoints](./chapter-12-auth/api-endpoints.md)
- [Bot Authentication](./chapter-12-auth/bot-auth.md)
- [Security Features](./chapter-12-auth/security-features.md)
- [Security Policy](./chapter-12-auth/security-policy.md)
- [Compliance Requirements](./chapter-12-auth/compliance-requirements.md)
# Part XIII - REST API Reference
- [Chapter 13: REST API Reference](./chapter-13-api/README.md)
- [Files API](./chapter-13-api/files-api.md)
- [Document Processing API](./chapter-13-api/document-processing.md)
- [Users API](./chapter-13-api/users-api.md)
- [User Security API](./chapter-13-api/user-security.md)
- [Groups API](./chapter-13-api/groups-api.md)
- [Group Membership API](./chapter-13-api/group-membership.md)
- [Conversations API](./chapter-13-api/conversations-api.md)
- [Calls API](./chapter-13-api/calls-api.md)
- [Whiteboard API](./chapter-13-api/whiteboard-api.md)
- [Email API](./chapter-13-api/email-api.md)
- [Notifications API](./chapter-13-api/notifications-api.md)
- [Calendar API](./chapter-13-api/calendar-api.md)
- [Tasks API](./chapter-13-api/tasks-api.md)
- [Storage API](./chapter-13-api/storage-api.md)
- [Backup API](./chapter-13-api/backup-api.md)
- [Analytics API](./chapter-13-api/analytics-api.md)
- [Reports API](./chapter-13-api/reports-api.md)
- [Admin API](./chapter-13-api/admin-api.md)
- [Monitoring API](./chapter-13-api/monitoring-api.md)
- [AI API](./chapter-13-api/ai-api.md)
- [ML API](./chapter-13-api/ml-api.md)
- [Security API](./chapter-13-api/security-api.md)
- [Compliance API](./chapter-13-api/compliance-api.md)
- [Example Integrations](./chapter-13-api/examples.md)
# Appendices

View file

@ -1,6 +1,18 @@
# Chapter 01: Run and Talk
**Zero to chatbot in 60 seconds.** This chapter gets BotServer running with a working bot you can talk to immediately.
Welcome to General Bots - your journey to AI independence starts here. In a world dominated by expensive, proprietary AI solutions, General Bots offers a refreshing alternative: a complete, open-source AI platform that you control entirely.
## Why General Bots?
Before diving into installation, let's understand what makes General Bots different:
1. **Complete Ownership**: Unlike SaaS solutions that lock your data in the cloud, General Bots runs on your infrastructure. Your conversations, your data, your rules.
2. **Zero-to-AI in Minutes**: Our bootstrap process sets up everything - database, storage, vector search, and AI models - with a single command. No DevOps expertise required.
3. **Cost-Effective**: Running your own AI infrastructure can be 10x cheaper than cloud services at scale.
4. **Privacy First**: Your data never leaves your servers. Perfect for healthcare, finance, or any privacy-conscious application.
## The One-Command Install
@ -12,7 +24,7 @@ That's literally it. First run triggers auto-bootstrap that:
- Installs PostgreSQL, cache, storage, vector DB
- Downloads AI models
- Creates default bot
- Starts web server
- Starts UI server
Takes 2-5 minutes. Grab coffee. Come back to a running bot.
@ -39,7 +51,7 @@ Downloading embeddings... ✓
Creating database schema... ✓
Generating secure credentials... ✓
Loading bot templates... ✓
Starting web server on :8080
Starting UI server on :8080
```
Everything lands in `botserver-stack/` directory. Fully self-contained.
@ -148,6 +160,28 @@ rm -rf botserver-stack .env
./botserver status
```
## See Also
### Documentation
- [Overview](./overview.md) - Architecture and concepts
- [Quick Start](./quick-start.md) - Get running in 5 minutes
- [Installation](./installation.md) - Detailed setup instructions
- [First Conversation](./first-conversation.md) - Build your first bot
- [Sessions and Channels](./sessions.md) - Multi-user support
- [Chapter 2: Packages](../chapter-02/README.md) - Understanding bot components
### Further Reading - Blog Posts
- [Why We Chose Open Source](https://pragmatismo.cloud/blog/why-pragmatismo-selected-open-source) - Philosophy behind General Bots
- [Escape from BigTech](https://pragmatismo.cloud/blog/escape-from-bigtech) - Breaking free from proprietary AI platforms
- [Cost-Effective Bot Orchestration](https://pragmatismo.cloud/blog/cost-effective-bot-orchestration) - Economic benefits of self-hosting
- [The Hidden Costs of SaaS](https://pragmatismo.cloud/blog/saas-hidden-costs) - Why owning your stack matters
- [LLM Boom Is Over](https://pragmatismo.cloud/blog/llm-boom-is-over) - Focus on practical AI applications
### Next Chapter
Continue to [Chapter 2: About Packages](../chapter-02/README.md) to learn about the template system that makes General Bots so powerful.
- [Chapter 3: Knowledge Base](../chapter-03/README.md) - Document management
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Complete command list
## Container Deployment
Prefer containers? Use LXC mode:

View file

@ -292,7 +292,7 @@ curl http://localhost:8081/v1/models
```bash
# The default bot is automatically deployed to the drive during bootstrap
# Access web interface
# Access UI interface
open http://localhost:8080
```
@ -329,7 +329,7 @@ Default ports used:
| Service | Port | Configure in |
|---------|------|--------------|
| Web Server | 8080 | config.csv: `server_port` |
| UI Server | 8080 | config.csv: `server_port` |
| PostgreSQL | 5432 | DATABASE_URL |
| Drive API | 9000 | DRIVE_SERVER |
| Drive Console | 9001 | N/A |

View file

@ -29,7 +29,7 @@ BotServer uses a modular architecture with these core components:
- **Channel Adapters**: Connects to various messaging platforms
### Service Layer
- **Web Server**: HTTP API and WebSocket connections
- **UI Server**: HTTP API and WebSocket connections
- **Scheduler**: Cron-based task scheduling
- **LLM Integration**: Connects to language models (local or cloud)
- **Authentication**: Directory service integration for user management
@ -86,7 +86,7 @@ BotServer uses a modular architecture with these core components:
## Configuration
Bot configuration is managed through `config.csv` files with parameters like:
- `server_host`, `server_port` - Web server settings
- `server_host`, `server_port` - UI server settings
- `llm-url`, `llm-model` - LLM configuration
- `email-from`, `email-server` - Email settings
- `theme-color1`, `theme-color2`, `theme-title`, `theme-logo` - UI customization
@ -155,7 +155,7 @@ Integrated into existing applications:
# The work/ folder is internal (see .gbapp chapter)
```
4. **Access Web Interface**
4. **Access UI Interface**
```
http://localhost:8080
```

View file

@ -57,7 +57,7 @@ The **automatic bootstrap** process:
5. ✅ Generated secure credentials → `.env` (from blank environment)
6. ✅ Created database schema
7. ✅ Deployed default bots to object storage
8. ✅ Started web server on port 8080
8. ✅ Started UI server on port 8080
**Zero manual configuration required!**

View file

@ -15,7 +15,7 @@ Think of it like a phone call that can pause and resume anytime.
## How Sessions Start
### Web Interface
### UI Interface
1. User opens `http://localhost:8080`
2. Browser gets a session token (UUID)
3. Token stored in localStorage
@ -205,35 +205,15 @@ Default limits (configurable):
## Advanced Features
### Session Handoff
Transfer conversation between channels:
```basic
' Start on web
TRANSFER_SESSION "email"
' Continue via email
```
### Session Persistence
Sessions persist across server restarts by default through the cache layer. The session state is automatically restored when users reconnect.
### Session Merge
Combine anonymous session with login:
### Session Context
Each session maintains its own context for knowledge base and tool usage:
```basic
ON LOGIN
MERGE_SESSION anonymous_id, user_id
END
```
### Session Export
Download conversation history:
```basic
history = GET "session.history"
SAVE "conversation.txt", history
```
### Session Templates
Pre-configure sessions:
```basic
' In start.bas
LOAD_TEMPLATE "customer_support"
' Sets up context, tools, initial message
' Each session has isolated context
USE KB "docs"
' Only affects current session
```
## How It Works Automatically
@ -251,13 +231,13 @@ You never need to manage sessions directly - just use the conversation keywords
### Welcome Back
```basic
last_visit = GET_BOT_MEMORY("last_visit_" + session_id)
last_visit = GET BOT MEMORY("last_visit_" + session_id)
if last_visit
TALK "Welcome back! Last seen: " + last_visit
else
TALK "Welcome! First time here?"
end
SET_BOT_MEMORY "last_visit_" + session_id, NOW()
SET BOT MEMORY "last_visit_" + session_id, NOW()
```
### Progressive Disclosure
@ -272,16 +252,10 @@ else
end
```
### Session Persistence
### Multi-User Support
```basic
' Save progress
SET checkpoint = "step_3_complete"
' Later, restore progress
GET checkpoint
if checkpoint == "step_3_complete"
TALK "Let's continue from step 4"
end
' Each user has their own isolated session
' The system automatically handles user separation
```
## Troubleshooting
@ -303,12 +277,12 @@ end
## Write Once, Run Everywhere
The same BASIC script runs across all channels - web, mobile apps, WhatsApp, Teams, email. Your investment in dialog development pays off everywhere:
The same BASIC script runs across all channels - UI, mobile apps, WhatsApp, Teams, email. Your investment in dialog development pays off everywhere:
```basic
' This same script works on:
' • Web interface
' • Mobile apps (via web view)
' • UI interface
' • Mobile apps (via UI view)
' • WhatsApp Business
' • Microsoft Teams
' • Email conversations

View file

@ -184,9 +184,9 @@ The migration philosophy is to "open hand" (abrir mão) - release control and tr
Example: Instead of 100 lines of intent matching and routing, just:
```basic
' Let LLM understand and respond naturally
answer = LLM "Help the user with their request"
TALK answer
' Let system AI handle conversations naturally
TALK "How can I help you with your request?"
' System AI understands context and responds appropriately
```
## Troubleshooting
@ -217,4 +217,17 @@ TALK answer
- Check `.bas` file syntax
- Verify `start.bas` exists
- Review runtime logs for errors
- Test with simple dialog first
- Test with simple dialog first
## See Also
- [.gbai Architecture](./gbai.md) - Root package structure
- [.gbdialog Dialogs](./gbdialog.md) - BASIC conversation scripts
- [.gbkb Knowledge Base](./gbkb.md) - Document collections
- [.gbot Configuration](./gbot.md) - Bot settings
- [.gbtheme Theming](./gbtheme.md) - UI customization
- [.gbdrive Storage](./gbdrive.md) - File management
- [Bot Templates](./templates.md) - Pre-built examples
- [Chapter 3: Knowledge Base](../chapter-03/README.md) - Advanced KB features
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Complete command list
- [Chapter 7: Configuration](../chapter-07/config-csv.md) - Detailed config options

View file

@ -1,6 +1,6 @@
# .gbdialog Dialogs
The `.gbdialog` package contains BASIC scripts that define conversation flows, tool integrations, and bot behavior.
The [`.gbdialog`](../chapter-02/gbdialog.md) package contains BASIC scripts that define conversation flows, tool integrations, and bot behavior.
## What is .gbdialog?
@ -35,14 +35,15 @@ TALK "Case loaded. You can ask me anything about the case."
### 1. LLM Integration
```basic
' Direct LLM usage for natural conversation
response = LLM "Help the user with their question"
TALK response
' LLM is for background processing only - generates content once for all users
' Example: Generate a summary that all users will see
text = GET "document.pdf"
summary = LLM "Summarize this document: " + text
SET BOT MEMORY "daily_summary", summary
' Context-aware responses
' For interactive conversations, use SET CONTEXT and TALK
SET CONTEXT "user_type" AS "premium customer"
answer = LLM "Provide personalized recommendations"
TALK answer
TALK "How can I help you today?"
```
### 2. Tool Execution
@ -57,41 +58,32 @@ TALK "Registration complete!"
```
### 3. Knowledge Base Usage
See [Knowledge Base documentation](../chapter-03/knowledge-base.md) for details.
```basic
' Activate knowledge base collections
USE KB "products"
USE KB "policies"
' LLM searches these automatically when answering
answer = LLM "Answer based on our product catalog and policies"
TALK answer
' The system AI searches these automatically during conversations
' No LLM command needed - just TALK to the user
TALK "What product information can I help you with?"
```
### 4. Session Management
```basic
' Store session data
SET "user_name", name
SET "preferences", "email notifications"
' Retrieve later
saved_name = GET "user_name"
TALK "Welcome back, " + saved_name
```
## Script Structure
### Entry Point: start.bas
Every bot needs a `start.bas` file:
Every bot needs a `start.bas` file in the [`.gbdialog`](../chapter-02/gbdialog.md) folder:
```basic
' Minimal start script - let LLM handle everything
' Minimal start script - let system AI handle conversations
USE KB "company_docs"
response = LLM "Welcome the user and offer assistance"
TALK response
TALK "Welcome! How can I assist you today?"
```
### Tool Definitions
Create separate `.bas` files for each tool:
Create separate `.bas` files for each tool. See [KB and Tools](../chapter-03/kb-and-tools.md) for more information:
```basic
' enrollment.bas - The LLM knows when to use this
@ -107,9 +99,9 @@ TALK "Enrolled successfully!"
### 1. Minimal Logic
```basic
' Good - Let LLM handle the conversation
answer = LLM "Process the user's request appropriately"
TALK answer
' Good - Let system AI handle the conversation naturally
TALK "How can I help you?"
' System AI understands context and responds appropriately
' Avoid - Don't micromanage the flow
' IF user_says_this THEN do_that...
@ -125,33 +117,33 @@ DESCRIPTION "This tool books appointments for customers"
```basic
' Provide context, not rules
SET CONTEXT "business_hours" AS "9AM-5PM weekdays"
response = LLM "Inform about availability"
' LLM naturally understands to mention hours when relevant
TALK "When would you like to schedule?"
' System AI naturally understands to mention hours when relevant
```
### 4. Trust the LLM
### 4. Trust the System AI
```basic
' Simple prompt, sophisticated behavior
answer = LLM "Be a helpful customer service agent"
' LLM handles greetings, questions, complaints naturally
' The system AI handles conversations naturally
TALK "Hello! I'm here to help."
' System handles greetings, questions, complaints naturally
```
## Common Patterns
### Document Summarization (from announcements.gbai)
### Document Summarization - Background Processing (from announcements.gbai)
```basic
' Schedule automatic updates
' Schedule automatic updates - runs in background
SET SCHEDULE "59 * * * *"
' Fetch and summarize documents
' Fetch and summarize documents ONCE for all users
let text = GET "announcements.gbkb/news/news.pdf"
let resume = LLM "In a few words, resume this: " + text
SET BOT MEMORY "resume", resume
SET BOT MEMORY "resume", resume ' Stored for all users
```
### Interactive Case Analysis (from law.gbai)
### Interactive Case Analysis - User Conversations (from law.gbai)
```basic
' Ask for case number
' Ask for case number - interactive with user
TALK "What is the case number?"
HEAR cod
@ -159,7 +151,7 @@ HEAR cod
text = GET "case-" + cod + ".pdf"
IF text THEN
' Set context for LLM to use
' Set context for system AI to use in conversation
text = "Based on this document, answer the person's questions:\n\n" + text
SET CONTEXT text
TALK "Case loaded. Ask me anything about it."
@ -183,16 +175,17 @@ TALK "Successfully enrolled " + name
### Multi-Collection Search
```basic
USE KB "products"
USE KB "reviews"
USE KB "reviews"
USE KB "specifications"
answer = LLM "Answer product questions comprehensively"
TALK answer
' System AI searches these collections automatically during conversation
TALK "What would you like to know about our products?"
```
## Advanced Features
### Memory Management
See [Storage documentation](../chapter-09/storage.md) for persistent data options.
```basic
SET BOT MEMORY "company_policy", policy_text
' Available across all sessions
@ -201,13 +194,16 @@ retrieved = GET BOT MEMORY "company_policy"
```
### External APIs
See [External APIs chapter](../chapter-08/external-apis.md) for integration patterns.
```basic
result = GET "https://api.example.com/data"
response = LLM "Interpret this data: " + result
TALK response
' For background processing only
summary = LLM "Summarize this data: " + result
SET BOT MEMORY "api_summary", summary
```
### Suggestions
See [UI Interface](../chapter-04/ui-interface.md) for UI integration.
```basic
ADD SUGGESTION "Schedule Meeting" AS "schedule"
ADD SUGGESTION "View Products" AS "products"
@ -245,12 +241,24 @@ Scripts run in a sandboxed environment with:
' END IF
```
### New Way (LLM Intelligence)
### New Way (System AI Intelligence)
```basic
' DO THIS - Let LLM understand naturally
response = LLM "Handle the customer's order request"
TALK response
' LLM understands context and intent automatically
' DO THIS - Let system AI handle conversation naturally
TALK "How can I help you with your order?"
' System AI understands context and intent automatically
```
The key is to **trust the LLM** and write less code for more intelligent behavior.
The key is to **trust the system AI** and write less code for more intelligent behavior.
## Important Distinction
- **[LLM Command](../chapter-09/ai-llm.md)**: For background/batch processing, generates content ONCE, stored in BOT MEMORY for all users
- **[Interactive Conversations](../chapter-09/conversation.md)**: Use HEAR/TALK/SET CONTEXT, system AI handles the natural conversation flow
## See Also
- [Chapter 1: Quick Start](../chapter-01/quick-start.md) - Getting started with your first bot
- [Chapter 2: Bot Architecture](../chapter-02/README.md) - Understanding all components
- [Chapter 3: Knowledge Base](../chapter-03/knowledge-base.md) - Working with KB collections
- [Chapter 5: Keywords Reference](../chapter-05/README.md) - Complete BASIC command reference
- [Chapter 9: Conversation Flow](../chapter-09/conversation.md) - Advanced dialog patterns

View file

@ -79,6 +79,6 @@ Files have different access levels:
## Storage Backends
- **Object Storage** (default): Self-hosted S3-compatible drive
- **AWS S3**: Cloud object storage
- **S3-compatible storage**: Any S3-compatible object storage (AWS S3, MinIO, Backblaze B2, DigitalOcean Spaces, etc.)
- **Local filesystem**: Development and testing
- **Hybrid**: Multiple backends with fallback

View file

@ -52,7 +52,8 @@ ADD WEBSITE "https://company.com/docs"
### Using Collections
```basic
USE KB "company-policies"
LLM "What is the vacation policy?"
TALK "What would you like to know about company policies?"
' The system AI will search the KB automatically when responding
```
### Multiple Collections

View file

@ -1,6 +1,6 @@
# .gbtheme UI Theming
The `.gbtheme` package provides simple CSS-based theming for the bot's web interface.
The `.gbtheme` package provides simple CSS-based theming for the bot's UI interface.
## What is .gbtheme?
@ -141,13 +141,8 @@ IF preference <> "" THEN
CHANGE THEME preference
END IF
' Time-based themes
hour = GET TIME "hour"
IF hour >= 18 OR hour < 6 THEN
CHANGE THEME "dark"
ELSE
CHANGE THEME "default"
END IF
' Theme selection based on user preferences
' System handles theme switching automatically
```
## Integration with config.csv

View file

@ -179,9 +179,9 @@ Instead of complex dialog flows, use simple LLM calls:
```basic
' Traditional: 100+ lines of intent matching
' BotServer: Let LLM handle it
response = LLM prompt
TALK response
' BotServer: Let system AI handle it naturally
TALK "How can I assist you?"
' System AI understands and responds appropriately
```
#### Tool Creation

View file

@ -21,4 +21,17 @@ CLEAR KB "policies"
CLEAR KB
```
The vector database retrieves relevant chunks/excerpts from active KBs and injects them into LLM prompts automatically, providing context-aware responses.
The vector database retrieves relevant chunks/excerpts from active KBs and makes them available to the system AI automatically, providing context-aware responses during conversations.
## See Also
- [KB and Tools System](./kb-and-tools.md) - Complete reference for knowledge bases and tools
- [Vector Collections](./vector-collections.md) - How vector search works
- [Document Indexing](./indexing.md) - Automatic document processing
- [Semantic Search](./semantic-search.md) - Meaning-based retrieval
- [Context Compaction](./context-compaction.md) - Managing conversation context
- [Caching](./caching.md) - Performance optimization
- [Chapter 2: Packages](../chapter-02/README.md) - Understanding bot components
- [Chapter 5: BASIC Keywords](../chapter-05/README.md) - Complete command reference
- [Chapter 7: Configuration](../chapter-07/config-csv.md) - Bot configuration options
- [Chapter 9: Knowledge Base](../chapter-09/knowledge-base.md) - Advanced KB patterns

View file

@ -46,6 +46,21 @@ Exchange 5: Compaction triggers - only exchanges 3-4 kept
Exchange 6: Only exchanges 4-5 in context
```
### Visual Flow Diagram
<!-- TODO: Add SVG diagram showing context compaction process -->
```
[Conversation History]
[Check Exchange Count]
[Exceeds prompt-compact?]
├─ No → [Keep All]
└─ Yes → [Keep Last prompt-history Exchanges]
[Continue Conversation]
```
## Benefits
- **Automatic management** - No manual intervention needed

View file

@ -109,10 +109,8 @@ SET SCHEDULE "0 1 * * *"
' Update news daily
ADD WEBSITE "https://company.com/news"
' Update product docs weekly
IF DAY_OF_WEEK = "Monday" THEN
ADD WEBSITE "https://company.com/products"
END IF
' Update product docs on schedule
ADD WEBSITE "https://company.com/products"
```
## Best Practices

View file

@ -99,8 +99,9 @@ DESCRIPTION "Get current weather for a location"
' Tool implementation
weather_data = GET "https://api.weather.com/v1/current?location=" + location
result = LLM "Format this weather data nicely: " + weather_data
TALK result
' System AI will format and present the data naturally
SET CONTEXT "weather_data", weather_data
TALK "Here's the current weather for " + location
```
### Tool Registration
@ -140,7 +141,7 @@ CLEAR TOOLS
1. **Session Start** - Clean slate, no KB or tools
2. **Load Resources** - USE KB and USE TOOL as needed
3. **Active Use** - LLM uses loaded resources
4. **Clear Resources** - CLEAR_KB/CLEAR_TOOLS when done
4. **Clear Resources** - CLEAR KB/CLEAR TOOLS when done
5. **Session End** - Automatic cleanup
### Best Practices
@ -177,66 +178,6 @@ CLEAR TOOLS
---
## API Integration
### REST Endpoints
```http
# Load KB
POST /api/kb/load
{
"session_id": "xxx",
"kb_name": "circular"
}
# Clear KB
POST /api/kb/clear
{
"session_id": "xxx"
}
# Load Tool
POST /api/tools/load
{
"session_id": "xxx",
"tool_name": "weather"
}
# Clear Tools
POST /api/tools/clear
{
"session_id": "xxx"
}
```
### WebSocket Commands
```javascript
// Load KB
ws.send({
type: "USE_KB",
kb_name: "circular"
});
// Clear KB
ws.send({
type: "CLEAR_KB"
});
// Load Tool
ws.send({
type: "USE TOOL",
tool_name: "weather"
});
// Clear Tools
ws.send({
type: "CLEAR_TOOLS"
});
```
---
## Implementation Details
### Vector Database
@ -290,12 +231,7 @@ Configuration:
| `TOOL_EXECUTION_ERROR` | Tool failed to execute | Check tool endpoint/logic |
| `MEMORY_LIMIT` | Too many KBs loaded | Clear unused KBs |
### Debugging
Enable debug logging:
```bash
RUST_LOG=debug cargo run
```
Check logs for:
- KB loading progress
@ -312,47 +248,47 @@ Check logs for:
```basic
# Load product documentation
USE_KB "product_docs"
USE_KB "faqs"
USE KB "product_docs"
USE KB "faqs"
# Enable support tools
USE TOOL "ticket_system"
USE TOOL "knowledge_search"
# Bot now has access to docs and can work with tickets
HEAR user_question
# ... process with KB context and tools ...
# System AI now has access to docs and can work with tickets
TALK "How can I help you with your support needs today?"
# System AI automatically searches KB and uses tools when responding
# Clean up after session
CLEAR_KB
CLEAR_TOOLS
CLEAR KB
CLEAR TOOLS
```
### Research Assistant
```basic
# Load research papers
USE_KB "papers_2024"
USE_KB "citations"
USE KB "papers_2024"
USE KB "citations"
# Enable research tools
USE TOOL "arxiv_search"
USE TOOL "citation_formatter"
# Assistant can now search papers and format citations
# ... research session ...
# System AI can now search papers and format citations
TALK "What research topic would you like to explore?"
# Switch to different topic
CLEAR_KB
USE_KB "papers_biology"
CLEAR KB
USE KB "papers_biology"
```
### Enterprise Integration
```basic
# Load company policies
USE_KB "hr_policies"
USE_KB "it_procedures"
USE KB "hr_policies"
USE KB "it_procedures"
# Enable enterprise tools
USE TOOL "active_directory"
@ -363,8 +299,8 @@ USE TOOL "slack_notifier"
# ... handle employee request ...
# End of shift cleanup
CLEAR_KB
CLEAR_TOOLS
CLEAR KB
CLEAR TOOLS
```
---
@ -397,50 +333,6 @@ CLEAR_TOOLS
## Configuration
Configuration is handled automatically through `config.csv`. No manual environment variables needed.
<old_text line=473>
- [ ] Tool versioning system
- [ ] Enhanced parallel execution
### Platform Expansion
- [ ] More language bindings
- [ ] Additional databases
- [ ] Extended file formats
TOOL_RATE_LIMIT=100
# KB
MAX_KB_PER_SESSION=5
MAX_KB_SIZE_MB=500
KB_SCAN_INTERVAL=3600
```
### Configuration File
```toml
# botserver.toml
[kb]
enabled = true
max_per_session = 5
embedding_model = "text-embedding-ada-002"
chunk_size = 1000
chunk_overlap = 200
[tools]
enabled = true
max_per_session = 10
timeout = 30
rate_limit = 100
sandbox = true
[vectordb]
provider = "vector"
url = "http://localhost:6333"
collection_prefix = "botserver_"
```
---
## Troubleshooting
### KB Issues
@ -493,4 +385,23 @@ collection_prefix = "botserver_"
---
## See Also
### Documentation
- [Vector Collections](./vector-collections.md) - How vector search works
- [Document Indexing](./indexing.md) - Automatic document processing
- [Semantic Search](./semantic-search.md) - Meaning-based retrieval
- [Context Compaction](./context-compaction.md) - Managing conversation context
- [Caching](./caching.md) - Performance optimization
- [Chapter 6: BASIC Reference](../chapter-06-gbdialog/README.md) - Dialog scripting
- [Chapter 9: API and Tools](../chapter-09-api/README.md) - Tool integration
### Further Reading - Blog Posts
- [BASIC LLM Tools](https://pragmatismo.cloud/blog/basic-llm-tools) - Extending LLMs with tools
- [MCP is the new API](https://pragmatismo.cloud/blog/mcp-is-the-new-api) - Modern tool integration
- [Beyond Chatbots](https://pragmatismo.cloud/blog/beyond-chatbots) - Using knowledge bases effectively
### Next Chapter
Continue to [Chapter 4: User Interface](../chapter-04-gbui/README.md) to learn about creating bot interfaces.

View file

@ -1,14 +1,14 @@
# Semantic Search
Semantic search in BotServer happens automatically when you use `USE KB`. The system searches for relevant information based on meaning, not just keywords, and injects it into the LLM's context.
Semantic search in BotServer happens automatically when you use `USE KB`. The system searches for relevant information based on meaning, not just keywords, and makes it available to the system AI during conversations.
## How It Works Automatically
1. **User asks a question** - Natural language input
2. **Query converted to vector** - Using the embedding model
3. **Search active collections** - Finds semantically similar content
4. **Inject into context** - Relevant chunks added to LLM prompt
5. **Generate response** - LLM answers using the knowledge
4. **Inject into context** - Relevant chunks provided to system AI
5. **Generate response** - System AI answers using the knowledge
## Activating Semantic Search
@ -21,7 +21,7 @@ USE KB "procedures"
' No explicit search commands needed
```
When users ask questions, the system automatically searches these collections and provides relevant context to the LLM.
When users ask questions, the system automatically searches these collections and provides relevant context to the system AI.
## How Meaning-Based Search Works
@ -42,7 +42,7 @@ prompt-history,2 # How many previous messages to include
prompt-compact,4 # Compact context after N exchanges
```
These settings manage how much context the LLM receives, not the search itself.
These settings manage how much context the system AI receives, not the search itself.
## Multiple Collections

View file

@ -4,7 +4,7 @@ This chapter explains how GeneralBots manages knowledgebase collections, inde
| Document | File | Description |
|----------|------|-------------|
| **README** | [README.md](README.md) | Highlevel reference for the `.gbkb` package and its core commands (`USE_KB`, `CLEAR_KB`, `ADD_WEBSITE`). |
| **README** | [README.md](README.md) | Highlevel reference for the `.gbkb` package and its core commands (`USE KB`, `CLEAR KB`, `ADD WEBSITE`). |
| **Caching** | [caching.md](caching.md) | Optional inmemory and persistent SQLite caching to speed up frequent `FIND` queries. |
| **Context Compaction** | [context-compaction.md](context-compaction.md) | Techniques to keep the LLM context window within limits (summarization, memory pruning, sliding window). |
| **Indexing** | [indexing.md](indexing.md) | Process of extracting, chunking, embedding, and storing document vectors in the VectorDB. |

View file

@ -0,0 +1,97 @@
# Chapter 04: .gbui User Interface Reference
The `.gbui` (General Bots User Interface) file format provides HTML-based templates for bot interfaces. These files create conversational experiences that work across web, desktop, and mobile platforms.
## Available Templates
General Bots includes two built-in UI templates located in `ui/desktop/`:
### 1. default.gbui
Full-featured interface with multiple applications:
- Chat, Drive, Tasks, and Mail integration
- Theme selector with dark mode
- Keyboard shortcuts (Alt+1 through Alt+4)
- Responsive design for all screen sizes
- WebSocket real-time communication
### 2. single.gbui
Minimalist chat-only interface:
- Clean, focused conversation view
- Fast loading (< 50KB total)
- Auto dark mode support
- Perfect for embedding or kiosks
- Mobile-optimized touch targets
## How .gbui Files Work
Each .gbui file is a complete HTML document with:
- **Structure**: Standard HTML5 markup
- **Styling**: Embedded CSS or theme integration
- **Behavior**: JavaScript for WebSocket communication
- **Responsiveness**: Media queries for different screens
The bot server automatically serves the appropriate .gbui file based on:
- User device (desktop/mobile detection)
- Configuration in config.csv
- URL parameters (e.g., `?ui=single`)
## Choosing a Template
### Use default.gbui when:
- Building a full workspace application
- Users need file management (Drive)
- Task tracking is required
- Email integration is needed
- Desktop is the primary platform
### Use single.gbui when:
- Creating a simple chatbot
- Embedding in existing websites
- Optimizing for mobile devices
- Building kiosk interfaces
- Minimizing load time is critical
## Creating Custom Templates
To create your own .gbui file:
1. Copy an existing template as a starting point
2. Modify the HTML structure
3. Adjust CSS styles
4. Update JavaScript behavior
5. Save to `ui/desktop/custom.gbui`
The bot automatically detects new .gbui files on restart.
## Other UI Files
Besides .gbui templates, the ui folder contains:
- `index.html` - Original HTML interface (kept for compatibility)
- `account.html` - User account settings page
- `settings.html` - Application settings page
- Supporting folders: `/css`, `/js`, `/chat`, `/drive`, `/tasks`, `/mail`
## Console Mode
For terminal users, General Bots also provides a console interface (not a .gbui file):
- Text-based UI using terminal capabilities
- Keyboard-driven navigation
- Works over SSH connections
- See [Console Mode](./console-mode.md) for details
## See Also
### Documentation
- [default.gbui](./default-gbui.md) - Full desktop interface details
- [single.gbui](./single-gbui.md) - Minimalist chat interface
- [Console Mode](./console-mode.md) - Terminal-based interface
- [Chapter 5: CSS Theming](../chapter-05-gbtheme/README.md) - Style your interfaces
- [Chapter 6: BASIC Dialogs](../chapter-06-gbdialog/README.md) - Connect conversations to UI
### Further Reading - Blog Posts
- [No Forms](https://pragmatismo.cloud/blog/no-forms) - Why conversational UI is the future
- [Beyond Chatbots](https://pragmatismo.cloud/blog/beyond-chatbots) - Rich interaction patterns
### Next Chapter
Continue to [Chapter 5: CSS Theming](../chapter-05-gbtheme/README.md) to learn how to style your .gbui interfaces.

View file

@ -0,0 +1,174 @@
# default.gbui - Full Desktop Interface
The `default.gbui` template provides a complete desktop interface with multiple integrated applications for web, desktop, and mobile platforms.
## Overview
Location: `ui/desktop/default.gbui`
The default template includes:
- Multi-application layout (Chat, Drive, Tasks, Mail)
- Responsive design for all screen sizes
- Theme selector with dark mode support
- WebSocket real-time communication
- Keyboard shortcuts for power users
## Features
### Applications
1. **Chat** - Main conversational interface
- Rich text messages
- File attachments
- Voice input
- Typing indicators
- Message history
2. **Drive** - File management
- Browse and upload files
- Preview documents
- Share with chat
3. **Tasks** - Task tracking
- Create and manage tasks
- Due dates and priorities
- Integration with chat
4. **Mail** - Email integration
- Send/receive through bot
- AI-powered composition
- Thread management
### Navigation
- **Header Bar**: Logo, app selector, theme switcher, user menu
- **App Grid**: Quick access to all applications
- **Keyboard Shortcuts**:
- `Alt+1` → Chat
- `Alt+2` → Drive
- `Alt+3` → Tasks
- `Alt+4` → Mail
- `Esc` → Close menus
## Responsive Design
### Desktop (>1024px)
- Full multi-panel layout
- Persistent navigation
- Side-by-side applications
### Tablet (768-1024px)
- Collapsible sidebar
- Touch-optimized controls
- Adaptive layouts
### Mobile (<768px)
- Single column layout
- Bottom navigation
- Swipe gestures
- Large touch targets
## Theme Integration
Automatically applies styles from active `.gbtheme`:
```css
:root {
--gb-primary: /* from theme */
--gb-background: /* from theme */
--gb-text: /* from theme */
}
```
## WebSocket Communication
Built-in real-time messaging:
```javascript
// Auto-connects on load
const ws = new WebSocket('ws://localhost:8080/ws');
// Handles reconnection
ws.onclose = () => {
// Automatic reconnect logic
};
```
## Customization
### Modify Applications
Edit the app grid in the template:
```html
<div class="app-grid">
<a href="#chat" data-section="chat">Chat</a>
<a href="#drive" data-section="drive">Drive</a>
<!-- Add your custom apps here -->
</div>
```
### Change Default Theme
Update theme selector options:
```html
<select class="gb-theme-selector">
<option value="default">Default</option>
<option value="dark">Dark</option>
<!-- Add custom themes -->
</select>
```
## Usage
### As Desktop App
Used automatically when running with `--desktop`:
```bash
./botserver --desktop
# Opens default.gbui in native window
```
### As Web Interface
Default template for browser access:
```bash
./botserver
# Browse to http://localhost:8080
# Loads default.gbui
```
### As Mobile PWA
Install as Progressive Web App:
1. Open in mobile browser
2. Add to home screen
3. Launches as app
## Performance
- **Initial Load**: < 200KB
- **WebSocket Latency**: < 50ms
- **Touch Response**: 60fps animations
- **Offline Support**: Service worker caching
## Browser Support
- Chrome/Edge 90+
- Firefox 88+
- Safari 14+
- Mobile browsers (iOS Safari, Chrome Mobile)
## See Also
- [single.gbui](./single-gbui.md) - Minimal chat interface
- [Console Mode](./console-mode.md) - Terminal interface
- [Chapter 5: Themes](../chapter-05-gbtheme/README.md) - Styling the interface
- [Chapter 6: BASIC](../chapter-06-gbdialog/README.md) - Dialog scripting
## Next Step
For a simpler interface, see [single.gbui](./single-gbui.md).

View file

@ -0,0 +1,220 @@
# single.gbui - Simplified Chat Interface
The `single.gbui` template provides a streamlined, single-page chat interface focused on conversation without distractions.
## Overview
Location: `ui/desktop/single.gbui`
A minimalist chat interface that includes:
- Clean, focused chat experience
- WebSocket real-time messaging
- Dark mode support
- Mobile-responsive design
- Fast loading (< 50KB)
## Features
### Core Components
1. **Header**
- Bot name and status
- Connection indicator
- Minimal branding
2. **Messages Area**
- Auto-scrolling message list
- User/bot message distinction
- Timestamps
- Smooth animations
3. **Input Area**
- Single-line text input
- Send button
- Enter key support
- Auto-focus on load
4. **Typing Indicator**
- Three-dot animation
- Shows bot processing
## Design Philosophy
- **Minimalism**: No unnecessary UI elements
- **Speed**: Loads instantly, works on slow connections
- **Accessibility**: Keyboard navigation, screen reader support
- **Clarity**: Clear visual hierarchy
## Responsive Behavior
### Desktop
- Centered 800px max-width container
- Comfortable reading width
- Ample whitespace
### Mobile
- Full-width layout
- Larger touch targets (44px minimum)
- Bottom-aligned input
- Virtual keyboard aware
## Styling
Uses minimal inline CSS for maximum performance:
```css
/* Core styles only */
body {
font-family: system-ui, -apple-system, sans-serif;
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
}
.chat-container {
flex: 1;
display: flex;
flex-direction: column;
max-width: 800px;
margin: 0 auto;
width: 100%;
}
```
## Dark Mode
Automatic dark mode based on system preference:
```css
@media (prefers-color-scheme: dark) {
:root {
--background: #111827;
--text: #f9fafb;
--message-bot: #374151;
}
}
```
## WebSocket Integration
Simplified connection handling:
```javascript
const ws = new WebSocket('ws://localhost:8080/ws');
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
addMessage(data.content, 'bot');
};
function sendMessage() {
const message = input.value.trim();
if (message) {
ws.send(JSON.stringify({
type: 'message',
content: message
}));
addMessage(message, 'user');
input.value = '';
}
}
```
## Use Cases
### Embedded Widget
Perfect for embedding in existing websites:
```html
<iframe src="http://localhost:8080/ui/desktop/single.gbui"
width="400"
height="600">
</iframe>
```
### Kiosk Mode
Ideal for public terminals:
- No navigation elements
- Focus on conversation
- Easy to reset
### Mobile-First
Optimized for mobile devices:
- Fast loading
- Minimal data usage
- Touch-friendly
## Customization
### Change Colors
Edit the CSS variables:
```css
:root {
--primary: #3b82f6; /* Your brand color */
--background: #ffffff; /* Background */
--text: #1f2937; /* Text color */
}
```
### Modify Welcome Message
Update the initial bot message:
```html
<div class="message bot">
<div class="message-content">
Your custom welcome message here
</div>
</div>
```
### Add Logo
Insert a logo in the header:
```html
<header class="header">
<img src="logo.png" alt="Logo" height="32">
<span>Bot Name</span>
</header>
```
## Performance
- **First Paint**: < 100ms
- **Interactive**: < 200ms
- **Total Size**: < 50KB
- **No External Dependencies**: Everything inline
## Accessibility
- Semantic HTML structure
- ARIA labels on interactive elements
- Keyboard navigation support
- Focus management
- High contrast mode support
## Browser Support
Works on all modern browsers:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- Mobile browsers
Even degrades gracefully on older browsers.
## See Also
- [default.gbui](./default-gbui.md) - Full-featured interface
- [Console Mode](./console-mode.md) - Terminal interface
- [Chapter 5: Themes](../chapter-05-gbtheme/README.md) - Custom styling
- [Chapter 6: BASIC](../chapter-06-gbdialog/README.md) - Dialog scripting
## Next Step
For terminal users, see [Console Mode](./console-mode.md).

View file

@ -1,50 +0,0 @@
# CSS Customization
The **gbtheme** CSS files define the visual style of the bot UI. They are split into three layers to make them easy to extend.
## Files
| File | Role |
|------|------|
| `main.css` | Core layout, typography, and global variables. |
| `components.css` | Styles for reusable UI components (buttons, cards, modals). |
| `responsive.css` | Media queries for mobile, tablet, and desktop breakpoints. |
## CSS Variables (in `main.css`)
```css
:root {
--primary-color: #2563eb;
--secondary-color: #64748b;
--background-color: #ffffff;
--text-color: #1e293b;
--border-radius: 8px;
--spacing-unit: 8px;
}
```
Changing a variable updates the entire theme without editing individual rules.
## Extending the Theme
1. **Add a new variable** Append to `:root` and reference it in any selector.
2. **Override a component** Duplicate the selector in `components.css` after the original definition; the later rule wins.
3. **Create a dark mode** Add a `@media (prefers-color-scheme: dark)` block that redefines the variables.
```css
@media (prefers-color-scheme: dark) {
:root {
--primary-color: #3b82f6;
--background-color: #111827;
--text-color: #f9fafb;
}
}
```
## Best Practices
* Keep the file size small avoid large image data URIs; store images in `assets/`.
* Use `rem` units for font sizes; they scale with the root `font-size`.
* Limit the depth of nesting; flat selectors improve performance.
All CSS files are loaded in `index.html` in the order: `main.css`, `components.css`, `responsive.css`.

View file

@ -1,357 +0,0 @@
# Desktop Mode & Mobile Apps
BotServer includes a complete desktop interface and mobile app support for rich conversational experiences beyond simple chat.
## Overview
Desktop mode (`--desktop`) transforms BotServer into a full-featured workspace with integrated tools for communication, collaboration, and productivity.
## Launching Desktop Mode
```bash
# Start BotServer in desktop mode
./botserver --desktop
# With custom port
./botserver --desktop --port 8080
# Mobile-optimized interface
./botserver --mobile
```
## Desktop Components
### Chat Interface (`/chat`)
The main conversational interface with enhanced features:
- Multi-session support
- File attachments and sharing
- Rich media rendering
- Conversation history
- Quick actions and suggestions
- Voice input/output
- Screen sharing capabilities
### Attendant (`/attendant`)
AI-powered personal assistant features:
- Calendar integration
- Task management
- Reminders and notifications
- Meeting scheduling
- Contact management
- Email summaries
- Daily briefings
### Drive Integration (`/drive`)
File management and storage interface:
- Browse object storage buckets
- Upload/download files
- Share documents with chat
- Preview documents
- Organize bot resources
- Version control for files
- Collaborative editing support
### Mail Client (`/mail`)
Integrated email functionality:
- Send/receive emails through bots
- AI-powered email composition
- Smart inbox filtering
- Email-to-task conversion
- Automated responses
- Template management
- Thread summarization
### Meeting Room (`/meet`)
Video conferencing and collaboration:
- WebRTC-based video calls
- Screen sharing
- Recording capabilities
- AI meeting notes
- Real-time transcription
- Meeting bot integration
- Calendar sync
### Task Management (`/tasks`)
Project and task tracking:
- Kanban boards
- Sprint planning
- Time tracking
- Bot automation for tasks
- Progress reporting
- Team collaboration
- Integration with chat
### Account Settings (`/account.html`)
User profile and preferences:
- Profile management
- Authentication settings
- API keys management
- Subscription details
- Usage statistics
- Privacy controls
- Data export
### System Settings (`/settings.html`)
Application configuration:
- Theme customization
- Language preferences
- Notification settings
- Bot configurations
- Integration settings
- Performance tuning
- Debug options
## Mobile Application
### Progressive Web App (PWA)
BotServer desktop mode works as a PWA:
- Install on mobile devices
- Offline capabilities
- Push notifications
- Native app experience
- Responsive design
- Touch-optimized UI
### Mobile Features
- Swipe gestures for navigation
- Voice-first interaction
- Location sharing
- Camera integration
- Contact integration
- Mobile-optimized layouts
- Reduced data usage mode
### Installation on Mobile
#### Android
1. Open BotServer URL in Chrome
2. Tap "Add to Home Screen"
3. Accept installation prompt
4. Launch from home screen
#### iOS
1. Open in Safari
2. Tap Share button
3. Select "Add to Home Screen"
4. Name the app and add
## Desktop Interface Structure
```
web/desktop/
├── index.html # Main desktop dashboard
├── account.html # User account management
├── settings.html # Application settings
├── chat/ # Chat interface components
├── attendant/ # AI assistant features
├── drive/ # File management
├── mail/ # Email client
├── meet/ # Video conferencing
├── tasks/ # Task management
├── css/ # Stylesheets
├── js/ # JavaScript modules
└── public/ # Static assets
```
## Features by Screen
### Dashboard (index.html)
- Widget-based layout
- Quick access tiles
- Recent conversations
- Pending tasks
- Calendar view
- System notifications
- Bot status indicators
### Chat Screen
- Conversation list
- Message composer
- Rich text formatting
- Code syntax highlighting
- File attachments
- Emoji picker
- Message reactions
- Thread support
### Drive Screen
- File browser
- Folder navigation
- Upload queue
- Preview pane
- Sharing controls
- Storage metrics
- Search functionality
### Mail Screen
- Inbox/Sent/Drafts
- Message composer
- Rich HTML editor
- Attachment handling
- Contact autocomplete
- Filter and labels
- Bulk operations
## Responsive Design
### Breakpoints
```css
/* Mobile: < 768px */
/* Tablet: 768px - 1024px */
/* Desktop: > 1024px */
/* Wide: > 1440px */
```
### Adaptive Layouts
- Mobile: Single column, bottom navigation
- Tablet: Two-column with collapsible sidebar
- Desktop: Three-column with persistent panels
- Wide: Multi-panel with docked windows
## Theming
### CSS Variables
```css
:root {
--primary-color: #0d2b55;
--secondary-color: #fff9c2;
--background: #ffffff;
--text-color: #333333;
--border-color: #e0e0e0;
}
```
### Dark Mode
Automatic dark mode based on:
- System preferences
- Time of day
- User selection
- Per-component overrides
## Performance
### Optimization Strategies
- Lazy loading of components
- Virtual scrolling for long lists
- Image optimization and CDN
- Code splitting by route
- Service worker caching
- WebAssembly for compute tasks
### Resource Management
- Maximum 50MB cache size
- Automatic cleanup of old data
- Compressed asset delivery
- Efficient WebSocket usage
- Battery-aware processing
## Security
### Authentication
- OAuth2/OIDC support
- Biometric authentication (mobile)
- Session management
- Secure token storage
- Auto-logout on inactivity
### Data Protection
- End-to-end encryption for sensitive data
- Local storage encryption
- Secure WebSocket connections
- Content Security Policy
- XSS protection
## Offline Capabilities
### Service Worker
- Cache-first strategy for assets
- Network-first for API calls
- Background sync for messages
- Offline message queue
- Automatic retry logic
### Local Storage
- IndexedDB for structured data
- localStorage for preferences
- Cache API for resources
- File system access (desktop)
## Integration APIs
### JavaScript SDK
```javascript
// Initialize desktop mode
const desktop = new BotDesktop({
server: 'ws://localhost:8080',
theme: 'auto',
modules: ['chat', 'drive', 'mail']
});
// Subscribe to events
desktop.on('message', (msg) => {
console.log('New message:', msg);
});
// Send commands
desktop.chat.send('Hello from desktop!');
```
## Debugging
### Developer Tools
- Console logging levels
- Network request inspector
- WebSocket frame viewer
- Performance profiler
- Memory leak detector
- Component tree inspector
### Debug Mode
```bash
# Enable debug mode
./botserver --desktop --debug
# Verbose logging
./botserver --desktop --verbose
```
## Deployment
### Web Server Configuration
```nginx
location /desktop {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
```
### CDN Setup
- Static assets on CDN
- Dynamic content from server
- Geographic distribution
- Cache invalidation strategy
## Troubleshooting
### Common Issues
1. **Blank screen on load**
- Check JavaScript console
- Verify WebSocket connection
- Clear browser cache
2. **Slow performance**
- Reduce active modules
- Clear local storage
- Check network latency
3. **PWA not installing**
- Ensure HTTPS connection
- Valid manifest.json
- Service worker registered
## Summary
Desktop mode transforms BotServer from a simple chatbot platform into a comprehensive AI-powered workspace. With mobile PWA support, users can access all features from any device while maintaining a consistent, responsive experience.

View file

@ -1,71 +0,0 @@
# HTML Templates
The **gbtheme** HTML files provide the markup for the bots UI. They are deliberately minimal to allow easy customization.
## index.html
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>GeneralBots Chat</title>
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/components.css">
<link rel="stylesheet" href="css/responsive.css">
</head>
<body>
<header class="app-header">
<h1>GeneralBots</h1>
</header>
<main id="chat-container"></main>
<footer class="app-footer">
<p>&copy; 2025 GeneralBots</p>
</footer>
<script src="js/websocket.js"></script>
<script src="js/app.js"></script>
</body>
</html>
```
*Loads the CSS layers and the JavaScript modules.*
## chat.html
```html
<div class="chat-window">
<div id="messages" class="messages"></div>
<div class="input-area">
<input id="user-input" type="text" placeholder="Type a message…" autocomplete="off"/>
<button id="send-btn">Send</button>
</div>
<div id="typing-indicator" class="typing"></div>
</div>
```
*Used by `app.js` to render the conversation view.*
## login.html
```html
<div class="login-form">
<h2>Login</h2>
<input id="username" type="text" placeholder="Username"/>
<input id="password" type="password" placeholder="Password"/>
<button id="login-btn">Login</button>
</div>
```
*Optional page displayed when the bot requires authentication.*
## Customization Tips
* Replace the `<header>` content with your brand logo.
* Add additional `<meta>` tags (e.g., Open Graph) in `index.html`.
* Insert extra `<script>` tags for analytics or feature flags.
* Use the `assets/` folder to store images referenced via `<img src="assets/images/logo.png">`.
All HTML files are located under the themes `web/` directory and are referenced by the server based on the `.gbtheme` configuration in `config.csv`.

View file

@ -1,38 +0,0 @@
# Theme Structure
The **gbtheme** package follows a conventional layout that separates concerns between markup, styling, scripts, and assets.
```
theme-name.gbtheme/
├── web/
│ ├── index.html # Main application shell
│ ├── chat.html # Conversation UI
│ └── login.html # Authentication page
├── css/
│ ├── main.css # Core styles
│ ├── components.css # UI component styling
│ └── responsive.css # Mediaquery breakpoints
├── js/
│ ├── app.js # Frontend logic, WebSocket handling
│ └── websocket.js # Realtime communication layer
└── assets/
├── images/
├── fonts/
└── icons/
```
### Design Principles
* **Separation of concerns** HTML defines structure, CSS defines appearance, JS defines behavior.
* **Custom properties** `css/variables.css` (included in `main.css`) provides theme colors, spacing, and radius that can be overridden perbot.
* **Responsive** `responsive.css` uses mobilefirst breakpoints (`@media (min-width: 768px)`) to adapt the layout.
* **Asset locality** All images, fonts, and icons are stored under `assets/` to keep the theme selfcontained and portable.
### Extending a Theme
1. Duplicate an existing theme folder (e.g., `default.gbtheme``mybrand.gbtheme`).
2. Edit `css/main.css` to change colors via the `:root` variables.
3. Replace `web/index.html` header/footer with brandspecific markup.
4. Add new icons to `assets/icons/` and reference them in the HTML.
The system automatically picks up any theme placed under `@/templates/…` when the bots configuration (`.gbtheme` entry in `config.csv`) points to the folder name.

View file

@ -1,162 +0,0 @@
# Web Interface
The **gbtheme** web interface provides the front-end experience for end users through a simple REST API architecture.
## Interface Components
| Component | Purpose |
|-----------|---------|
| Chat UI | Main conversation interface with input and message display |
| REST API | HTTP endpoints for message exchange |
| CSS Theme | Visual customization through CSS variables |
## REST API Endpoints
The bot communicates through standard HTTP REST endpoints:
```
POST /api/message Send user message
GET /api/session Get session info
POST /api/upload Upload files
GET /api/history Get conversation history
```
## Message Flow
1. **User Input** - User types message in chat interface
2. **API Call** - Frontend sends POST to `/api/message`
3. **Processing** - Server processes with LLM and tools
4. **Response** - JSON response with bot message
5. **Display** - Frontend renders response in chat
## Simple Integration
```javascript
// Send message to bot
async function sendMessage(text) {
const response = await fetch('/api/message', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message: text })
});
const data = await response.json();
displayMessage(data.response);
}
```
## Theme Customization
The interface uses CSS variables for easy customization:
```css
/* In your theme's default.css */
:root {
--primary-color: #0d2b55;
--secondary-color: #fff9c2;
--background: #ffffff;
--text-color: #333333;
--font-family: 'Inter', sans-serif;
}
```
## Response Format
The API returns simple JSON responses:
```json
{
"response": "Bot message text",
"session_id": "uuid",
"timestamp": "2024-01-01T12:00:00Z",
"tools_used": ["weather", "calendar"]
}
```
## File Uploads
Users can upload files through the standard multipart form:
```
POST /api/upload
Content-Type: multipart/form-data
Returns:
{
"file_id": "uuid",
"status": "processed",
"extracted_text": "..."
}
```
## Session Management
Sessions are handled automatically through cookies or tokens:
- Session created on first message
- Persisted across conversations
- Context maintained server-side
## Mobile Responsive
The default interface is mobile-first:
- Touch-friendly input
- Responsive layout
- Optimized for small screens
- Progressive enhancement
## Accessibility
Built-in accessibility features:
- Keyboard navigation
- Screen reader support
- High contrast mode support
- Focus indicators
## Performance
Optimized for speed:
- Minimal JavaScript
- CSS-only animations
- Lazy loading
- CDN-ready assets
## Browser Support
Works on all modern browsers:
- Chrome 90+
- Firefox 88+
- Safari 14+
- Edge 90+
- Mobile browsers
## Integration Examples
### Embed in Website
```html
<iframe src="https://bot.example.com"
width="400"
height="600">
</iframe>
```
### Custom Frontend
```javascript
// Use any frontend framework
const BotClient = {
async send(message) {
return fetch('/api/message', {
method: 'POST',
body: JSON.stringify({ message })
});
}
};
```
## Security
- CORS configured for embedding
- CSRF protection on POST requests
- Rate limiting per session
- Input sanitization
- XSS prevention
All theming is done through simple CSS files as described in the [Theme Structure](./structure.md).

View file

@ -1,6 +1,6 @@
# Chapter 04: gbtheme Reference
# Chapter 05: gbtheme CSS Theming
Themes control how your bot looks in the web interface. A theme is simply a CSS file that changes colors, fonts, and styles.
The `.gbtheme` package provides CSS-based styling for your bot's user interface. Themes control colors, fonts, layouts, and visual effects across all .gbui templates.
## Quick Start
@ -194,4 +194,13 @@ END IF
2. Theme CSS file
3. Inline style overrides (if any)
The theme system keeps styling separate from bot logic, making it easy to change the look without touching the code.
The theme system keeps styling separate from bot logic, making it easy to change the look without touching the code.
## See Also
- [Chapter 4: .gbui Interface](../chapter-04-gbui/README.md) - User interface templates
- [CSS Customization](./css.md) - Detailed styling guide
- [Theme Structure](./structure.md) - Package organization
- [Chapter 2: .gbtheme](../chapter-02/gbtheme.md) - Theme package details
- [Chapter 6: BASIC Reference](../chapter-06-gbdialog/README.md) - Script commands
- [Chapter 8: Configuration](../chapter-08-config/config-csv.md) - Bot settings

View file

@ -0,0 +1,427 @@
# CSS Customization
The **gbtheme** CSS files define the visual style of the bot UI. They are split into three layers to make them easy to extend.
## Files
| File | Role |
|------|------|
| `main.css` | Core layout, typography, and global variables. |
| `components.css` | Styles for reusable UI components (buttons, cards, modals). |
| `responsive.css` | Media queries for mobile, tablet, and desktop breakpoints. |
## CSS Variables (in `main.css`)
```css
:root {
--primary-color: #2563eb;
--secondary-color: #64748b;
--background-color: #ffffff;
--text-color: #1e293b;
--border-radius: 8px;
--spacing-unit: 8px;
}
```
Changing a variable updates the entire theme without editing individual rules.
## Extending the Theme
1. **Add a new variable** Append to `:root` and reference it in any selector.
2. **Override a component** Duplicate the selector in `components.css` after the original definition; the later rule wins.
3. **Create a dark mode** Add a `@media (prefers-color-scheme: dark)` block that redefines the variables.
```css
@media (prefers-color-scheme: dark) {
:root {
--primary-color: #3b82f6;
--background-color: #111827;
--text-color: #f9fafb;
}
}
```
## Best Practices
* Keep the file size small avoid large image data URIs; store images in `assets/`.
* Use `rem` units for font sizes; they scale with the root `font-size`.
* Limit the depth of nesting; flat selectors improve performance.
All CSS files are loaded in `index.html` in the order: `main.css`, `components.css`, `responsive.css`.
## Component Styling Guide
### Message Bubbles
Customize chat message appearance:
```css
/* User messages */
.message-user {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 12px 16px;
border-radius: 18px 18px 4px 18px;
max-width: 70%;
margin-left: auto;
}
/* Bot messages */
.message-bot {
background: #f7fafc;
color: #2d3748;
padding: 12px 16px;
border-radius: 18px 18px 18px 4px;
max-width: 70%;
border: 1px solid #e2e8f0;
}
/* Typing indicator */
.typing-indicator {
display: inline-flex;
padding: 16px;
background: #edf2f7;
border-radius: 18px;
}
.typing-indicator span {
height: 8px;
width: 8px;
background: #718096;
border-radius: 50%;
margin: 0 2px;
animation: typing 1.4s infinite;
}
```
### Input Field
Style the message input area:
```css
.input-container {
padding: 16px;
background: white;
border-top: 1px solid #e2e8f0;
}
.input-wrapper {
display: flex;
align-items: center;
background: #f7fafc;
border: 2px solid #e2e8f0;
border-radius: 24px;
padding: 8px 16px;
transition: all 0.2s;
}
.input-wrapper:focus-within {
border-color: var(--primary-color);
background: white;
box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}
.message-input {
flex: 1;
border: none;
background: transparent;
outline: none;
font-size: 16px;
}
.send-button {
background: var(--primary-color);
color: white;
border: none;
border-radius: 50%;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: transform 0.2s;
}
.send-button:hover {
transform: scale(1.1);
}
.send-button:active {
transform: scale(0.95);
}
```
### Buttons
Consistent button styling:
```css
/* Primary button */
.btn-primary {
background: var(--primary-color);
color: white;
border: none;
padding: 10px 20px;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.btn-primary:hover {
filter: brightness(110%);
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* Secondary button */
.btn-secondary {
background: transparent;
color: var(--primary-color);
border: 2px solid var(--primary-color);
padding: 8px 18px;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.btn-secondary:hover {
background: var(--primary-color);
color: white;
}
/* Icon button */
.btn-icon {
background: transparent;
border: none;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: background 0.2s;
}
.btn-icon:hover {
background: rgba(0, 0, 0, 0.05);
}
```
## Animation Library
### Entrance Animations
```css
@keyframes slideInUp {
from {
transform: translateY(20px);
opacity: 0;
}
to {
transform: translateY(0);
opacity: 1;
}
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
@keyframes scaleIn {
from {
transform: scale(0.95);
opacity: 0;
}
to {
transform: scale(1);
opacity: 1;
}
}
/* Apply animations */
.message {
animation: slideInUp 0.3s ease-out;
}
.modal {
animation: scaleIn 0.2s ease-out;
}
```
### Loading States
```css
/* Spinner */
.spinner {
width: 40px;
height: 40px;
border: 3px solid #e2e8f0;
border-top-color: var(--primary-color);
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
/* Skeleton loader */
.skeleton {
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
background-size: 200% 100%;
animation: loading 1.5s infinite;
}
@keyframes loading {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
```
## Responsive Design Patterns
### Mobile-First Approach
```css
/* Base mobile styles */
.container {
padding: 16px;
width: 100%;
}
/* Tablet and up */
@media (min-width: 768px) {
.container {
padding: 24px;
max-width: 768px;
margin: 0 auto;
}
}
/* Desktop */
@media (min-width: 1024px) {
.container {
padding: 32px;
max-width: 1024px;
}
}
/* Wide screens */
@media (min-width: 1440px) {
.container {
max-width: 1280px;
}
}
```
### Touch-Friendly Styles
```css
/* Increase touch targets on mobile */
@media (pointer: coarse) {
button, a, input, select {
min-height: 44px;
min-width: 44px;
}
.btn-primary, .btn-secondary {
padding: 12px 24px;
font-size: 16px;
}
}
/* Disable hover effects on touch devices */
@media (hover: none) {
.btn-primary:hover {
filter: none;
box-shadow: none;
}
}
```
## Theme Variants
### Dark Mode
```css
@media (prefers-color-scheme: dark) {
:root {
--primary-color: #60a5fa;
--secondary-color: #94a3b8;
--background-color: #0f172a;
--text-color: #f1f5f9;
--border-color: #334155;
}
.message-bot {
background: #1e293b;
color: #f1f5f9;
border-color: #334155;
}
.input-wrapper {
background: #1e293b;
border-color: #334155;
}
}
```
### High Contrast
```css
@media (prefers-contrast: high) {
:root {
--primary-color: #0066cc;
--text-color: #000000;
--background-color: #ffffff;
}
* {
border-width: 2px !important;
}
button:focus, input:focus {
outline: 3px solid #000000 !important;
outline-offset: 2px !important;
}
}
```
## Performance Tips
1. **Use CSS Variables**: Change themes by updating variables, not entire stylesheets
2. **Minimize Specificity**: Keep selectors simple for faster parsing
3. **Avoid Deep Nesting**: Maximum 3 levels deep
4. **Use Transform/Opacity**: For animations instead of layout properties
5. **Lazy Load Non-Critical CSS**: Load theme variations on demand
## Browser Compatibility
```css
/* Provide fallbacks for older browsers */
.gradient-bg {
background: #3b82f6; /* Fallback */
background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}
/* Use @supports for progressive enhancement */
@supports (backdrop-filter: blur(10px)) {
.modal-backdrop {
backdrop-filter: blur(10px);
}
}
```
## See Also
- [Theme Structure](./structure.md) - File organization
- [Chapter 4: User Interface](../chapter-04-gbui/README.md) - Applying themes to templates
- [Chapter 6: BASIC](../chapter-06-gbdialog/README.md) - Dynamic theme switching
## Next Step
Return to [Chapter 5 Overview](./README.md) or continue to [Chapter 6: BASIC Dialogs](../chapter-06-gbdialog/README.md).

View file

@ -0,0 +1,190 @@
# Theme Structure
The **gbtheme** package follows a conventional layout that separates concerns between markup, styling, scripts, and assets.
```
theme-name.gbtheme/
├── web/
│ ├── index.html # Main application shell
│ ├── chat.html # Conversation UI
│ └── login.html # Authentication page
├── css/
│ ├── main.css # Core styles
│ ├── components.css # UI component styling
│ └── responsive.css # Mediaquery breakpoints
├── js/
│ ├── app.js # Frontend logic, WebSocket handling
│ └── websocket.js # Realtime communication layer
└── assets/
├── images/
├── fonts/
└── icons/
```
### Design Principles
* **Separation of concerns** HTML defines structure, CSS defines appearance, JS defines behavior.
* **Custom properties** `css/variables.css` (included in `main.css`) provides theme colors, spacing, and radius that can be overridden perbot.
* **Responsive** `responsive.css` uses mobilefirst breakpoints (`@media (min-width: 768px)`) to adapt the layout.
* **Asset locality** All images, fonts, and icons are stored under `assets/` to keep the theme selfcontained and portable.
### Extending a Theme
1. Duplicate an existing theme folder (e.g., `default.gbtheme``mybrand.gbtheme`).
2. Edit `css/main.css` to change colors via the `:root` variables.
3. Replace `web/index.html` header/footer with brandspecific markup.
4. Add new icons to `assets/icons/` and reference them in the HTML.
The system automatically picks up any theme placed under `@/templates/…` when the bot's configuration (`.gbtheme` entry in `config.csv`) points to the folder name.
## Theme Loading Process
1. **Discovery**: Bot looks for theme folder in `work/{bot_name}/{bot_name}.gbtheme/`
2. **Validation**: Checks for required files (at least one CSS file)
3. **Registration**: Theme becomes available in theme selector
4. **Activation**: User selects theme or bot loads default
5. **Hot Reload**: Changes apply immediately without restart
## File Organization Best Practices
### CSS Organization
```
css/
├── variables.css # Theme variables and colors
├── reset.css # Browser normalization
├── base.css # Typography and base styles
├── layout.css # Grid and structure
├── components/ # Component-specific styles
│ ├── buttons.css
│ ├── messages.css
│ ├── inputs.css
│ └── cards.css
└── utilities.css # Helper classes
```
### Asset Management
```
assets/
├── images/
│ ├── logo.svg # Vector graphics preferred
│ ├── bg.webp # Modern formats for performance
│ └── icons/ # Icon set
├── fonts/
│ └── custom.woff2 # Web fonts if needed
└── data/
└── theme.json # Theme metadata
```
## Creating a Custom Theme
### Step 1: Copy Base Theme
```bash
cp -r work/default/default.gbtheme work/mybot/mybot.gbtheme
```
### Step 2: Customize Variables
Edit `css/variables.css`:
```css
:root {
/* Brand Colors */
--brand-primary: #your-color;
--brand-secondary: #your-color;
/* Semantic Colors */
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
/* Typography */
--font-family: 'Inter', system-ui, sans-serif;
--font-size-base: 16px;
--line-height: 1.5;
/* Spacing Scale */
--space-xs: 0.25rem;
--space-sm: 0.5rem;
--space-md: 1rem;
--space-lg: 2rem;
--space-xl: 4rem;
}
```
### Step 3: Apply Brand Styles
Override components in `css/components.css`:
```css
/* Custom message bubbles */
.message-user {
background: var(--brand-primary);
color: white;
border-radius: 18px 18px 4px 18px;
}
.message-bot {
background: #f3f4f6;
border: 1px solid #e5e7eb;
border-radius: 18px 18px 18px 4px;
}
```
## Theme Inheritance
Themes can extend other themes:
```css
/* In mybot.gbtheme/css/main.css */
@import url('../../../default.gbtheme/css/main.css');
/* Override specific variables */
:root {
--primary-color: #ff6b6b;
}
```
## Performance Optimization
### CSS Loading Strategy
1. **Critical CSS**: Inline essential styles in HTML
2. **Async Loading**: Load non-critical CSS asynchronously
3. **Minification**: Minify CSS for production
4. **Purging**: Remove unused CSS rules
### Asset Optimization
- Use SVG for logos and icons
- Implement lazy loading for images
- Serve WebP with fallbacks
- Enable gzip compression
## Theme Switching
Dynamic theme switching without page reload:
```javascript
// Theme manager automatically handles this
ThemeManager.switchTheme('dark');
```
## Accessibility Considerations
- Maintain WCAG 2.1 AA contrast ratios
- Support high contrast mode
- Include focus indicators
- Test with screen readers
## See Also
- [CSS Customization](./css.md) - Detailed CSS guide
- [Chapter 4: User Interface](../chapter-04-gbui/README.md) - UI templates
- [Chapter 6: BASIC](../chapter-06-gbdialog/README.md) - Theme switching in dialogs
## Next Step
Continue to [CSS Customization](./css.md) for detailed styling techniques.

View file

@ -1,99 +0,0 @@
<svg width="700" height="600" xmlns="http://www.w3.org/2000/svg">
<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="#888"/>
</marker>
</defs>
<!-- Title -->
<text x="350" y="30" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">BASIC Script Execution Flow</text>
<!-- start.bas (Raw Text) -->
<rect x="250" y="60" width="200" height="60" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
<text x="350" y="85" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">start.bas</text>
<text x="350" y="105" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">(Raw Text)</text>
<!-- Arrow down -->
<line x1="350" y1="120" x2="350" y2="150" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Tokenizer -->
<rect x="200" y="150" width="300" height="80" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
<text x="350" y="175" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">Tokenizer (Rhai)</text>
<text x="350" y="195" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">• Split into tokens</text>
<text x="350" y="210" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">• Identify keywords</text>
<!-- Arrow down -->
<line x1="350" y1="230" x2="350" y2="260" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Parser -->
<rect x="200" y="260" width="300" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
<text x="350" y="285" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">Parser (AST)</text>
<text x="350" y="305" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">• Build syntax tree</text>
<text x="350" y="320" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">• Validate structure</text>
<!-- Arrow down -->
<line x1="350" y1="340" x2="350" y2="370" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Keyword Mapping -->
<rect x="200" y="370" width="300" height="80" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
<text x="350" y="395" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">Keyword Mapping</text>
<text x="350" y="415" text-anchor="middle" font-family="monospace" font-size="10" fill="#9AE6B4">TALK → talk_handler</text>
<text x="350" y="430" text-anchor="middle" font-family="monospace" font-size="10" fill="#9AE6B4">HEAR → hear_handler</text>
<!-- Arrow down -->
<line x1="350" y1="450" x2="350" y2="480" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Runtime Execution -->
<rect x="100" y="480" width="500" height="150" fill="none" stroke="#4A5568" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6"/>
<text x="350" y="505" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#A0AEC0">Runtime Execution</text>
<!-- Execution boxes inside -->
<g id="execution-flow">
<!-- Line 1: TALK -->
<rect x="140" y="530" width="100" height="40" fill="none" stroke="#63B3ED" stroke-width="1" rx="5"/>
<text x="190" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#90CDF4">Line 1</text>
<text x="190" y="560" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">TALK</text>
<!-- Arrow -->
<line x1="240" y1="550" x2="280" y2="550" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 2: HEAR -->
<rect x="280" y="530" width="100" height="40" fill="none" stroke="#F6AD55" stroke-width="1" rx="5"/>
<text x="330" y="545" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FBD38D">Line 2</text>
<text x="330" y="560" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">HEAR</text>
<!-- Arrow down -->
<line x1="330" y1="570" x2="330" y2="580" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 3: IF/THEN -->
<rect x="280" y="580" width="100" height="40" fill="none" stroke="#B794F4" stroke-width="1" rx="5"/>
<text x="330" y="595" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#D6BCFA">Line 3</text>
<text x="330" y="610" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">IF/THEN</text>
<!-- Arrow -->
<line x1="380" y1="600" x2="420" y2="600" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 4: Action -->
<rect x="420" y="580" width="100" height="40" fill="none" stroke="#48BB78" stroke-width="1" rx="5"/>
<text x="470" y="595" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">Line 4</text>
<text x="470" y="610" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">Action</text>
</g>
<!-- Arrow down from Runtime -->
<line x1="350" y1="630" x2="350" y2="660" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- User Response -->
<rect x="250" y="660" width="200" height="60" fill="none" stroke="#FC8181" stroke-width="2" rx="8"/>
<text x="350" y="685" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">User Response</text>
<text x="350" y="705" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">Output/Interaction</text>
<!-- Process steps on the side -->
<g id="process-steps" font-family="Arial, sans-serif" font-size="12" fill="#718096">
<text x="50" y="90" text-anchor="end">1. Source</text>
<text x="50" y="190" text-anchor="end">2. Tokenize</text>
<text x="50" y="300" text-anchor="end">3. Parse</text>
<text x="50" y="410" text-anchor="end">4. Map</text>
<text x="50" y="550" text-anchor="end">5. Execute</text>
<text x="50" y="690" text-anchor="end">6. Output</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -1,11 +1,26 @@
# Chapter 05: BASIC Dialogs
# Chapter 06: BASIC Dialogs
**Write chatbots like it's 1985.** BotServer uses BASIC - yes, that BASIC - for conversation scripts. Simple English-like commands that anyone can write. No frameworks, no callbacks, no async/await complexity.
BASIC is back, and it's powering the AI revolution. In an age of complex programming languages, General Bots chose BASIC for a simple reason: everyone can learn it in minutes, yet it's powerful enough to orchestrate sophisticated AI workflows.
## Why BASIC?
## Why BASIC in 2025?
We believe AI development shouldn't require a computer science degree. BASIC's English-like syntax means:
- Business analysts can write automation
- Teachers can create educational bots
- Doctors can build medical assistants
- No programming background needed
Because `TALK "Hello"` is clearer than `await ctx.send(Message(content="Hello"))`. We chose simplicity over sophistication. Your grandmother could write these scripts.
## Beyond Simple Scripts
Modern BASIC isn't your grandfather's language. BASIC scripts can:
- Orchestrate multiple AI models
- Process complex data
- Integrate with any API
- Handle enterprise workflows
- Scale to millions of users
## The 5-Minute Tutorial
### Your First Script
@ -19,24 +34,20 @@ TALK "Nice to meet you, " + name
That's a working chatbot. Three lines.
### Add Knowledge
### Add [Knowledge](../chapter-03/knowledge-base.md)
```basic
USE KB "documentation"
TALK "You can ask me anything about our documentation!"
TALK "What would you like to know?"
HEAR question
```
The bot now has access to your documents and can answer questions about them.
### Add Tools
### Add [Tools](../chapter-03/kb-and-tools.md)
```basic
USE TOOL "weather"
TALK "I can check the weather for you."
TALK "Which city?"
HEAR location
```
Tools are automatically discovered and can be called by the AI as needed.
@ -47,32 +58,11 @@ The essential BASIC commands you need:
| Command | Purpose | Example |
|---------|---------|---------|
| TALK | Send message | `TALK "Hello"` |
| [TALK](./keyword-talk.md) | Send message | `TALK "Hello"` |
| HEAR | Get input | `HEAR name` |
| USE KB | Load knowledge | `USE KB "docs"` |
| USE TOOL | Enable function | `USE TOOL "weather"` |
## Real Examples from Templates
### Weather Bot (from default.gbai)
```basic
TALK "I can check the weather for any city."
TALK "Which location?"
HEAR location
USE TOOL "weather"
```
### Email Tool (from default.gbai)
```basic
TALK "I can help you send an email."
TALK "Who would you like to email?"
HEAR recipient
TALK "What's the subject?"
HEAR subject
TALK "What's the message?"
HEAR message
USE TOOL "send-email"
```
## Variables
@ -87,7 +77,7 @@ message = "Hello, " + name
Basic IF/THEN logic:
```basic
HEAR answer
HEAR answer AS BOOLEAN
IF answer = "yes" THEN
TALK "Great!"
ELSE
@ -153,24 +143,6 @@ loop:
GOTO loop
```
### Interactive Assistant
```basic
TALK "Hello! I'm your assistant."
TALK "How can I help you today?"
HEAR request
IF INSTR(request, "weather") > 0 THEN
USE TOOL "weather"
TALK "Which city?"
HEAR city
ELSE IF INSTR(request, "email") > 0 THEN
USE TOOL "send-email"
TALK "I'll help you send an email."
ELSE
TALK "I can help with weather or email."
END IF
```
## File Structure
Your bot's dialog scripts go in the `.gbdialog` folder:
@ -227,4 +199,24 @@ TALK "Contact saved!"
BASIC in BotServer brings conversational AI back to simplicity. No complex frameworks, just straightforward commands that read like English. Focus on the conversation, not the code.
Next: [BASIC Keywords Reference](./keywords.md)
## See Also
### Documentation
- [Dialog Basics](./basics.md) - Core concepts and patterns
- [Universal Messaging](./universal-messaging.md) - Multi-channel support
- [Template Examples](./templates.md) - Ready-to-use scripts
- [Keyword Reference](./keywords.md) - Complete command list
- [Chapter 3: Knowledge Base](../chapter-03/README.md) - Integrate documents
- [Chapter 9: API and Tools](../chapter-09-api/README.md) - External integrations
### Further Reading - Blog Posts
- [BASIC for Everyone](https://pragmatismo.cloud/blog/basic-for-everyone) - Why we chose BASIC for AI development
- [BASIC LLM Tools](https://pragmatismo.cloud/blog/basic-llm-tools) - Extending LLMs with BASIC scripts
- [MCP is the new API](https://pragmatismo.cloud/blog/mcp-is-the-new-api) - How BASIC scripts become universal tools
- [No Forms](https://pragmatismo.cloud/blog/no-forms) - The conversational UI philosophy
- [Beyond Chatbots](https://pragmatismo.cloud/blog/beyond-chatbots) - Real business applications
### Next Chapter
Continue to [Chapter 7: Architecture](../chapter-07-gbapp/README.md) to understand how General Bots works under the hood.
Next: [BASIC Keywords Reference](./keywords.md)

View file

@ -0,0 +1,99 @@
<svg width="700" height="500" xmlns="http://www.w3.org/2000/svg">
<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="#888"/>
</marker>
</defs>
<!-- Title -->
<text x="350" y="25" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="bold" fill="#CBD5E0">BASIC Script Execution Flow</text>
<!-- start.bas (Raw Text) -->
<rect x="250" y="40" width="200" height="40" fill="none" stroke="#63B3ED" stroke-width="2" rx="8"/>
<text x="350" y="55" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#90CDF4">start.bas</text>
<text x="350" y="70" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#CBD5E0">(Raw Text)</text>
<!-- Arrow down -->
<line x1="350" y1="60" x2="350" y2="90" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Tokenizer -->
<rect x="200" y="90" width="300" height="60" fill="none" stroke="#F6AD55" stroke-width="2" rx="8"/>
<text x="350" y="110" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FBD38D">Tokenizer (Rhai)</text>
<text x="350" y="130" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">• Split into tokens</text>
<text x="350" y="145" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FED7AA">• Identify keywords</text>
<!-- Arrow down -->
<line x1="350" y1="150" x2="350" y2="160" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Parser -->
<rect x="200" y="160" width="300" height="80" fill="none" stroke="#B794F4" stroke-width="2" rx="8"/>
<text x="350" y="185" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#D6BCFA">Parser (AST)</text>
<text x="350" y="205" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">• Build syntax tree</text>
<text x="350" y="220" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#E9D8FD">• Validate structure</text>
<!-- Arrow down -->
<line x1="350" y1="240" x2="350" y2="270" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Keyword Mapping -->
<rect x="200" y="270" width="300" height="80" fill="none" stroke="#48BB78" stroke-width="2" rx="8"/>
<text x="350" y="295" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#68D391">Keyword Mapping</text>
<text x="350" y="315" text-anchor="middle" font-family="monospace" font-size="10" fill="#9AE6B4">TALK → talk_handler</text>
<text x="350" y="330" text-anchor="middle" font-family="monospace" font-size="10" fill="#9AE6B4">HEAR → hear_handler</text>
<!-- Arrow down -->
<line x1="350" y1="350" x2="350" y2="380" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- Runtime Execution -->
<rect x="100" y="380" width="500" height="150" fill="none" stroke="#4A5568" stroke-width="2" rx="10" stroke-dasharray="5,5" opacity="0.6"/>
<text x="350" y="405" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#A0AEC0">Runtime Execution</text>
<!-- Execution boxes inside -->
<g id="execution-flow">
<!-- Line 1: TALK -->
<rect x="140" y="430" width="100" height="40" fill="none" stroke="#63B3ED" stroke-width="1" rx="5"/>
<text x="190" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#90CDF4">Line 1</text>
<text x="190" y="460" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">TALK</text>
<!-- Arrow -->
<line x1="240" y1="450" x2="280" y2="450" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 2: HEAR -->
<rect x="280" y="430" width="100" height="40" fill="none" stroke="#F6AD55" stroke-width="1" rx="5"/>
<text x="330" y="445" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#FBD38D">Line 2</text>
<text x="330" y="460" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">HEAR</text>
<!-- Arrow down -->
<line x1="330" y1="470" x2="330" y2="480" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 3: IF/THEN -->
<rect x="280" y="480" width="100" height="40" fill="none" stroke="#B794F4" stroke-width="1" rx="5"/>
<text x="330" y="495" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#D6BCFA">Line 3</text>
<text x="330" y="510" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">IF/THEN</text>
<!-- Arrow -->
<line x1="380" y1="500" x2="420" y2="500" stroke="#888" stroke-width="1" marker-end="url(#arrow)"/>
<!-- Line 4: Action -->
<rect x="420" y="480" width="100" height="40" fill="none" stroke="#48BB78" stroke-width="1" rx="5"/>
<text x="470" y="495" text-anchor="middle" font-family="Arial, sans-serif" font-size="11" fill="#68D391">Line 4</text>
<text x="470" y="510" text-anchor="middle" font-family="monospace" font-size="10" fill="#CBD5E0">Action</text>
</g>
<!-- Arrow down from Runtime -->
<line x1="350" y1="530" x2="350" y2="560" stroke="#888" stroke-width="2" marker-end="url(#arrow)"/>
<!-- User Response -->
<rect x="250" y="560" width="200" height="60" fill="none" stroke="#FC8181" stroke-width="2" rx="8"/>
<text x="350" y="585" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="bold" fill="#FC8181">User Response</text>
<text x="350" y="605" text-anchor="middle" font-family="Arial, sans-serif" font-size="12" fill="#FEB2B2">Output/Interaction</text>
<!-- Process steps on the side -->
<g id="process-steps" font-family="Arial, sans-serif" font-size="12" fill="#718096">
<text x="50" y="60" text-anchor="end">1. Source</text>
<text x="50" y="120" text-anchor="end">2. Tokenize</text>
<text x="50" y="200" text-anchor="end">3. Parse</text>
<text x="50" y="310" text-anchor="end">4. Map</text>
<text x="50" y="450" text-anchor="end">5. Execute</text>
<text x="50" y="580" text-anchor="end">6. Output</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 6.1 KiB

View file

@ -1,9 +1,9 @@
# ADD_WEBSITE Keyword
# ADD WEBSITE Keyword
**Syntax**
```
ADD_WEBSITE "https://example.com"
ADD WEBSITE "https://example.com"
```
**Parameters**
@ -12,15 +12,12 @@ ADD_WEBSITE "https://example.com"
**Description**
`ADD_WEBSITE` validates the provided URL and, when the `web_automation` feature is enabled, launches a headless browser to crawl the site, extract its textual content, and index it into a vectorDB collection associated with the current user. The collection name is derived from the URL and the bots identifiers. After indexing, the website becomes a knowledge source that can be queried by `FIND` or `LLM` calls.
`ADD WEBSITE` validates the provided URL and, when the `web_automation` feature is enabled, launches a headless browser to crawl the site, extract its textual content, and index it into a vectorDB collection associated with the current user. The collection name is derived from the URL and the bot's identifiers. After indexing, the website becomes a knowledge source that can be queried by `FIND` or `LLM` calls.
If the feature is not compiled, the keyword returns an error indicating that web automation is unavailable.
**Example**
```basic
ADD_WEBSITE "https://en.wikipedia.org/wiki/General_Bots"
ADD WEBSITE "https://en.wikipedia.org/wiki/General_Bots"
TALK "Website added. You can now search its content with FIND."
```
After execution, the Wikipedia page is crawled, its text is stored in a KB collection, and subsequent `FIND "website_of" "General Bots"` calls will consider this new source.

View file

@ -1,9 +1,9 @@
# CLEAR_TOOLS Keyword
# CLEAR TOOLS Keyword
**Syntax**
```
CLEAR_TOOLS
CLEAR TOOLS
```
**Parameters**
@ -12,15 +12,15 @@ _None_ This keyword takes no arguments.
**Description**
`CLEAR_TOOLS` removes every tool that has been added to the current conversation session. It clears the list of active tools stored in the sessiontool association table, effectively resetting the tool environment for the dialog. After execution, no previously added tools (via `USE_TOOL`) remain available.
`CLEAR TOOLS` removes every tool that has been added to the current conversation session. It clears the list of active tools stored in the sessiontool association table, effectively resetting the tool environment for the dialog. After execution, no previously added tools (via `USE TOOL`) remain available.
**Example**
```basic
USE_TOOL "enrollment.bas"
USE TOOL "enrollment.bas"
TALK "Enrollment tool added."
CLEAR_TOOLS
CLEAR TOOLS
TALK "All tools have been cleared from this conversation."
```
After `CLEAR_TOOLS` runs, the `enrollment.bas` tool is no longer accessible in the same session.
After `CLEAR TOOLS` runs, the `enrollment.bas` tool is no longer accessible in the same session.

View file

@ -1,9 +1,9 @@
# CREATE_DRAFT Keyword
# CREATE DRAFT Keyword
**Syntax**
```
CREATE_DRAFT "to-address", "subject", "reply-text"
CREATE DRAFT "to-address", "subject", "reply-text"
```
**Parameters**
@ -14,12 +14,12 @@ CREATE_DRAFT "to-address", "subject", "reply-text"
**Description**
`CREATE_DRAFT` composes an email draft and saves it to the user's mailbox. It first checks whether a prior email has been sent to the same recipient using the `GET_LATEST_SENT_TO` helper. If such an email exists, its body (converted to HTML line breaks) is appended to the new reply text, separated by `<br><hr><br>`. The combined content is then stored as a draft via the email service configured in the application (`save_email_draft`). The keyword returns a success message or an error string.
`CREATE DRAFT` composes an email draft and saves it to the user's mailbox. It first checks whether a prior email has been sent to the same recipient using the `GET_LATEST_SENT_TO` helper. If such an email exists, its body (converted to HTML line breaks) is appended to the new reply text, separated by `<br><hr><br>`. The combined content is then stored as a draft via the email service configured in the application (`save_email_draft`). The keyword returns a success message or an error string.
**Example**
```basic
CREATE_DRAFT "john.doe@example.com", "Project Update", "Here is the latest status..."
CREATE DRAFT "john.doe@example.com", "Project Update", "Here is the latest status..."
TALK "Draft created and saved."
```

View file

@ -1,9 +1,9 @@
# CREATE_SITE Keyword
# CREATE SITE Keyword
**Syntax**
```
CREATE_SITE "alias", "template-dir", "prompt"
CREATE SITE "alias", "template-dir", "prompt"
```
**Parameters**
@ -14,7 +14,7 @@ CREATE_SITE "alias", "template-dir", "prompt"
**Description**
`CREATE_SITE` generates a new static website based on existing HTML templates and an LLMgenerated prompt. The keyword performs the following steps:
`CREATE SITE` generates a new static website based on existing HTML templates and an LLMgenerated prompt. The keyword performs the following steps:
1. Creates a directory for the new site at `<site_path>/<alias>`.
2. Reads all `.html` files from `<site_path>/<template-dir>` and concatenates their contents, separating each with a clear delimiter.
@ -27,7 +27,7 @@ The resulting site can be served directly from the `site_path` directory. Errors
**Example**
```basic
CREATE_SITE "my_blog", "templates/blog", "Generate a modern blog homepage for a tech writer."
CREATE SITE "my_blog", "templates/blog", "Generate a modern blog homepage for a tech writer."
TALK "Site created at /my_blog. Access it via the web server."
```

View file

@ -1,11 +1,11 @@
# CREATE_TASK
# CREATE TASK
Create and assign tasks within the task management system.
## Syntax
```basic
CREATE_TASK title, description, assignee, due_date, priority
CREATE TASK title, description, assignee, due_date, priority
```
## Parameters
@ -20,7 +20,7 @@ CREATE_TASK title, description, assignee, due_date, priority
## Description
The `CREATE_TASK` keyword creates tasks in the task engine system with:
The `CREATE TASK` keyword creates tasks in the task engine system with:
- Automatic assignment to users or groups
- Due date tracking and reminders
@ -33,7 +33,7 @@ The `CREATE_TASK` keyword creates tasks in the task engine system with:
### Basic Task Creation
```basic
CREATE_TASK "Review proposal", "Review and provide feedback on Q4 proposal", "john@example.com", "2024-01-15", "high"
CREATE TASK "Review proposal", "Review and provide feedback on Q4 proposal", "john@example.com", "2024-01-15", "high"
```
### Task with Current User
@ -46,14 +46,14 @@ CREATE TASK "Follow up", "Contact customer about renewal", user_email, "tomorrow
```basic
team = ["alice@example.com", "bob@example.com", "carol@example.com"]
FOR EACH member IN team
CREATE_TASK "Complete training", "Finish security awareness training", member, "next week", "medium"
CREATE TASK "Complete training", "Finish security awareness training", member, "next week", "medium"
NEXT
```
### Task from User Input
```basic
task_info = HEAR "What task should I create?"
CREATE_TASK task_info, "User requested task", "support@example.com", "today", "high"
CREATE TASK task_info, "User requested task", "support@example.com", "today", "high"
TALK "Task created and assigned to support team"
```
@ -94,8 +94,8 @@ Sends notifications for:
### Task Dependencies
Can link tasks together:
```basic
parent_task = CREATE_TASK "Project", "Main project", "pm@example.com", "next month", "high"
subtask = CREATE_TASK "Research", "Initial research", "analyst@example.com", "next week", "medium"
parent_task = CREATE TASK "Project", "Main project", "pm@example.com", "next month", "high"
subtask = CREATE TASK "Research", "Initial research", "analyst@example.com", "next week", "medium"
LINK_TASKS parent_task.task_id, subtask.task_id
```
@ -145,30 +145,30 @@ User must have one of:
### Task Templates
```basic
template = GET_TASK_TEMPLATE("customer_onboarding")
CREATE_TASK template.title, template.description, assigned_user, due_date, template.priority
CREATE TASK template.title, template.description, assigned_user, due_date, template.priority
```
### Conditional Creation
```basic
IF urgency = "high" AND department = "support" THEN
CREATE_TASK "Urgent Support", issue_description, "support-lead@example.com", "today", "urgent"
CREATE TASK "Urgent Support", issue_description, "support-lead@example.com", "today", "urgent"
ELSE
CREATE_TASK "Support Request", issue_description, "support@example.com", "tomorrow", "medium"
CREATE TASK "Support Request", issue_description, "support@example.com", "tomorrow", "medium"
END IF
```
### Task with Attachments
```basic
task = CREATE_TASK "Review document", "Please review attached", reviewer, deadline, "high"
ATTACH_FILE task.task_id, "proposal.pdf"
task = CREATE TASK "Review document", "Please review attached", reviewer, deadline, "high"
' Note: Use document sharing systems for attachments
```
## Related Keywords
- [BOOK](./keyword-book.md) - Schedule meetings instead of tasks
- [SET_SCHEDULE](./keyword-set-schedule.md) - Create recurring tasks
- [SEND_MAIL](./keyword-send-mail.md) - Send task notifications
- [ADD_MEMBER](./keyword-add-member.md) - Add users to task groups
- [SET SCHEDULE](./keyword-set-schedule.md) - Create recurring tasks
- [SEND MAIL](./keyword-send-mail.md) - Send task notifications
- [ADD MEMBER](./keyword-add-member.md) - Add users to task groups
## Database Tables

View file

@ -8,7 +8,7 @@ It is used to fetch data dynamically during script execution.
## Syntax
```basic
GET "source" INTO variable
variable = GET "source"
```
---
@ -62,7 +62,6 @@ TALK CONTENT
## Related Keywords
- [`SET`](keyword-set.md) — Stores values in variables or session memory.
- [`FIND`](keyword-find.md) — Searches for data within the current context.
- [`FORMAT`](keyword-format.md) — Formats retrieved data for display.
- [`PRINT`](keyword-print.md) — Outputs data to the console or chat.

View file

@ -63,7 +63,6 @@ SEND MAIL "user@example.com", "Getting Started", body
### Dynamic Content
```basic
user_name = GET "user_name"
order_id = GET "order_id"
subject = "Order #" + order_id + " Confirmation"
body = "Hello " + user_name + ", your order has been confirmed."
@ -73,7 +72,7 @@ SEND MAIL user_email, subject, body
### With Error Handling
```basic
email = HEAR "Enter your email address:"
IF VALIDATE_EMAIL(email) THEN
IF email CONTAINS "@" AND email CONTAINS "." THEN
SEND MAIL email, "Verification Code", "Your code is: 123456"
TALK "Email sent successfully!"
ELSE
@ -83,22 +82,20 @@ END IF
### Notification System
```basic
' Send notification to admin when error occurs
ON ERROR
admin_email = GET BOT MEMORY "admin_email"
error_details = GET_LAST_ERROR()
subject = "Bot Error Alert"
body = "Error occurred at " + NOW() + ": " + error_details
' Send notification to admin when issue detected
admin_email = GET BOT MEMORY "admin_email"
IF error_detected THEN
subject = "Bot Alert"
body = "Issue detected at " + NOW()
SEND MAIL admin_email, subject, body
END ON
END IF
```
### Bulk Email with Personalization
```basic
subscribers = GET "subscribers.list"
FOR EACH email IN subscribers
name = GET "user.name"
body = "Dear " + name + ", here's your weekly update..."
body = "Dear " + username + ", here's your weekly update..."
SEND MAIL email, "Weekly Newsletter", body
WAIT 1 ' Rate limiting
NEXT
@ -145,22 +142,19 @@ SEND MAIL user_email, "Welcome!", template
Always validate email addresses before sending:
```basic
FUNCTION IsValidEmail(email)
IF email CONTAINS "@" AND email CONTAINS "." THEN
parts = SPLIT(email, "@")
IF LENGTH(parts) = 2 THEN
domain = parts[1]
IF domain CONTAINS "." THEN
RETURN TRUE
END IF
END IF
END IF
RETURN FALSE
END FUNCTION
email = HEAR "Your email:"
IF IsValidEmail(email) THEN
SEND MAIL email, "Test", "This is a test"
IF email CONTAINS "@" AND email CONTAINS "." THEN
parts = SPLIT(email, "@")
IF LENGTH(parts) = 2 THEN
domain = parts[1]
IF domain CONTAINS "." THEN
SEND MAIL email, "Test", "This is a test"
ELSE
TALK "Please enter a valid email"
END IF
ELSE
TALK "Please enter a valid email"
END IF
ELSE
TALK "Please enter a valid email"
END IF
@ -200,17 +194,22 @@ END IF
Common error scenarios:
```basic
TRY
SEND MAIL recipient, subject, body
TALK "Email sent successfully"
CATCH "invalid_email"
' Check email format before sending
IF recipient CONTAINS "@" AND recipient CONTAINS "." THEN
status = SEND MAIL recipient, subject, body
IF status = "sent" THEN
TALK "Email sent successfully"
ELSE IF status = "smtp_error" THEN
TALK "Email server is unavailable"
ELSE IF status = "auth_error" THEN
TALK "Email authentication failed"
LOG "Check SMTP credentials in config.csv"
ELSE
TALK "Failed to send email: " + status
END IF
ELSE
TALK "The email address is invalid"
CATCH "smtp_error"
TALK "Email server is unavailable"
CATCH "auth_error"
TALK "Email authentication failed"
LOG "Check SMTP credentials in config.csv"
END TRY
END IF
```
## Best Practices
@ -276,4 +275,4 @@ The implementation uses:
- Async email sending
- Connection pooling for performance
- Retry logic for failed attempts
- HTML sanitization for security
- HTML sanitization for security

View file

@ -59,9 +59,9 @@ TALK "Support mode activated. Please describe your issue."
## Related Keywords
- [`SET_BOT_MEMORY`](keyword-set-bot-memory.md) — Stores persistent data for the bot or user.
- [`GET_BOT_MEMORY`](keyword-get-bot-memory.md) — Retrieves stored memory entries.
- [`SET_SCHEDULE`](keyword-set-schedule.md) — Defines scheduled tasks that may depend on context.
- [`SET BOT MEMORY`](keyword-set-bot-memory.md) — Stores persistent data for the bot or user.
- [`GET BOT MEMORY`](keyword-get-bot-memory.md) — Retrieves stored memory entries.
- [`SET SCHEDULE`](keyword-set-schedule.md) — Defines scheduled tasks that may depend on context.
---

View file

@ -97,7 +97,7 @@ SET BOT MEMORY "daily_summary", summary
SET SCHEDULE "0 * * * *"
' Update cached data every hour
fresh_data = FETCH_EXTERNAL_API()
fresh_data = GET "https://server/data"
SET BOT MEMORY "cached_data", fresh_data
```
@ -106,37 +106,15 @@ SET BOT MEMORY "cached_data", fresh_data
SET SCHEDULE "0 10 * * 1"
' Send weekly newsletter every Monday at 10 AM
subscribers = GET_SUBSCRIBERS()
subscribers = FIND "subscribers_custom", "active=true"
FOR EACH email IN subscribers
SEND MAIL email, "Weekly Update", newsletter_content
NEXT
```
### Periodic Cleanup
```basic
SET SCHEDULE "0 2 * * *"
' Clean old data daily at 2 AM
DELETE_OLD_LOGS(30) ' Keep 30 days
VACUUM_DATABASE()
```
## Schedule Management
### View Active Schedules
```basic
schedules = GET_SCHEDULES()
FOR EACH schedule IN schedules
TALK "Task: " + schedule.name
TALK "Next run: " + schedule.next_run
NEXT
```
### Cancel Schedule
```basic
' Schedules are automatically canceled when script ends
' Or use:
CANCEL SCHEDULE "task_id"
' Schedules are automatically canceled when SET SCHEDULE is removed from .bas.
```
## Best Practices
@ -185,14 +163,7 @@ CANCEL SCHEDULE "task_id"
- Minimum interval: 1 minute
- Scripts timeout after 5 minutes by default
- Schedules persist until explicitly canceled or bot restarts
- Time zone is server's local time unless specified
## Time Zone Support
```basic
' Specify time zone (if supported)
SET SCHEDULE "0 9 * * *" TIMEZONE "America/New_York"
```
- Time zone is server's local time
## Monitoring
@ -219,4 +190,4 @@ The implementation:
- Integrates with system scheduler
- Persists schedules in database
- Handles concurrent execution
- Provides retry logic for failures
- Provides retry logic for failures

View file

@ -251,7 +251,7 @@ SET big_data = null ' Free memory
- [GET](./keyword-get.md) - Retrieve data from external sources
- [HEAR](./keyword-hear.md) - Get user input into variable
- [FORMAT](./keyword-format.md) - Format values for assignment
- [SET_BOT_MEMORY](./keyword-set-bot-memory.md) - Persistent storage
- [SET BOT MEMORY](./keyword-set-bot-memory.md) - Persistent storage
## Implementation Notes
Variables are stored in the BASIC engine's scope map and persist for the duration of the dialog execution. The `SET` keyword is syntactic sugar - the parser treats both `SET x = y` and `x = y` identically.

View file

@ -104,11 +104,6 @@ When USE KB is active:
## Managing Active Collections
### View Active Collections
```basic
collections = LIST_KB()
TALK "Active KBs: " + collections
```
### Clear Specific Collection
```basic
@ -137,7 +132,7 @@ CLEAR KB "troubleshooting"
USE KB "collection1"
USE KB "collection2"
USE KB "collection3"
' ... memory intensive ...
' ... context size intensive ...
```
### Search Speed
@ -246,19 +241,6 @@ USE KB "updates_" + month
' Load current month's updates
```
### Fallback Strategy
```basic
primary_kb = "detailed_docs"
fallback_kb = "general_info"
try
USE KB primary_kb
catch
USE KB fallback_kb
TALK "Using general information"
end
```
## Error Handling
Common errors and solutions:
@ -286,4 +268,4 @@ Solution: Wait for indexing to complete (automatic)
- [CLEAR KB](./keyword-clear-kb.md) - Deactivate knowledge bases
- [ADD WEBSITE](./keyword-add-website.md) - Add web content to KB
- [Knowledge Base Guide](../chapter-03/README.md) - Complete KB documentation
- [Vector Collections](../chapter-03/vector-collections.md) - How collections work
- [Vector Collections](../chapter-03/vector-collections.md) - How collections work

View file

@ -24,9 +24,9 @@ Loads a tool definition and makes it available to the LLM for the current sessio
' Load weather tool
USE TOOL "weather"
' Now LLM can use weather functions
answer = LLM "What's the weather in Tokyo?"
TALK answer
' Now system AI can use weather functions during conversations
TALK "What weather information would you like?"
' System AI automatically uses the tool when needed
```
### Multiple Tools
@ -37,36 +37,12 @@ USE TOOL "calculator"
USE TOOL "translator"
USE TOOL "date-time"
' LLM has access to all loaded tools
response = LLM "Calculate 15% tip on $45.80 and translate to Spanish"
TALK response
' System AI has access to all loaded tools during conversations
TALK "I can help you with calculations, translations, and date/time information."
' System AI automatically uses the appropriate tools when needed
```
### Conditional Loading
```basic
user_type = GET "user_type"
IF user_type = "admin" THEN
USE TOOL "admin-functions"
USE TOOL "database-query"
ELSE
USE TOOL "basic-search"
END IF
```
### With Error Handling
```basic
tool_needed = "advanced-analytics"
IF FILE EXISTS tool_needed + ".bas" THEN
USE TOOL tool_needed
TALK "Analytics tool loaded"
ELSE
TALK "Advanced features not available"
END IF
```
## Tool Definition Format
@ -90,10 +66,9 @@ RETURN result
- Use CLEAR TOOLS to remove all loaded tools
- Tool names should be descriptive
- Tools are loaded from the .gbdialog/tools/ directory
- Maximum 10 tools can be active simultaneously
## Related
- [CLEAR TOOLS](./keyword-clear-tools.md)
- [Tool Definition](../chapter-08/tool-definition.md)
- [PARAM Declaration](../chapter-08/param-declaration.md)
- [PARAM Declaration](../chapter-08/param-declaration.md)

View file

@ -54,7 +54,7 @@ TALK "Done!"
## Related Keywords
- [`SET_SCHEDULE`](keyword-set-schedule.md) — Defines scheduled tasks for automation.
- [`SET SCHEDULE`](keyword-set-schedule.md) — Defines scheduled tasks for automation.
- [`PRINT`](keyword-print.md) — Outputs messages or debugging information.
- [`TALK`](keyword-talk.md) — Sends messages to the user.
- [`HEAR`](keyword-hear.md) — Receives user input after a delay.

View file

@ -5,7 +5,7 @@ The `update-summary.bas` template demonstrates how to create scheduled tasks tha
## Overview
This template shows how to:
1. Schedule a recurring task using `SET_SCHEDULE`
1. Schedule a recurring task using `SET SCHEDULE`
2. Retrieve documents from the knowledge base
3. Generate summaries using the LLM
4. Store processed content in bot memory for quick access
@ -34,7 +34,7 @@ SET BOT MEMORY "toolbix", text2
### Scheduling with Cron Expression
```basic
SET_SCHEDULE "59 * * * *"
SET SCHEDULE "59 * * * *"
```
This schedules the script to run at 59 minutes past every hour. The cron format is:
@ -198,4 +198,4 @@ SET BOT MEMORY "daily_greeting", greeting + brief
## Summary
The update-summary pattern enables bots to maintain fresh, pre-processed content without manual intervention. By combining `SET_SCHEDULE`, `GET`, `LLM`, and `SET_BOT_MEMORY`, you can create intelligent bots that stay current with changing information and provide instant access to summarized content.
The update-summary pattern enables bots to maintain fresh, pre-processed content without manual intervention. By combining `SET SCHEDULE`, `GET`, `LLM`, and `SET BOT MEMORY`, you can create intelligent bots that stay current with changing information and provide instant access to summarized content.

View file

@ -125,26 +125,7 @@ channel-teams,disabled
| Email | Unlimited | Attachments | HTML | No |
| Teams | 28KB | Full | Adaptive Cards | Yes |
## Example: Multi-Channel Bot
```basic
' start.bas - Works on ALL channels
TALK "Welcome to Customer Support!"
TALK "How can I help you today?"
HEAR request
IF INSTR(request, "order") > 0 THEN
TALK "I'll help you with your order."
TALK "What's your order number?"
HEAR order_number
' Process order inquiry
ELSE
TALK "Let me connect you with an agent."
' Transfer to human
END IF
```
## Summary
Universal messaging means your BASIC scripts work across all channels without modification. BotServer handles the complexity of channel-specific formatting and delivery, letting you focus on the conversation logic.
Universal messaging means your BASIC scripts work across all channels without modification. BotServer handles the complexity of channel-specific formatting and delivery, letting you focus on the conversation logic.

View file

@ -390,4 +390,16 @@ Extending BotServer allows you to:
- Implement custom business logic
- Enhance the platform's capabilities
The modular architecture and clear extension points make it straightforward to add new features while maintaining system stability and performance.
The modular architecture and clear extension points make it straightforward to add new features while maintaining system stability and performance.
## See Also
- [Prompt Manager](./prompt-manager.md) - Managing AI prompts and responses
- [Hooks System](./hooks.md) - Event-driven extensions
- [Adapter Development](./adapters.md) - Creating custom adapters
- [Chapter 2: Packages](../chapter-02/README.md) - Understanding bot components
- [Chapter 3: KB and Tools](../chapter-03/kb-and-tools.md) - Knowledge base and tool system
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Complete command reference
- [Chapter 8: External APIs](../chapter-08/external-apis.md) - API integration patterns
- [Chapter 9: Advanced Topics](../chapter-09/README.md) - Advanced features
- [Chapter 10: Development](../chapter-10/README.md) - Development tools and practices

View file

@ -17,9 +17,9 @@ src/basic/keywords/
├── mod.rs # Module registration
├── hear_talk.rs # HEAR and TALK keywords
├── llm_keyword.rs # LLM keyword
├── bot_memory.rs # GET_BOT_MEMORY, SET_BOT_MEMORY
├── use_kb.rs # USE_KB keyword
├── clear_kb.rs # CLEAR_KB keyword
├── bot_memory.rs # GET BOT MEMORY, SET BOT MEMORY
├── use_kb.rs # USE KB keyword
├── clear_kb.rs # CLEAR KB keyword
├── get.rs # GET keyword
├── format.rs # FORMAT keyword
└── [other keywords].rs
@ -115,7 +115,7 @@ Keywords are registered in the BASIC interpreter initialization. The registratio
### Pattern 1: Database Operations
Keywords that interact with the database (like `GET_BOT_MEMORY`):
Keywords that interact with the database (like `GET BOT MEMORY`):
```rust
pub fn database_keyword(state: Arc<AppState>, user: UserSession, engine: &mut Engine) {
@ -169,7 +169,7 @@ pub fn async_keyword(state: Arc<AppState>, user: UserSession, engine: &mut Engin
### Pattern 3: Session Management
Keywords that modify session state (like `USE_KB`, `CLEAR_KB`):
Keywords that modify session state (like `USE KB`, `CLEAR KB`):
```rust
pub fn register_session_keyword(

View file

@ -49,11 +49,14 @@ id,category,name,content,model,version
Prompts are automatically loaded and can be referenced in dialogs:
```basic
' Use a predefined prompt
response = LLM "Use prompt: customer_service"
' For background processing only - not for interactive conversations
' Generate content for storage
summary = LLM "Use prompt: customer_service"
SET BOT MEMORY "service_info", summary
' Override with custom prompt
response = LLM "You are a technical support agent. Help with: " + issue
' For interactive conversations, use SET CONTEXT
SET CONTEXT "support_issue", issue
TALK "How can I help you with your technical issue?"
```
## Rust API
@ -220,14 +223,14 @@ The Prompt Manager is automatically available in BASIC dialogs:
' Load custom prompt library
LOAD_PROMPTS "custom_prompts.csv"
' Use a prompt by name
response = LLM PROMPT("customer_greeting")
' For background processing - generate content once
greeting = LLM PROMPT("customer_greeting")
SET BOT MEMORY "standard_greeting", greeting
' Use prompt with variables
vars = CREATE_MAP()
vars["name"] = customer_name
vars["issue"] = support_ticket
response = LLM FORMAT_PROMPT("support_response", vars)
' For interactive conversations with variables
SET CONTEXT "customer_name", customer_name
SET CONTEXT "support_ticket", support_ticket
TALK "Let me help you with your support request."
```
## Monitoring and Analytics

View file

@ -27,3 +27,16 @@ The file is a simple CSV; each line is `key,value`. Comments start with `#`. Aft
- Adjusting **answer_mode** influences the order of tool invocation and LLM calls.
For advanced configuration, see `src/bot/config.rs` which parses this file into the `BotConfig` struct.
## See Also
- [config.csv Reference](./config-csv.md) - Complete configuration options
- [PostgreSQL Setup](./postgresql.md) - Database configuration
- [MinIO Storage](./minio.md) - Object storage setup
- [Qdrant Vector DB](./qdrant.md) - Vector database configuration
- [Valkey Cache](./valkey.md) - Caching layer setup
- [Chapter 2: .gbot](../chapter-02/gbot.md) - Bot configuration package
- [Chapter 3: Knowledge Base](../chapter-03/README.md) - KB configuration
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Script configuration
- [Chapter 9: Storage](../chapter-09/storage.md) - Storage architecture
- [Chapter 11: Infrastructure](../chapter-11/README.md) - Complete infrastructure guide

View file

@ -1,36 +0,0 @@
## Tooling
The **Tooling** chapter lists all builtin keywords and their oneline descriptions.
| Keyword | Description |
|---------|-------------|
| `TALK` | Send a message to the user. |
| `HEAR` | Receive user input. |
| `LLM` | Invoke the configured largelanguagemodel. |
| `USE_TOOL` | Register a custom tool at runtime. |
| `GET` | Retrieve a value from the session store. |
| `SET` | Store a value in the session store. |
| `FORMAT` | Format numbers, dates, or text. |
| `USE_KB` | Create a new knowledgebase collection. |
| `SET_KB` | Switch the active knowledgebase. |
| `ADD_WEBSITE` | Crawl and index a website. |
| `CALL` | Invoke a registered tool synchronously. |
| `CALL_ASYNC` | Invoke a tool asynchronously. |
| `LIST_TOOLS` | List all available tools for the session. |
| `REMOVE_TOOL` | Unregister a tool. |
| `CLEAR_TOOLS` | Remove all custom tools. |
| `FIRST` / `LAST` | Access first/last element of a collection. |
| `FOR EACH` / `EXIT FOR` | Iterate over collections. |
| `IF` / `ELSE` / `ENDIF` | Conditional execution. |
| `WHILE` / `ENDWHILE` | Loop while a condition holds. |
| `REPEAT` / `UNTIL` | Loop until a condition is met. |
| `WAIT` | Pause execution for a given duration. |
| `ON` | Register an event handler. |
| `SET_SCHEDULE` | Define a scheduled task. |
| `PRINT` | Output debugging information. |
| `GET_BOT_MEMORY` / `SET_BOT_MEMORY` | Access botwide memory store. |
| `CREATE_SITE` | Create a new website entry in a knowledge base. |
| `CREATE_DRAFT` | Generate a draft document. |
| `WEBSITE OF` | Reference a website object. |
| `FIND` | Search within collections. |
| `GET` / `SET` | Generic getters/setters for variables. |
| `...` | See the full keyword list in `chapter-05/keywords.md`. |

View file

@ -0,0 +1,47 @@
## Tooling
The **Tooling** chapter lists all builtin keywords and their oneline descriptions.
| Keyword | Description |
|---------|-------------|
| `TALK` | Send a message to the user. |
| `HEAR` | Receive user input. |
| `LLM` | Invoke the configured largelanguagemodel. |
| `USE TOOL` | Register a custom tool at runtime. |
| `GET` | Retrieve a value from the session store. |
| `SET` | Store a value in the session store. |
| `FORMAT` | Format numbers, dates, or text. |
| `USE KB` | Create a new knowledgebase collection. |
| `SET KB` | Switch the active knowledgebase. |
| `ADD WEBSITE` | Crawl and index a website. |
| `CALL` | Invoke a registered tool synchronously. |
| `CALL_ASYNC` | Invoke a tool asynchronously. |
| `LIST TOOLS` | List all available tools for the session. |
| `REMOVE TOOL` | Unregister a tool. |
| `CLEAR TOOLS` | Remove all custom tools. |
| `FIRST` / `LAST` | Access first/last element of a collection. |
| `FOR EACH` / `EXIT FOR` | Iterate over collections. |
| `IF` / `ELSE` / `ENDIF` | Conditional execution. |
| `WHILE` / `ENDWHILE` | Loop while a condition holds. |
| `REPEAT` / `UNTIL` | Loop until a condition is met. |
| `WAIT` | Pause execution for a given duration. |
| `ON` | Register an event handler. |
| `SET SCHEDULE` | Define a scheduled task. |
| `PRINT` | Output debugging information. |
| `GET BOT MEMORY` / `SET BOT MEMORY` | Access botwide memory store. |
| `CREATE SITE` | Create a new website entry in a knowledge base. |
| `CREATE DRAFT` | Generate a draft document. |
| `WEBSITE OF` | Reference a website object. |
| `FIND` | Search within collections. |
| `GET` / `SET` | Generic getters/setters for variables. |
| `...` | See the full keyword list in `chapter-05/keywords.md`. |
## See Also
- [External APIs](./external-apis.md) - Integrating with external services
- [GET Integration](./get-integration.md) - Using the GET command
- [Chapter 2: Packages](../chapter-02/README.md) - Understanding bot components
- [Chapter 3: KB and Tools](../chapter-03/kb-and-tools.md) - Knowledge base and tool system
- [Chapter 5: BASIC Reference](../chapter-05/README.md) - Complete command reference
- [Chapter 6: Extensions](../chapter-06/README.md) - Extending BotServer
- [Chapter 9: Advanced Topics](../chapter-09/README.md) - Advanced integration patterns
- [Chapter 12: Web API](../chapter-12/README.md) - REST and WebSocket APIs

View file

@ -149,7 +149,7 @@ Common compilation errors:
After successful compilation:
1. Tool is stored in database
2. Available for `USE_TOOL` keyword
2. Available for `USE TOOL` keyword
3. Discoverable by LLM
4. Can be invoked in conversations
@ -166,7 +166,7 @@ To debug compilation issues:
1. Check logs for compilation errors
2. Inspect working directory files
3. Verify parameter syntax
4. Test tool manually with `USE_TOOL`
4. Test tool manually with `USE TOOL`
## Best Practices

View file

@ -56,7 +56,7 @@ TALK "Quote of the day: " + quote
### API Key in URL
```basic
let api_key = GET_BOT_MEMORY("weather_api_key")
let api_key = GET BOT MEMORY("weather_api_key")
let url = "https://api.weather.com/data?key=" + api_key
let data = GET url
```
@ -75,7 +75,7 @@ Currently, BotServer's GET keyword doesn't support custom headers directly. For
PARAM city AS string LIKE "Seattle" DESCRIPTION "City for weather"
DESCRIPTION "Gets current weather for a city"
let api_key = GET_BOT_MEMORY("openweather_key")
let api_key = GET BOT MEMORY("openweather_key")
let url = "https://api.openweathermap.org/data/2.5/weather?q=" + city + "&appid=" + api_key
let response = GET url
@ -88,7 +88,7 @@ TALK weather
```basic
DESCRIPTION "Fetches latest news headlines"
let api_key = GET_BOT_MEMORY("newsapi_key")
let api_key = GET BOT MEMORY("newsapi_key")
let url = "https://newsapi.org/v2/top-headlines?country=us&apiKey=" + api_key
let news = GET url
@ -108,8 +108,10 @@ DESCRIPTION "Converts currency using exchange rates"
let url = "https://api.exchangerate-api.com/v4/latest/" + from_currency
let rates = GET url
let result = LLM "Calculate " + amount + " " + from_currency + " to " + to_currency + " using rates: " + rates
TALK result
' Parse rates and calculate conversion
let rate = PARSE_JSON(rates, "rates." + to_currency)
let converted = amount * rate
TALK amount + " " + from_currency + " = " + converted + " " + to_currency
```
## Error Handling
@ -152,8 +154,8 @@ When integrating with external APIs:
```basic
# Check cache first
let cached = GET_BOT_MEMORY("weather_cache")
let cache_time = GET_BOT_MEMORY("weather_cache_time")
let cached = GET BOT MEMORY("weather_cache")
let cache_time = GET BOT MEMORY("weather_cache_time")
let current_time = NOW()
let age = current_time - cache_time
@ -164,8 +166,8 @@ if (cached != "" && age < 3600) {
} else {
# Fetch fresh data
let fresh = GET "https://api.weather.com/current"
SET_BOT_MEMORY "weather_cache", fresh
SET_BOT_MEMORY "weather_cache_time", current_time
SET BOT MEMORY "weather_cache", fresh
SET BOT MEMORY "weather_cache_time", current_time
TALK fresh
}
```
@ -176,11 +178,11 @@ if (cached != "" && age < 3600) {
```basic
# Store API keys in bot memory, not in scripts
let api_key = GET_BOT_MEMORY("api_key")
let api_key = GET BOT MEMORY("api_key")
# Never hardcode credentials
# BAD: let key = "sk-1234567890abcdef"
# GOOD: let key = GET_BOT_MEMORY("openai_key")
# GOOD: let key = GET BOT MEMORY("openai_key")
```
### Input Validation
@ -226,20 +228,19 @@ PARAM location AS string LIKE "New York" DESCRIPTION "Location to check"
DESCRIPTION "Provides weather and news for a location"
# Weather API
let weather_key = GET_BOT_MEMORY("weather_api_key")
let weather_key = GET BOT MEMORY("weather_api_key")
let weather_url = "https://api.openweathermap.org/data/2.5/weather?q=" + location + "&appid=" + weather_key
let weather = GET weather_url
# News API
let news_key = GET_BOT_MEMORY("news_api_key")
let news_key = GET BOT MEMORY("news_api_key")
let news_url = "https://newsapi.org/v2/everything?q=" + location + "&apiKey=" + news_key
let news = GET news_url
# Combine and summarize
let combined = "Weather: " + weather + "\n\nNews: " + news
let report = LLM "Create a brief local report for " + location + " from: " + combined
TALK report
# Present the information
TALK "Here's your local update for " + location + ":"
TALK "Weather: " + weather
TALK "Latest news: " + news
```
## Best Practices

View file

@ -107,10 +107,10 @@ Common errors:
### Loading Knowledge Base Documents
```basic
# In update-summary.bas
# In update-summary.bas - background processing script
let text = GET "announcements.gbkb/news/news.pdf"
let summary = LLM "Summarize this: " + text
SET_BOT_MEMORY "news_summary", summary
let summary = LLM "Summarize this: " + text # LLM for background processing only
SET BOT MEMORY "news_summary", summary # Stored for all users
```
### Reading Configuration Files
@ -209,8 +209,9 @@ let content = GET doc_path
if (content == "") {
TALK "Document not found: " + doc_path
} else {
let summary = LLM "Create a brief summary: " + content
TALK summary
# Set document as context for system AI
SET CONTEXT "document", content
TALK "I've loaded the document. What would you like to know about it?"
}
```
@ -221,8 +222,9 @@ PARAM data_file AS string LIKE "data/sales.csv" DESCRIPTION "Data file to proces
DESCRIPTION "Analyzes sales data"
let csv_data = GET data_file
let analysis = LLM "Analyze this sales data: " + csv_data
TALK analysis
# Set data as context for system AI
SET CONTEXT "sales_data", csv_data
TALK "I've loaded the sales data. What analysis would you like me to perform?"
```
## Security Considerations

Some files were not shown because too many files have changed in this diff Show more