Skip to content

Appendix

Appendices

This section provides extra resources to help you configure, use, and understand the MindFlight AI Server more effectively.


✅ Full Example of config.yaml

Here’s a complete example of a typical config.yaml file:

server:
  address: ":8080"
  timeout: 30s

auth:
  jwt_secret: "YOUR_SUPER_SECRET_KEY"
  token_expiry: 24h

database:
  host: "localhost"
  port: 5432
  user: "mindflight_user"
  password: "securepassword"
  dbname: "mindflight_db"
  sslmode: "disable"

providers:
  filesystem:
    enabled: true
    allowed_dirs: ["/tmp", "/data"]

  unipile:
    enabled: true
    api_key: "UNIPILE_API_KEY"
    base_url: "https://api.unipile.com"

  email_draft_preparator:
    enabled: true

notifications:
  retry_attempts: 3
  retry_delay: 5s

jobmanager:
  worker_count: 5
  max_retries: 3

Tips:

  • Keep your jwt_secret and database.password secure (use environment variables in production).
  • You can disable Providers by setting enabled: false.

✅ Cheatsheet of API Endpoints

Category Endpoint Method Description
Auth /api/login POST Login and retrieve JWT token.
Chat /api/chat POST Send a message to the AI assistant.
Memory /api/memory/set POST Set a key-value pair.
/api/memory/get?key={key} GET Retrieve a value by key.
Tools /api/tools/{tool_name} POST Execute a Provider tool.
Jobs /api/jobs/status/{job_id} GET Check the status of a background job.
Notifications /api/notifications/subscribe POST Subscribe to webhook events.
Webhooks (Providers) /webhooks/unipile/notify POST Incoming webhook for Unipile.
Provider-Specific /api/tools/unipile_list_emails POST List emails via Unipile.
/api/tools/email_draft_prepare POST Prepare an email draft.
/api/tools/email_draft_send POST Send a prepared email draft.

✅ Database Schema Overview (Mermaid Diagram)

Here’s a simplified schema of the key tables used by the server.

erDiagram
    USERS {
        UUID id PK
        STRING username
        STRING password_hash
        TIMESTAMP created_at
    }

    PROVIDERS {
        UUID id PK
        STRING name
        JSON config
        TIMESTAMP created_at
    }

    JOBS {
        UUID id PK
        STRING type
        JSON payload
        STRING status
        TIMESTAMP created_at
        TIMESTAMP updated_at
    }

    NOTIFICATIONS {
        UUID id PK
        STRING event
        STRING callback_url
        TIMESTAMP created_at
    }

    USERS ||--o{ JOBS : owns
    USERS ||--o{ NOTIFICATIONS : subscribes
    PROVIDERS ||--o{ JOBS : triggers

Main relationships:

  • A User can have many Jobs and Notifications.
  • A Provider can trigger multiple Jobs.

Quick Tips

  • 📥 Data persistence: All critical data (users, jobs, notifications) are stored in PostgreSQL.
  • 🔄 Pub/Sub: Events are broadcast internally using PostgreSQL channels.
  • 🛠 Extensibility: You can add new Providers with minimal changes to the core server.