- Created detailed markdown files for keywords such as HEAR, TALK, and SET_USER. - Added examples and usage notes for each keyword to enhance user understanding. - Developed templates for common tasks like enrollment and authentication. - Structured documentation into chapters covering various aspects of the GeneralBots platform, including gbapp, gbkb, and gbtheme. - Introduced a glossary for key terms and concepts related to GeneralBots. - Implemented a user-friendly table of contents for easy navigation.
1.6 KiB
1.6 KiB
.gbdialog Dialogs
The .gbdialog package contains BASIC scripts that define conversation flows, tool integrations, and bot behavior.
What is .gbdialog?
.gbdialog files are written in a specialized BASIC dialect that controls:
- Conversation flow and logic
- Tool calls and integrations
- User input processing
- Context management
- Response generation
Basic Structure
A typical .gbdialog script contains:
REM This is a comment
TALK "Hello! How can I help you today?"
HEAR user_input
IF user_input = "help" THEN
TALK "I can help you with various tasks..."
ELSE
LLM user_input
END IF
Key Components
1. Control Flow
IF/THEN/ELSE/END IFfor conditional logicFOR EACH/IN/NEXTfor loopsEXIT FORto break loops
2. User Interaction
HEAR variableto get user inputTALK messageto send responsesWAIT secondsto pause execution
3. Data Manipulation
SET variable = valuefor assignmentGET urlto fetch external dataFIND table, filterto query databases
4. AI Integration
LLM promptfor AI-generated responsesADD_TOOL tool_nameto enable functionalitySET_KB collectionto use knowledge bases
Script Execution
Dialog scripts run in a sandboxed environment with:
- Access to session context and variables
- Ability to call external tools and APIs
- Integration with knowledge bases
- LLM generation capabilities
Error Handling
The system provides built-in error handling:
- Syntax errors are caught during compilation
- Runtime errors log details but don't crash the bot
- Timeouts prevent infinite loops
- Resource limits prevent abuse