botserver/docs/src/chapter-04-gbui/apps/sources.md

49 KiB
Raw Blame History

Sources - Prompts & Templates

Your bot configuration hub

Sources Flow


Overview

Sources is the configuration center in General Bots Suite. Manage your bots, prompts, templates, and knowledge bases all in one place. Sources is where you create new bots, customize their behavior, and organize the content that powers your AI assistant.


Interface Layout

┌─────────────────────────────────────────────────────────────────────────┐
│  Sources                              [+ New Bot] [Import] [⚙️]    [×]  │
├──────────────┬──────────────────────────────────────────────────────────┤
│              │  ┌─────────────────────────────────────────────────────┐ │
│  SECTIONS    │  │  Bots    │  Prompts  │  Templates  │  Knowledge     │ │
│  ───────────  │  └─────────────────────────────────────────────────────┘ │
│              │                                                          │
│  🤖 Bots     │  YOUR BOTS                                      [Grid]   │
│  💬 Prompts  │  ─────────                                               │
│  📋 Templates│                                                          │
│  📚 Knowledge│  ┌─────────────────┐  ┌─────────────────┐               │
│              │  │  🤖 support     │  │  🤖 sales       │               │
│  ───────────  │  │  ─────────────  │  │  ─────────────  │               │
│              │  │  Customer       │  │  Lead capture   │               │
│  QUICK       │  │  Support Bot    │  │  and sales      │               │
│  ACTIONS     │  │                 │  │                 │               │
│  ───────────  │  │  Status: ● Live │  │  Status: ○ Draft│               │
│  [New Bot]   │  │  Sessions: 145  │  │  Sessions: 0    │               │
│  [Import]    │  │                 │  │                 │               │
│  [Export]    │  │  [Open] [⚙️]    │  │  [Open] [⚙️]    │               │
│              │  └─────────────────┘  └─────────────────┘               │
│              │                                                          │
│              │  ┌─────────────────┐  ┌─────────────────┐               │
│              │  │  🤖 hr          │  │   New Bot     │               │
│              │  │  ─────────────  │  │                 │               │
│              │  │  HR Assistant   │  │  Create a new   │               │
│              │  │  for employees  │  │  bot from       │               │
│              │  │                 │  │  scratch or     │               │
│              │  │  Status: ● Live │  │  template       │               │
│              │  │  Sessions: 89   │  │                 │               │
│              │  │                 │  │  [+ Create]     │               │
│              │  │  [Open] [⚙️]    │  │                 │               │
│              │  └─────────────────┘  └─────────────────┘               │
│              │                                                          │
└──────────────┴──────────────────────────────────────────────────────────┘

Features

Managing Bots

Creating a New Bot

  1. Click + New Bot in the top right
  2. Fill in the bot details:
┌─────────────────────────────────────────────────────────────────────────┐
│  Create New Bot                                                   [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  Bot ID (unique identifier):                                            │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ support                                                         │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│  ⚠️ Use lowercase letters, numbers, and hyphens only                    │
│                                                                         │
│  Display Name:                                                          │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ Customer Support Bot                                            │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Description:                                                           │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ Handles customer inquiries, troubleshooting, and ticket        │   │
│  │ creation for our product support team.                         │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Start from:                                                            │
│  ○ Blank - Start from scratch                                           │
│  ● Template - Use a pre-built template                                  │
│    [Support Bot Template    ▼]                                          │
│  ○ Clone - Copy existing bot                                            │
│    [Select bot...           ▼]                                          │
│                                                                         │
│  ───────────────────────────────────────────────────────────────────    │
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                      Create Bot                                 │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Bot Settings

Click the ⚙️ icon on any bot to configure:

┌─────────────────────────────────────────────────────────────────────────┐
│  Bot Settings: support                                            [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  ┌──────────┬──────────┬──────────┬──────────┬──────────┐              │
│  │ General  │    AI    │ Channels │ Security │ Advanced │              │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘              │
│                                                                         │
│  GENERAL SETTINGS                                                       │
│  ────────────────                                                       │
│                                                                         │
│  Bot ID:        support (cannot be changed)                             │
│                                                                         │
│  Display Name:                                                          │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ Customer Support Bot                                            │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Welcome Message:                                                       │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ Hello! I'm your support assistant. How can I help you today?   │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Language:      [English (US)      ▼]                                   │
│  Timezone:      [America/New_York  ▼]                                   │
│                                                                         │
│  Status:                                                                │
│  ● Live - Bot is active and responding                                  │
│  ○ Draft - Bot is hidden from users                                     │
│  ○ Maintenance - Shows maintenance message                              │
│                                                                         │
│  ┌─────────────┐  ┌─────────────┐                                      │
│  │    Save     │  │   Cancel    │                                      │
│  └─────────────┘  └─────────────┘                                      │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

AI Settings

┌─────────────────────────────────────────────────────────────────────────┐
│  Bot Settings: support                                            [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  ┌──────────┬──────────┬──────────┬──────────┬──────────┐              │
│  │ General  │   *AI*   │ Channels │ Security │ Advanced │              │
│  └──────────┴──────────┴──────────┴──────────┴──────────┘              │
│                                                                         │
│  AI MODEL                                                               │
│  ────────                                                               │
│                                                                         │
│  Provider:      [OpenAI           ▼]                                    │
│  Model:         [GPT-4            ▼]                                    │
│                                                                         │
│  BEHAVIOR                                                               │
│  ────────                                                               │
│                                                                         │
│  Temperature:   [0.7    ] ░░░░░░░▓░░░ (More creative ←→ More focused)  │
│  Max Tokens:    [2048   ]                                               │
│                                                                         │
│  SYSTEM PROMPT (Personality & Instructions)                             │
│  ──────────────────────────────────────────                             │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ You are a helpful customer support agent for TechCorp.         │   │
│  │ Be friendly, professional, and concise.                        │   │
│  │ Always try to resolve issues on first contact.                 │   │
│  │ If you can't help, create a support ticket.                    │   │
│  │ Never make up information - use the knowledge base.            │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  KNOWLEDGE BASE                                                         │
│  ──────────────                                                         │
│  ☑ Use knowledge base for answers                                       │
│  Connected KB: [support.gbkb       ▼]                                   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Managing Prompts

Prompts are reusable text templates for AI interactions.

Prompts List

┌─────────────────────────────────────────────────────────────────────────┐
│  Prompts                                              [+ New Prompt]    │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  🔍 Search prompts...                                                   │
│                                                                         │
│  SYSTEM PROMPTS                                                         │
│  ──────────────                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📝 support-agent                                         [Edit] │   │
│  │    Customer support personality and guidelines                  │   │
│  │    Used by: support, help-desk                                  │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📝 sales-agent                                           [Edit] │   │
│  │    Sales-focused, lead qualification                            │   │
│  │    Used by: sales                                               │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  TASK PROMPTS                                                           │
│  ────────────                                                           │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📝 summarize                                             [Edit] │   │
│  │    Summarize text or conversations                              │   │
│  │    Used by: all bots                                            │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📝 extract-info                                          [Edit] │   │
│  │    Extract structured data from text                            │   │
│  │    Used by: intake, forms                                       │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Creating a Prompt

┌─────────────────────────────────────────────────────────────────────────┐
│  Edit Prompt: support-agent                                       [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  Name:                                                                  │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ support-agent                                                   │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Type: [System Prompt   ▼]                                              │
│        ┌────────────────┐                                               │
│        │ System Prompt  │  Bot personality/behavior                     │
│        │ Task Prompt    │  Specific task instructions                   │
│        │ Template       │  Reusable text with variables                 │
│        └────────────────┘                                               │
│                                                                         │
│  Prompt Content:                                                        │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ You are a friendly and professional customer support agent     │   │
│  │ for {{company_name}}.                                          │   │
│  │                                                                 │   │
│  │ ## Your Personality                                            │   │
│  │ - Be warm and empathetic                                       │   │
│  │ - Use simple, clear language                                   │   │
│  │ - Be patient and thorough                                      │   │
│  │                                                                 │   │
│  │ ## Guidelines                                                  │   │
│  │ - Always verify customer identity before sharing account info  │   │
│  │ - If unsure, search the knowledge base                         │   │
│  │ - Escalate complex issues to human agents                      │   │
│  │ - Never make promises about refunds or compensation            │   │
│  │                                                                 │   │
│  │ ## Available Tools                                             │   │
│  │ - SEARCH KB: Search knowledge base                             │   │
│  │ - CREATE TICKET: Create support ticket                         │   │
│  │ - GET ORDER: Look up order status                              │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  Variables Used:                                                        │
│  {{company_name}} - Will be replaced with bot's company setting         │
│                                                                         │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────────┐     │
│  │    Save     │  │   Test      │  │   Delete Prompt             │     │
│  └─────────────┘  └─────────────┘  └─────────────────────────────┘     │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Managing Templates

Templates are pre-built bot packages you can reuse.

┌─────────────────────────────────────────────────────────────────────────┐
│  Templates                                            [+ Import]        │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  🔍 Search templates...                   [All Categories ▼]            │
│                                                                         │
│  INSTALLED TEMPLATES                                                    │
│  ───────────────────                                                    │
│                                                                         │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐         │
│  │  📋 CRM         │  │  📋 Support     │  │  📋 FAQ         │         │
│  │  ───────────    │  │  ───────────    │  │  ───────────    │         │
│  │  Full CRM       │  │  Ticket mgmt    │  │  Answer common  │         │
│  │  with leads,    │  │  and customer   │  │  questions      │         │
│  │  contacts       │  │  service        │  │  from KB        │         │
│  │                 │  │                 │  │                 │         │
│  │  [Use] [View]   │  │  [Use] [View]   │  │  [Use] [View]   │         │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘         │
│                                                                         │
│  AVAILABLE TEMPLATES                                                    │
│  ───────────────────                                                    │
│                                                                         │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────┐         │
│  │  📋 HR          │  │  📋 Analytics   │  │  📋 Compliance  │         │
│  │  ───────────    │  │  ───────────    │  │  ───────────    │         │
│  │  Employee       │  │  Dashboard      │  │  LGPD, GDPR     │         │
│  │  self-service   │  │  and metrics    │  │  compliance     │         │
│  │                 │  │                 │  │                 │         │
│  │  [Install]      │  │  [Install]      │  │  [Install]      │         │
│  └─────────────────┘  └─────────────────┘  └─────────────────┘         │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Template Contents

┌─────────────────────────────────────────────────────────────────────────┐
│  Template: CRM                                                    [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  📋 CRM - Customer Relationship Management                              │
│  ════════════════════════════════════════                               │
│                                                                         │
│  A complete CRM system for managing leads, contacts, accounts,          │
│  and opportunities through conversational AI.                           │
│                                                                         │
│  INCLUDED COMPONENTS                                                    │
│  ───────────────────                                                    │
│                                                                         │
│  📁 crm.gbai/                                                           │
│  ├── 📁 crm.gbdialog/                                                   │
│  │   ├── start.bas         - Main entry point                          │
│  │   ├── create-lead.bas   - Lead creation flow                        │
│  │   ├── find-contact.bas  - Contact lookup                            │
│  │   └── update-deal.bas   - Deal management                           │
│  │                                                                      │
│  ├── 📁 crm.gbot/                                                       │
│  │   └── config.csv        - Bot settings                              │
│  │                                                                      │
│  └── 📁 crm.gbkb/                                                       │
│      └── docs/             - CRM documentation                         │
│                                                                         │
│  FEATURES                                                               │
│  ────────                                                               │
│  ✓ Lead capture and scoring                                             │
│  ✓ Contact management                                                   │
│  ✓ Account hierarchy                                                    │
│  ✓ Opportunity tracking                                                 │
│  ✓ Activity logging                                                     │
│  ✓ Reports and dashboards                                               │
│                                                                         │
│  SAMPLE CONVERSATION                                                    │
│  ───────────────────                                                    │
│  User: Create a new lead                                                │
│  Bot:  I'll help you create a new lead. What's their name?              │
│  User: John Smith                                                       │
│  Bot:  Got it! What's John Smith's email address?                       │
│  User: john@example.com                                                 │
│  Bot:  What company is John from?                                       │
│  User: Acme Corp                                                        │
│  Bot:  ✓ Lead created: John Smith (Acme Corp)                           │
│        Score: 45/100 | Status: New                                      │
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │                   Use This Template                             │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Managing Knowledge Bases

┌─────────────────────────────────────────────────────────────────────────┐
│  Knowledge Bases                                       [+ New KB]       │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  YOUR KNOWLEDGE BASES                                                   │
│  ───────────────────                                                    │
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📚 support.gbkb                                          [Open] │   │
│  │    Customer support documentation                               │   │
│  │    Documents: 45  │  Size: 12.3 MB  │  Last indexed: 2h ago     │   │
│  │    Used by: support, help-desk                                  │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📚 products.gbkb                                         [Open] │   │
│  │    Product specifications and manuals                           │   │
│  │    Documents: 128 │  Size: 45.6 MB  │  Last indexed: 1d ago     │   │
│  │    Used by: sales, support                                      │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
│  ┌─────────────────────────────────────────────────────────────────┐   │
│  │ 📚 hr.gbkb                                               [Open] │   │
│  │    Employee handbook and HR policies                            │   │
│  │    Documents: 23  │  Size: 5.1 MB   │  Last indexed: 3h ago     │   │
│  │    Used by: hr                                                  │   │
│  └─────────────────────────────────────────────────────────────────┘   │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Knowledge Base Details

┌─────────────────────────────────────────────────────────────────────────┐
│  Knowledge Base: support.gbkb                    [Reindex] [⚙️]   [×]   │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                         │
│  Status: ● Indexed and ready          Last indexed: May 15, 2025 2:30PM │
│                                                                         │
│  DOCUMENTS                                          [Upload] [+ Folder] │
│  ─────────                                                              │
│                                                                         │
│  📁 policies/                                                           │
│  ├── 📄 refund-policy.pdf                    45 KB    May 10, 2025     │
│  ├── 📄 shipping-policy.pdf                  32 KB    May 10, 2025     │
│  └── 📄 warranty-terms.pdf                   28 KB    May 10, 2025     │
│                                                                         │
│  📁 faqs/                                                               │
│  ├── 📄 general-faq.docx                     18 KB    May 12, 2025     │
│  ├── 📄 billing-faq.docx                     22 KB    May 12, 2025     │
│  └── 📄 technical-faq.docx                   35 KB    May 12, 2025     │
│                                                                         │
│  📁 product-guides/                                                     │
│  ├── 📄 getting-started.pdf                 125 KB    May 8, 2025      │
│  ├── 📄 advanced-features.pdf               210 KB    May 8, 2025      │
│  └── 📄 troubleshooting.pdf                  89 KB    May 8, 2025      │
│                                                                         │
│  STATISTICS                                                             │
│  ──────────                                                             │
│  Total documents: 45                                                    │
│  Total chunks: 1,234                                                    │
│  Vector dimensions: 1536                                                │
│  Storage used: 12.3 MB                                                  │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

Import and Export

Exporting a Bot

  1. Click ⚙️ on the bot
  2. Select Export
  3. Choose format:
┌─────────────────────────────────────────┐
│  Export Bot: support                [×] │
├─────────────────────────────────────────┤
│                                         │
│  Include:                               │
│  ☑ Bot configuration                    │
│  ☑ Dialog scripts (.bas files)          │
│  ☑ Prompts                              │
│  ☐ Knowledge base (large)               │
│  ☐ Conversation history                 │
│                                         │
│  Format:                                │
│  ● .gbai package (recommended)          │
│  ○ ZIP archive                          │
│  ○ JSON (config only)                   │
│                                         │
│  ┌─────────────────────────────────┐    │
│  │          Export                 │    │
│  └─────────────────────────────────┘    │
│                                         │
└─────────────────────────────────────────┘

Importing a Bot

  1. Click Import at the top
  2. Select your file
  3. Configure import options
┌─────────────────────────────────────────┐
│  Import Bot                       [×]   │
├─────────────────────────────────────────┤
│                                         │
│  ┌─────────────────────────────────┐    │
│  │                                 │    │
│  │   📁 Drop file here or click   │    │
│  │      to browse                  │    │
│  │                                 │    │
│  │   Supported: .gbai, .zip        │    │
│  │                                 │    │
│  └─────────────────────────────────┘    │
│                                         │
│  File: support-backup.gbai              │
│  Size: 2.4 MB                           │
│                                         │
│  Options:                               │
│  ○ Create new bot                       │
│  ● Replace existing: [support    ▼]     │
│                                         │
│  ☐ Overwrite prompts                    │
│  ☑ Merge knowledge base                 │
│                                         │
│  ┌─────────────────────────────────┐    │
│  │          Import                 │    │
│  └─────────────────────────────────┘    │
│                                         │
└─────────────────────────────────────────┘

Keyboard Shortcuts

Shortcut Action
Ctrl+N New bot
Ctrl+S Save changes
Ctrl+E Export selected
Ctrl+I Import
Delete Delete selected
Ctrl+D Duplicate
F2 Rename
/ Search
Enter Open selected
Escape Close dialog

Tips & Tricks

Bot Management

💡 Use descriptive names - "customer-support-v2" is better than "bot1"

💡 Keep prompts separate - Reuse prompts across multiple bots

💡 Version your exports - Export before major changes

💡 Test in Draft mode - Don't go Live until fully tested

Prompt Writing

💡 Be specific - Clear instructions give better results

💡 Use examples - Show the AI what good responses look like

💡 Set boundaries - Define what the bot should NOT do

💡 Use variables - Make prompts reusable with {{placeholders}}

Knowledge Base

💡 Organize in folders - Group related documents together

💡 Keep documents current - Remove outdated information

💡 Use clear filenames - "refund-policy-2025.pdf" not "doc1.pdf"

💡 Reindex after changes - New content isn't searchable until indexed


Troubleshooting

Bot not responding

Possible causes:

  1. Bot is in Draft mode
  2. AI provider not configured
  3. No dialogs or prompts set up

Solution:

  1. Check bot status is "Live"
  2. Verify AI settings have valid API key
  3. Ensure at least start.bas exists
  4. Check error logs in Analytics

Knowledge base not finding answers

Possible causes:

  1. Documents not indexed
  2. Document format not supported
  3. Query doesn't match content

Solution:

  1. Click "Reindex" and wait for completion
  2. Convert documents to supported formats
  3. Check document actually contains the information
  4. Try different phrasing

Import fails

Possible causes:

  1. File corrupted
  2. Incompatible version
  3. Duplicate bot ID

Solution:

  1. Try re-exporting from source
  2. Check General Bots version compatibility
  3. Choose "Create new bot" instead of replace
  4. Rename bot ID if duplicate

Prompts not applying

Possible causes:

  1. Prompt not linked to bot
  2. Variable not defined
  3. Syntax error in prompt

Solution:

  1. Check AI Settings → System Prompt selection
  2. Verify all {{variables}} have values
  3. Test prompt with "Test" button
  4. Check for unclosed brackets or quotes

BASIC Integration

Access Sources data from dialogs:

Get Bot Configuration

config = GET BOT CONFIG
TALK "Bot name: " + config.displayName
TALK "Language: " + config.language

Use Prompts

' Load a prompt template
prompt = GET PROMPT "summarize"

' Use with variables
summary = GENERATE WITH PROMPT prompt, content
TALK summary

Search Knowledge Base

HEAR question AS TEXT "What would you like to know?"

results = SEARCH KB question IN "support.gbkb"

IF COUNT(results) > 0 THEN
    TALK results[0].answer
    TALK "Source: " + results[0].source
ELSE
    TALK "I couldn't find information about that."
END IF

List Available Bots

bots = GET BOTS

TALK "Available bots:"
FOR EACH bot IN bots
    IF bot.status = "live" THEN
        TALK "● " + bot.displayName
    ELSE
        TALK "○ " + bot.displayName + " (draft)"
    END IF
NEXT

See Also