Compare commits

..

No commits in common. "dd3d8c74dd58a1cc6d6b18d22108819519aaf9c3" and "c2a92c32e105b2dae622a97f0abc844b6264caa9" have entirely different histories.

8 changed files with 30 additions and 682 deletions

View file

@ -1,102 +0,0 @@
PARAM expression AS STRING LIKE "2 + 2" DESCRIPTION "Mathematical expression to calculate"
DESCRIPTION "Calculate mathematical expressions, conversions, and formulas"
WITH result
expression = expression
timestamp = NOW()
END WITH
expr = REPLACE(expression, " ", "")
IF INSTR(expr, "+") > 0 THEN
parts = SPLIT(expr, "+")
IF UBOUND(parts) = 2 THEN
result.answer = VAL(parts[0]) + VAL(parts[1])
result.operation = "addition"
END IF
ELSE IF INSTR(expr, "-") > 0 AND LEFT(expr, 1) <> "-" THEN
parts = SPLIT(expr, "-")
IF UBOUND(parts) = 2 THEN
result.answer = VAL(parts[0]) - VAL(parts[1])
result.operation = "subtraction"
END IF
ELSE IF INSTR(expr, "*") > 0 THEN
parts = SPLIT(expr, "*")
IF UBOUND(parts) = 2 THEN
result.answer = VAL(parts[0]) * VAL(parts[1])
result.operation = "multiplication"
END IF
ELSE IF INSTR(expr, "/") > 0 THEN
parts = SPLIT(expr, "/")
IF UBOUND(parts) = 2 THEN
IF VAL(parts[1]) <> 0 THEN
result.answer = VAL(parts[0]) / VAL(parts[1])
result.operation = "division"
ELSE
TALK "Error: Division by zero"
RETURN NULL
END IF
END IF
ELSE IF INSTR(LCASE(expr), "sqrt") > 0 THEN
start_pos = INSTR(LCASE(expr), "sqrt(") + 5
end_pos = INSTR(start_pos, expr, ")")
IF end_pos > start_pos THEN
num = VAL(MID(expr, start_pos, end_pos - start_pos))
IF num >= 0 THEN
result.answer = SQR(num)
result.operation = "square root"
ELSE
TALK "Error: Cannot calculate square root of negative number"
RETURN NULL
END IF
END IF
ELSE IF INSTR(expr, "^") > 0 THEN
parts = SPLIT(expr, "^")
IF UBOUND(parts) = 2 THEN
result.answer = VAL(parts[0]) ^ VAL(parts[1])
result.operation = "power"
END IF
ELSE IF INSTR(LCASE(expr), "abs") > 0 THEN
start_pos = INSTR(LCASE(expr), "abs(") + 4
end_pos = INSTR(start_pos, expr, ")")
IF end_pos > start_pos THEN
result.answer = ABS(VAL(MID(expr, start_pos, end_pos - start_pos)))
result.operation = "absolute value"
END IF
ELSE IF INSTR(LCASE(expr), "round") > 0 THEN
start_pos = INSTR(LCASE(expr), "round(") + 6
end_pos = INSTR(start_pos, expr, ")")
IF end_pos > start_pos THEN
result.answer = ROUND(VAL(MID(expr, start_pos, end_pos - start_pos)), 0)
result.operation = "rounding"
END IF
ELSE IF INSTR(expr, "%") > 0 AND INSTR(LCASE(expr), "of") > 0 THEN
expr_lower = LCASE(expr)
of_pos = INSTR(expr_lower, "of")
percent_part = REPLACE(LEFT(expr, of_pos - 1), "%", "")
percent_val = VAL(TRIM(percent_part))
base_val = VAL(TRIM(MID(expr, of_pos + 2)))
result.answer = (percent_val / 100) * base_val
result.operation = "percentage"
ELSE
result.answer = VAL(expr)
result.operation = "direct value"
END IF
IF result.answer <> NULL THEN
TALK "Result: " + result.answer
RETURN result
ELSE
TALK "Could not calculate expression"
RETURN NULL
END IF

View file

@ -1,26 +0,0 @@
PARAM to_email AS EMAIL LIKE "user@example.com" DESCRIPTION "Recipient email address"
PARAM subject AS STRING LIKE "Important Message" DESCRIPTION "Email subject line"
PARAM body AS STRING LIKE "Hello, this is the email content." DESCRIPTION "Email body content"
PARAM from_email AS EMAIL LIKE "noreply@company.com" DESCRIPTION "Sender email address" OPTIONAL
DESCRIPTION "Send an email to any recipient with subject and body"
IF NOT from_email THEN
from_email = "noreply@pragmatismo.com.br"
END IF
WITH email_data
to = to_email
from = from_email
subject = subject
body = body
timestamp = NOW()
END WITH
SEND EMAIL to_email, subject, body
SAVE "email_log.csv", email_data
TALK "Email sent to " + to_email
RETURN email_data

View file

@ -1,28 +0,0 @@
PARAM phone_number AS PHONE LIKE "+1234567890" DESCRIPTION "Phone number with country code"
PARAM message AS STRING LIKE "Hello, this is your message" DESCRIPTION "SMS message content"
PARAM from_number AS PHONE LIKE "+1987654321" DESCRIPTION "Sender phone number" OPTIONAL
DESCRIPTION "Send an SMS message to any phone number"
message_length = LEN(message)
segments = INT((message_length - 1) / 160) + 1
IF message_length > 160 THEN
TALK "Message will be split into " + segments + " segments"
END IF
WITH sms
to = phone_number
from = from_number
body = message
timestamp = NOW()
segmentCount = segments
END WITH
SEND SMS phone_number, message
SAVE "sms_log.csv", sms
TALK "SMS sent to " + phone_number
RETURN sms

View file

@ -1,60 +0,0 @@
PARAM text AS STRING LIKE "Hello, how are you?" DESCRIPTION "Text to translate"
PARAM from_lang AS STRING LIKE "en" DESCRIPTION "Source language code (en, es, pt, fr, de, etc)" OPTIONAL
PARAM to_lang AS STRING LIKE "es" DESCRIPTION "Target language code (en, es, pt, fr, de, etc)" OPTIONAL
DESCRIPTION "Translate text between languages using free translation API"
IF NOT from_lang THEN
from_lang = "en"
END IF
IF NOT to_lang THEN
to_lang = "es"
END IF
TALK "Translating from " + from_lang + " to " + to_lang + "..."
WITH post_data
q = text
source = from_lang
target = to_lang
format = "text"
END WITH
SET HEADER "Content-Type" = "application/json"
translation_result = POST "https://libretranslate.com/translate", post_data
IF translation_result.translatedText THEN
WITH result
original = text
translated = translation_result.translatedText
from = from_lang
to = to_lang
END WITH
TALK "Original (" + from_lang + "): " + text
TALK "Translated (" + to_lang + "): " + result.translated
RETURN result
ELSE
mymemory_url = "https://api.mymemory.translated.net/get?q=" + text + "&langpair=" + from_lang + "|" + to_lang
fallback_result = GET mymemory_url
IF fallback_result.responseData.translatedText THEN
WITH result
original = text
translated = fallback_result.responseData.translatedText
from = from_lang
to = to_lang
END WITH
TALK "Original (" + from_lang + "): " + text
TALK "Translated (" + to_lang + "): " + result.translated
RETURN result
ELSE
TALK "Could not translate text"
RETURN NULL
END IF
END IF

View file

@ -1,112 +0,0 @@
PARAM location AS STRING LIKE "New York" DESCRIPTION "City or location to get weather forecast"
DESCRIPTION "Get current weather forecast for any city or location"
lat = 40.7128
lon = -74.0060
location_lower = LCASE(location)
IF INSTR(location_lower, "new york") > 0 THEN
lat = 40.7128
lon = -74.0060
ELSE IF INSTR(location_lower, "london") > 0 THEN
lat = 51.5074
lon = -0.1278
ELSE IF INSTR(location_lower, "paris") > 0 THEN
lat = 48.8566
lon = 2.3522
ELSE IF INSTR(location_lower, "tokyo") > 0 THEN
lat = 35.6762
lon = 139.6503
ELSE IF INSTR(location_lower, "sydney") > 0 THEN
lat = -33.8688
lon = 151.2093
ELSE IF INSTR(location_lower, "berlin") > 0 THEN
lat = 52.5200
lon = 13.4050
ELSE IF INSTR(location_lower, "madrid") > 0 THEN
lat = 40.4168
lon = -3.7038
ELSE IF INSTR(location_lower, "sao paulo") > 0 OR INSTR(location_lower, "são paulo") > 0 THEN
lat = -23.5505
lon = -46.6333
ELSE IF INSTR(location_lower, "rio") > 0 THEN
lat = -22.9068
lon = -43.1729
ELSE IF INSTR(location_lower, "los angeles") > 0 THEN
lat = 34.0522
lon = -118.2437
ELSE IF INSTR(location_lower, "chicago") > 0 THEN
lat = 41.8781
lon = -87.6298
ELSE IF INSTR(location_lower, "toronto") > 0 THEN
lat = 43.6532
lon = -79.3832
ELSE IF INSTR(location_lower, "dubai") > 0 THEN
lat = 25.2048
lon = 55.2708
ELSE IF INSTR(location_lower, "singapore") > 0 THEN
lat = 1.3521
lon = 103.8198
ELSE IF INSTR(location_lower, "mumbai") > 0 THEN
lat = 19.0760
lon = 72.8777
ELSE IF INSTR(location_lower, "beijing") > 0 THEN
lat = 39.9042
lon = 116.4074
END IF
weather_url = "https://api.open-meteo.com/v1/forecast?latitude=" + lat + "&longitude=" + lon + "&current_weather=true&timezone=auto"
weather_data = GET weather_url
IF weather_data.current_weather THEN
current = weather_data.current_weather
code = current.weathercode
condition = "Clear"
icon = "☀️"
IF code = 0 THEN
condition = "Clear sky"
icon = "☀️"
ELSE IF code >= 1 AND code <= 3 THEN
condition = "Partly cloudy"
icon = "⛅"
ELSE IF code >= 45 AND code <= 48 THEN
condition = "Foggy"
icon = "🌫️"
ELSE IF code >= 51 AND code <= 67 THEN
condition = "Rainy"
icon = "🌧️"
ELSE IF code >= 71 AND code <= 77 THEN
condition = "Snowy"
icon = "❄️"
ELSE IF code >= 80 AND code <= 82 THEN
condition = "Rain showers"
icon = "🌦️"
ELSE IF code >= 95 AND code <= 99 THEN
condition = "Thunderstorm"
icon = "⛈️"
END IF
WITH result
loc = location
temperature = current.temperature
windspeed = current.windspeed
weathercode = code
cond = condition
ico = icon
END WITH
TALK icon + " Weather for " + location + ":"
TALK "Temperature: " + current.temperature + "°C"
TALK "Condition: " + condition
TALK "Wind: " + current.windspeed + " km/h"
RETURN result
ELSE
TALK "Could not fetch weather for: " + location
RETURN NULL
END IF

View file

@ -1,127 +0,0 @@
# Getting Started with General Bots
## Overview
Welcome to General Bots! This guide will help you understand the basic features available in your default bot installation.
## Available Features
### Calculator
Perform mathematical calculations by asking the bot to calculate expressions.
**Examples:**
- "Calculate 25 * 4"
- "What is 1500 / 12?"
- "Calculate 15% of 200"
### Send Email
Send emails directly through the bot.
**How to use:**
1. Say "Send email" or "Send an email"
2. Provide the recipient's email address
3. Enter the subject line
4. Type your message content
**Example:**
- "Send an email to john@example.com"
- "I need to email my team"
### Send SMS
Send text messages to mobile phones.
**How to use:**
1. Say "Send SMS" or "Send a text message"
2. Provide the phone number (with country code)
3. Enter your message
**Example:**
- "Send SMS to +1234567890"
- "Text message to my contact"
### Translation
Translate text between different languages.
**How to use:**
1. Say "Translate" followed by the text
2. Specify the target language
**Examples:**
- "Translate 'Hello, how are you?' to Spanish"
- "Translate this text to Portuguese"
- "How do you say 'thank you' in French?"
### Weather
Get current weather information for any location.
**How to use:**
1. Ask about the weather for a specific location
**Examples:**
- "What's the weather in New York?"
- "Weather forecast for London"
- "Is it going to rain in Tokyo?"
## Tips for Better Interactions
### Be Specific
The more specific your request, the better the bot can help you. Include relevant details like:
- Email addresses for sending emails
- Phone numbers with country codes for SMS
- City names for weather queries
### Natural Language
You can speak naturally to the bot. It understands various ways of asking for the same thing:
- "Calculate 10 + 5" or "What is 10 plus 5?"
- "Send email" or "I need to email someone"
- "Translate to Spanish" or "How do you say this in Spanish?"
### Confirmation
The bot will ask for confirmation before performing actions like sending emails or SMS to ensure accuracy.
## Extending Your Bot
This default template provides basic functionality. You can extend your bot by:
1. **Adding Knowledge Base**: Create `.md` files in the `.gbkb` folder to give your bot domain-specific knowledge
2. **Creating Dialogs**: Add `.bas` files in the `.gbdialog` folder for custom conversations
3. **Installing Templates**: Add pre-built templates for CRM, HR, helpdesk, and more
4. **Connecting APIs**: Integrate external services for expanded functionality
## Frequently Asked Questions
**Q: How do I add more features to my bot?**
A: Install additional templates or create custom dialog scripts in the `.gbdialog` folder.
**Q: Can the bot remember previous conversations?**
A: Yes, the bot maintains context within a session. For persistent memory, use the memory features in custom dialogs.
**Q: What languages are supported?**
A: The bot supports multiple languages for both interface and translation. Common languages include English, Portuguese, Spanish, French, German, and many others.
**Q: How do I change the bot's appearance?**
A: Modify the `config.csv` file in the `.gbot` folder to change colors, logo, and title.
**Q: Is my data secure?**
A: Yes, all communications are encrypted. Sensitive data like passwords should never be shared in chat.
## Getting Help
If you need assistance:
- Ask the bot "Help" for available commands
- Check the documentation at docs.pragmatismo.com.br
- Contact support for technical issues
## Next Steps
1. Try out each feature to see how it works
2. Explore the template library for pre-built solutions
3. Customize your bot with your own knowledge base
4. Create custom dialogs for your specific use cases
Welcome aboard, and enjoy using General Bots!

View file

@ -1,227 +0,0 @@
name,value
,
# ============================================================================
# SERVER CONFIGURATION
# ============================================================================
server_host,0.0.0.0
server_port,8088
sites_root,/tmp
,
# ============================================================================
# LLM CONFIGURATION
# ============================================================================
llm-key,none
llm-model,../../../../data/llm/DeepSeek-R1-Distill-Qwen-1.5B-Q3_K_M.gguf
,
llm-cache,false
llm-cache-ttl,3600
llm-cache-semantic,true
llm-cache-threshold,0.95
,
episodic-memory-threshold,4
,
mcp-server,false
,
# ============================================================================
# EMBEDDING CONFIGURATION
# ============================================================================
embedding-url,http://localhost:8082
embedding-model,../../../../data/llm/bge-small-en-v1.5-f32.gguf
,
# ============================================================================
# LLM SERVER CONFIGURATION
# ============================================================================
llm-server,true
llm-server-path,botserver-stack/bin/llm/build/bin
llm-server-host,0.0.0.0
llm-server-port,8081
llm-server-gpu-layers,0
llm-server-n-moe,0
llm-server-ctx-size,4096
llm-server-n-predict,1024
llm-server-parallel,6
llm-server-cont-batching,true
llm-server-mlock,false
llm-server-no-mmap,false
,
# ============================================================================
# EMAIL CONFIGURATION
# ============================================================================
email-from,from@domain.com
email-server,mail.domain.com
email-port,587
email-user,user@domain.com
email-pass,
,
# ============================================================================
# DATABASE CONFIGURATION
# ============================================================================
custom-server,localhost
custom-port,5432
custom-database,mycustomdb
custom-username,
custom-password,
,
# ============================================================================
# WEBSITE CRAWLER CONFIGURATION
# ============================================================================
website-expires,1d
website-max-depth,3
website-max-pages,100
,
# ============================================================================
# IMAGE GENERATOR CONFIGURATION
# ============================================================================
image-generator-model,../../../../data/diffusion/sd_turbo_f16.gguf
image-generator-steps,4
image-generator-width,512
image-generator-height,512
image-generator-gpu-layers,20
image-generator-batch-size,1
,
# ============================================================================
# VIDEO GENERATOR CONFIGURATION
# ============================================================================
video-generator-model,../../../../data/diffusion/zeroscope_v2_576w
video-generator-frames,24
video-generator-fps,8
video-generator-width,320
video-generator-height,576
video-generator-gpu-layers,15
video-generator-batch-size,1
,
# ============================================================================
# BOTMODELS CONFIGURATION
# ============================================================================
botmodels-enabled,true
botmodels-host,0.0.0.0
botmodels-port,8085
,
default-generator,all
,
# ============================================================================
# OAUTH AUTHENTICATION CONFIGURATION
# ============================================================================
# Enable social login providers by setting the corresponding -enabled flag
# to "true" and providing valid client credentials.
#
# Each provider requires:
# - oauth-{provider}-enabled: Set to "true" to enable the provider
# - oauth-{provider}-client-id: The Client ID from the provider
# - oauth-{provider}-client-secret: The Client Secret from the provider
# - oauth-{provider}-redirect-uri: (Optional) Custom callback URL
#
# Default redirect URI format: http://your-domain/auth/oauth/{provider}/callback
# ============================================================================
,
# ----------------------------------------------------------------------------
# GOOGLE OAUTH
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://console.cloud.google.com/apis/credentials
# 2. Create a new project or select existing
# 3. Click "Create Credentials" > "OAuth client ID"
# 4. Select "Web application" as application type
# 5. Add authorized redirect URI: http://your-domain/auth/oauth/google/callback
# 6. Copy the Client ID and Client Secret below
#
# Documentation: https://developers.google.com/identity/protocols/oauth2/web-server
# ----------------------------------------------------------------------------
oauth-google-enabled,false
oauth-google-client-id,
oauth-google-client-secret,
oauth-google-redirect-uri,
,
# ----------------------------------------------------------------------------
# MICROSOFT OAUTH (Azure AD)
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
# 2. Click "New registration"
# 3. Enter application name and select "Accounts in any organizational directory and personal Microsoft accounts"
# 4. Add redirect URI: http://your-domain/auth/oauth/microsoft/callback (Web platform)
# 5. Go to "Certificates & secrets" > "New client secret"
# 6. Copy the Application (client) ID and secret value below
#
# Documentation: https://learn.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app
# ----------------------------------------------------------------------------
oauth-microsoft-enabled,false
oauth-microsoft-client-id,
oauth-microsoft-client-secret,
oauth-microsoft-redirect-uri,
,
# ----------------------------------------------------------------------------
# DISCORD OAUTH
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://discord.com/developers/applications
# 2. Click "New Application" and enter a name
# 3. Go to "OAuth2" in the left sidebar
# 4. Add redirect URL: http://your-domain/auth/oauth/discord/callback
# 5. Copy the Client ID and Client Secret below
# 6. Under "OAuth2 URL Generator", select scopes: identify, email
#
# Documentation: https://discord.com/developers/docs/topics/oauth2
# ----------------------------------------------------------------------------
oauth-discord-enabled,false
oauth-discord-client-id,
oauth-discord-client-secret,
oauth-discord-redirect-uri,
,
# ----------------------------------------------------------------------------
# FACEBOOK OAUTH
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://developers.facebook.com/apps/
# 2. Click "Create App" > Select "Consumer" or "Business"
# 3. Add "Facebook Login" product to your app
# 4. Go to Facebook Login > Settings
# 5. Add Valid OAuth Redirect URI: http://your-domain/auth/oauth/facebook/callback
# 6. Go to Settings > Basic to get App ID and App Secret
#
# Documentation: https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow
# ----------------------------------------------------------------------------
oauth-facebook-enabled,false
oauth-facebook-client-id,
oauth-facebook-client-secret,
oauth-facebook-redirect-uri,
,
# ----------------------------------------------------------------------------
# TWITTER (X) OAUTH 2.0
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://developer.twitter.com/en/portal/dashboard
# 2. Create a new project and app (or use existing)
# 3. Go to your app's "Keys and tokens" tab
# 4. Under "OAuth 2.0 Client ID and Client Secret", generate credentials
# 5. Go to "User authentication settings" and configure:
# - Enable OAuth 2.0
# - Type: Web App
# - Callback URL: http://your-domain/auth/oauth/twitter/callback
# 6. Copy Client ID and Client Secret below
#
# Note: Twitter requires OAuth 2.0 with PKCE for web apps
# Documentation: https://developer.twitter.com/en/docs/authentication/oauth-2-0
# ----------------------------------------------------------------------------
oauth-twitter-enabled,false
oauth-twitter-client-id,
oauth-twitter-client-secret,
oauth-twitter-redirect-uri,
,
# ----------------------------------------------------------------------------
# REDDIT OAUTH
# ----------------------------------------------------------------------------
# Setup Instructions:
# 1. Go to https://www.reddit.com/prefs/apps
# 2. Click "create another app..." at the bottom
# 3. Select "web app" as the application type
# 4. Enter redirect URI: http://your-domain/auth/oauth/reddit/callback
# 5. Copy the client ID (under app name) and secret below
#
# Note: Reddit requires Basic Auth for token exchange and custom User-Agent
# Documentation: https://github.com/reddit-archive/reddit/wiki/OAuth2
# ----------------------------------------------------------------------------
oauth-reddit-enabled,false
oauth-reddit-client-id,
oauth-reddit-client-secret,
oauth-reddit-redirect-uri,
Can't render this file because it contains an unexpected character in line 106 and column 6.

View file

@ -0,0 +1,30 @@
TABLE students
Id uuid key
Name string(255)
Email string(255)
RegisteredAt timestamp
END TABLE
PARAM name AS STRING LIKE "John Doe" DESCRIPTION "Full name of the student"
PARAM email AS STRING LIKE "john@example.com" DESCRIPTION "Email address of the student"
DESCRIPTION "Register a new student by saving their name and email to the students table"
studentId = UUID()
registeredAt = NOW()
WITH student
id = studentId
name = name
email = email
registeredAt = registeredAt
END WITH
SAVE "students", studentId, student
TALK "Student registered successfully!"
TALK "Student ID: " + studentId
TALK "Name: " + name
TALK "Email: " + email
RETURN studentId