Enhanced Chapter 1 documentation with detailed session architecture, storage layers, and API endpoints. Added new Part XI on authentication and security to SUMMARY.md, introducing chapters on user and bot authentication, password security, and API endpoints. Improves clarity and coverage of system interaction and security concepts. |
||
|---|---|---|
| .. | ||
| first-conversation.md | ||
| installation.md | ||
| README.md | ||
| sessions.md | ||
Run and Talk
TALK "Welcome! How can I help you today?"
HEAR user_input
Start the server: cargo run --release
Installation
# Clone the repository
git clone https://github.com/GeneralBots/BotServer.git
cd BotServer
# Build the project
cargo build --release
# Run the server
cargo run --release
First Conversation
TALK "Hello! I'm your GeneralBots assistant."
HEAR user_input
IF user_input CONTAINS "weather" THEN
TALK "Sure, let me check the weather for you."
CALL GET_WEATHER
ELSE
TALK "I can help with many tasks, just ask!"
ENDIF
Understanding Sessions
Each conversation is represented by a BotSession that persists across multiple interactions. The session manages:
- User identity (authenticated or anonymous)
- Conversation history (full message transcript)
- Context state (variables, knowledge base references, active tools)
- Interaction metrics (message counts, timing)
Storage Architecture
Sessions use a multi-layer persistence model:
- PostgreSQL - Primary storage for all session data
- Redis - Caching layer for active session state
- In-memory - Hot session data for performance
Key API Endpoints
POST /api/sessions- Create new sessionGET /api/sessions- List user sessionsPOST /api/sessions/{id}/start- Activate sessionGET /api/sessions/{id}- Get conversation history
Advanced Features
- Context compaction - Reduces memory usage for long conversations
- Interaction counting - Tracks message frequency
- Multi-device sync - Shared state across clients