botserver/docs/src/chapter-02/gbdrive.md

1.9 KiB

.gbdrive File Storage

The .gbdrive system manages file storage and retrieval using object storage (S3-compatible drive).

What is .gbdrive?

.gbdrive provides:

  • Centralized file storage for all packages
  • Versioning and backup capabilities
  • Access control and organization
  • Integration with knowledge bases and tools

Storage Structure

Files are organized in a bucket-per-bot structure:

org-prefixbot-name.gbai/
  .gbdialog/
    [script files]
  .gbkb/
    [collection folders]
  .gbot/
    config.csv
  .gbtheme/
    [theme files]
  user-uploads/
    [user files]

File Operations

Uploading Files

REM Files can be uploaded via API or interface
REM They are stored in the bot's storage bucket

Retrieving Files

REM Get file content as text
GET ".gbdialog/start.bas"

REM Download files via URL
GET "user-uploads/document.pdf"

File Management

  • Automatic synchronization on bot start
  • Change detection for hot reloading
  • Version history maintenance
  • Backup and restore capabilities

Integration Points

Knowledge Bases

  • Documents are stored in .gbkb collections
  • Automatic processing and embedding
  • Version tracking for updates

Themes

  • Static assets served from .gbtheme
  • CSS, JS, and HTML files
  • Caching for performance

Tools

  • Tool scripts stored in .gbdialog
  • AST and compiled versions
  • Dependency management

Access Control

Files have different access levels:

  • Public: Accessible without authentication
  • Authenticated: Requires user login
  • Bot-only: Internal bot files
  • Admin: Configuration and sensitive files

Storage Backends

  • Object Storage (default): Self-hosted S3-compatible drive
  • 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