Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
16dfc64
docker-compose & Dockerfile
Nov 28, 2023
d5faba0
feature chat color
Nov 28, 2023
7265d3f
change logos and deleting docs references to botpress
EddieSanJu Nov 28, 2023
5d0229f
changes
EddieSanJu Nov 28, 2023
846cf98
Merge pull request #1 from thegurucompany/feature/docker-env
gus-bn Nov 29, 2023
eb52b79
update Dockerfile
Nov 29, 2023
7440684
Merge pull request #2 from thegurucompany/feature/branding
gus-bn Nov 29, 2023
16480cf
Merge pull request #3 from thegurucompany/feature/chato-chat-color
gus-bn Nov 29, 2023
2ed55e8
fixes git build issue
Nov 29, 2023
f4394ee
remove user restrictions
Nov 29, 2023
4976f4e
added aws-sdk and more logo changes
EddieSanJu Nov 29, 2023
ebd606f
Merge branch 'master' into feature/sdk-aws
EddieSanJu Nov 29, 2023
4768b63
update package dependencies
Nov 30, 2023
fdede47
update menu logo
Nov 30, 2023
7bbb529
Merge pull request #4 from thegurucompany/feature/sdk-aws
gus-bn Nov 30, 2023
1f004b0
remove logo from menu
Nov 30, 2023
d7cfa0e
update chat icon
Nov 30, 2023
fd451eb
restore chat icon
Nov 30, 2023
e7799ee
Chat Icon
Dec 11, 2023
89a53e4
update chat icon
Dec 12, 2023
a035f9f
update chat icon
Dec 21, 2023
72376d9
update hover color
Dec 21, 2023
511bf4d
update title
Jan 4, 2024
1e6363c
Merge branch 'master' of github.com:thegurucompany/v12
Jan 4, 2024
f922af3
remove version from status bar
Jan 11, 2024
488d413
custom stylesheet
Jan 11, 2024
80702fc
enable multiternat support and copys changed
EddieSanJu Jan 11, 2024
d594dec
Merge pull request #6 from thegurucompany/feature/enable-multitenant
gus-bn Jan 12, 2024
91081e4
update chat icon
Jan 23, 2024
fddc969
Merge branch 'master' of github.com:thegurucompany/v12
Jan 23, 2024
9f2b4a3
uttopia.css
Jan 24, 2024
4ed1506
chato.css
Jan 24, 2024
386a867
tgc theme
Jan 29, 2024
938ac39
add client style
Feb 27, 2024
84d47fd
new icon
Feb 29, 2024
016c234
update web chat
Feb 29, 2024
e9787d7
Add background color to header and chat bubble content
Feb 29, 2024
0dacd44
Add pulse animation to floating button
Mar 25, 2024
3543d9f
Remove animation and add border-radius to floating button
Mar 25, 2024
2af06fd
Update CSS styles for floating button, body overflow, and widget size
Mar 25, 2024
94ceeab
Add pulse animation and box-shadow to floating button
Mar 25, 2024
eabbeb9
changes from chato to TheGurúCompany
EddieSanJu Apr 2, 2024
b407b1d
change brand
EddieSanJu Apr 4, 2024
1de692d
changing url and some icons
EddieSanJu Apr 4, 2024
c820064
Merge pull request #7 from thegurucompany/feature/tgc-studio
gus-bn Apr 5, 2024
8068656
hotfix
EddieSanJu Apr 5, 2024
0e5124e
Merge branch 'master' into fix/hotfix-powered-copy
EddieSanJu Apr 5, 2024
00bff97
Merge pull request #8 from thegurucompany/fix/hotfix-powered-copy
gus-bn Apr 5, 2024
b63fc20
Update floating button styles and add new TGC icon
Apr 15, 2024
b5d1bf2
Merge branch 'master' of github.com:thegurucompany/v12
Apr 15, 2024
369c061
Update floating button styles and add new TGC icon
Apr 25, 2024
44c792e
flo
Sep 23, 2024
89be19d
add general style
Oct 11, 2024
30d257d
flo static styles
Oct 17, 2024
a63aff2
adding styles for each tenant
Oct 23, 2024
a428280
Merge pull request #9 from thegurucompany/feature/tenant-logos
gus-bn Oct 23, 2024
087223e
chato proactive message
Oct 24, 2024
6fb73ff
inject css
Oct 24, 2024
31e5eb7
custom proactive message
Oct 24, 2024
ce605a6
chatp inject script
Oct 24, 2024
4070566
relative position
Oct 24, 2024
4ec9260
background color
Oct 24, 2024
7663ec7
default bg color
Oct 24, 2024
1e56ef0
backgroundColor
Oct 24, 2024
603d2f7
add pg dependency
Oct 29, 2024
40ae28b
add chart.js
Oct 29, 2024
90d7094
add chartjs-node-canvas
Oct 29, 2024
304b500
lock chart.js version
Oct 29, 2024
63521de
add canvas dependency
Oct 29, 2024
c399ade
adding glowing efect
Oct 31, 2024
850ac53
Merge pull request #10 from thegurucompany/changes/glowing-efect
gus-bn Oct 31, 2024
b7ca057
montserrat font family
Nov 6, 2024
8d85784
montserrat font
Nov 6, 2024
07d70f5
logo fix
Nov 13, 2024
4bd02b0
Merge pull request #11 from thegurucompany/fix/logo-flo
gus-bn Nov 13, 2024
933ffa3
add mysql2 dependency
Dec 4, 2024
5f40c9a
adding guru styles
Jan 9, 2025
44fd136
Adding wewell styles for webchat
Jan 14, 2025
941c087
Merge pull request #12 from thegurucompany/feature/guru-styles
gus-bn Jan 14, 2025
1f73a5b
Add Google APIs
Jan 29, 2025
4f04e83
Add node-zendesk dependency
Apr 16, 2025
d5f7009
adding mosi styles
Apr 28, 2025
d846c23
Merge pull request #13 from thegurucompany/feature/mosi-styles
gus-bn Apr 28, 2025
12aeddc
adding element styles
Jun 5, 2025
59f22a5
solving comments
Jun 5, 2025
4669dc0
Merge pull request #14 from thegurucompany/feature/element-styles
gus-bn Jun 5, 2025
1fbfcdd
add copilot instructions file
Jun 24, 2025
c766425
Merge pull request #15 from thegurucompany/feature/copilot-instructions
gus-bn Jun 24, 2025
97ba5c6
remove mic hitl
Jun 26, 2025
065182f
Merge pull request #17 from thegurucompany/feature/remove-mic-hitl
gus-bn Jun 26, 2025
3aed913
chore(deps): pin pg package version to 8.13.1
Jun 27, 2025
8f25d8b
file upload
Jun 30, 2025
f6cd575
prettier
Jun 30, 2025
8095e2f
image-preview
Jul 1, 2025
7336585
style
Jul 2, 2025
d05efe4
remove extra message image
Jul 2, 2025
cf2f8a7
user files
Jul 2, 2025
1170e0e
file uploads
Jul 3, 2025
eb1a56d
Merge pull request #18 from thegurucompany/feature/file-upload
gus-bn Jul 3, 2025
a7d0f31
videos and audios
Jul 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Container vars
CHATO_STUDIO_WEB_PORT=
CHATO_STUDIO_DATABASE_PORT=

# BP env vars, full reference:
# https://v12.botpress.com/going-to-production/environment-variables
EXTERNAL_URL=
DATABASE_URL=
186 changes: 186 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
---
applyTo: "**"
---

# Botpress v12 Copilot Instructions

## Project Overview
This is a **Botpress v12** fork - a powerful open-source conversational AI platform built with TypeScript and Node.js. Botpress is a modular chatbot development framework that enables developers to create sophisticated conversational applications with natural language understanding, multiple channel integrations, and a visual flow designer.

## Architecture & Structure

### Core Components
- **Core Engine** (`packages/bp/`): The main Botpress application with dependency injection using Inversify
- **Modules** (`modules/`): Pluggable modules that extend functionality (NLU, analytics, channels, etc.)
- **Admin UI** (`packages/ui-admin/`): React-based administration interface
- **Shared Libraries** (`packages/ui-shared/`): Common React components and utilities
- **SDK** (`packages/bp/src/sdk/`): TypeScript definitions and API interfaces

### Key Architecture Patterns
- **Dependency Injection**: Uses Inversify with decorators (`@injectable`, `@inject`)
- **Module System**: Pluggable architecture with `ModuleEntryPoint` interface
- **Event-Driven**: Middleware-based event processing with hooks
- **Monorepo Structure**: Yarn workspaces for package management
- **TypeScript-First**: Strongly typed with comprehensive SDK definitions

## Development Guidelines

### Code Style & Conventions
- **TypeScript**: Prefer strict typing, use interfaces over types
- **Async/Await**: Use async/await over promises, handle errors with try/catch
- **Lodash**: Extensively used for utilities (`_.get`, `_.map`, `_.merge`, etc.)
- **Optional Chaining**: Use `?.` operator for safe property access
- **Strict Equality**: Always use `===` instead of `==`
- **Null Coalescing**: Prefer `??` over `||` when appropriate
- **Minimal Code**: Keep it simple - less code = fewer bugs

### File Organization
- **Barrel Exports**: Use index files to export from directories
- **Separation of Concerns**: Split logic into focused, single-purpose files
- **Module Structure**: Follow `/src/backend/` and `/src/views/` pattern for modules
- **Configuration**: Use JSON schemas for module configuration validation

## Module Development

### Module Entry Point Structure
```typescript
const entryPoint: sdk.ModuleEntryPoint = {
onServerStarted?: (bp: typeof sdk) => Promise<void>,
onServerReady?: (bp: typeof sdk) => Promise<void>,
onBotMount?: (bp: typeof sdk, botId: string) => Promise<void>,
onBotUnmount?: (bp: typeof sdk, botId: string) => Promise<void>,
onFlowChanged?: (bp: typeof sdk, botId: string, flow: sdk.Flow) => Promise<void>,
skills?: sdk.Skill[],
botTemplates?: sdk.BotTemplate[],
dialogConditions?: sdk.Condition[],
translations?: { [lang: string]: object },
definition: {
name: string,
fullName: string,
menuIcon: string,
menuText: string,
homepage: string,
noInterface?: boolean
}
}
```

### SDK Usage Patterns
- **Logger**: Always use scoped logging: `bp.logger.info()`, `bp.logger.forBot(botId)`
- **Database**: Access via `bp.database` (Knex instance)
- **Configuration**: Use `bp.config.getModuleConfigForBot(moduleName, botId)`
- **Events**: Register middleware with `bp.events.registerMiddleware()`
- **HTTP**: Create bot-specific routes with `bp.http.createRouterForBot()`

### Common Patterns
```typescript
// Module initialization
const onServerStarted = async (bp: typeof sdk) => {
// Database setup, middleware registration
}

const onServerReady = async (bp: typeof sdk) => {
// API routes, final setup
}

// Bot lifecycle
const onBotMount = async (bp: typeof sdk, botId: string) => {
const config = await bp.config.getModuleConfigForBot('module-name', botId)
// Bot-specific initialization
}
```

## Key APIs & Services

### Core Services
- **ModuleLoader**: Manages module lifecycle and loading
- **ConfigReader**: Handles configuration with precedence (defaults → global → env → bot-specific)
- **GhostService**: File system abstraction for bot content
- **EventEngine**: Processes incoming/outgoing events through middleware
- **DialogEngine**: Manages conversation flows and state
- **BotService**: Bot management and lifecycle operations

### Hook System
Available hooks: `before_incoming_middleware`, `after_incoming_middleware`, `before_outgoing_middleware`, `after_event_processed`, `before_session_timeout`, `after_server_start`, `after_bot_mount`, `after_bot_unmount`

### Event Processing
- Events flow through middleware chains
- Use `event.setFlag()` to control processing
- State management via `event.state` (temp, session, user, bot)

## Database & Storage

### Database Access
- **Knex**: Use `bp.database` for SQL operations
- **Migrations**: Handle in module's `onServerStarted` lifecycle
- **Ghost**: Use `bp.ghost` for file operations (bot content, configurations)

### Configuration Precedence
1. Default values (lowest priority)
2. Global configuration
3. Environment variables
4. Bot-specific configuration (highest priority)

## Testing & Build

### Testing Framework
- **Jest**: Unit tests (`jest.unit.config.ts`)
- **E2E Tests**: Integration tests (`jest.e2e.config.ts`)
- **Linting**: ESLint with TypeScript rules

### Build System
- **Gulp**: Primary build system
- **Module Builder**: Specialized builder for modules
- **Yarn**: Package management with workspaces
- **Docker**: Containerization support

## Common Gotchas & Best Practices

### Performance
- Use `@Memoize()` decorator for expensive operations
- Implement caching where appropriate (LRU cache pattern)
- Handle background processes carefully with proper cleanup

### Error Handling
- Always wrap external calls in try/catch
- Use `bp.logger.attachError(err)` for proper error logging
- Implement graceful degradation for non-critical failures

### Memory Management
- Clean up listeners in `onBotUnmount` and `onModuleUnmount`
- Clear caches appropriately
- Use WeakMap/WeakSet for temporary references

### Security
- Validate all inputs using Joi schemas
- Use proper authentication middleware
- Sanitize user content before storage/display

## Environment & Configuration

### Environment Variables
- `NODE_ENV`: Environment mode (development, production)
- `CLUSTER_ENABLED`: Enable clustering
- `BPFS_STORAGE`: Storage backend (disk, database)
- `DATABASE_URL`: Database connection string

### Configuration Files
- `botpress.config.ts`: Main configuration
- `config/`: Module-specific configurations
- `data/`: Runtime data and bot content

## Debugging & Development

### Debugging Tools
- Use `DEBUG` environment variable for detailed logging
- Studio debugging interface for flow execution
- Event logs for tracing conversations
- Performance profiling with built-in tools

### Development Workflow
1. Start with `yarn start` for development
2. Use `yarn watch` for auto-rebuilding
3. Module development: `yarn build` in module directory
4. Testing: `yarn test:unit` or `yarn test:e2e`

Remember: Botpress v12 is a mature, production-ready platform. Focus on stability, performance, and maintainability when making changes. Always consider backward compatibility and the impact on existing bots when modifying core functionality.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ node_modules
/out
/.out
/tmp
/backup
test-report.html
metadata.json
edition.json
Expand Down Expand Up @@ -72,3 +73,5 @@ modules/*/assets/web/*
modules/*/assets/config.schema.json
**/out/**
**/dist/**

.env
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.nodePath": "./node_modules",
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"search.exclude": {
"**versioned**": true,
Expand Down Expand Up @@ -72,5 +72,6 @@
"name": "BP Core DB"
}
],
"sqltools.useNodeRuntime": true
"sqltools.useNodeRuntime": true,
"DevChat.PythonForCommands": "/home/guru/.chat/mamba/envs/devchat-commands/bin/python"
}
39 changes: 37 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
FROM botpress/server:latest
CMD ["./bp", "&" ,"./duckling"]
FROM --platform=linux/amd64 ubuntu:20.04

# Set environment variables
ENV BP_WORKDIR=/botpress
ENV BP_USER=botpress
ENV BP_GROUP=botpress
ENV BP_DATA_PATH $BP_WORKDIR/data

# Set the DEBIAN_FRONTEND environment variable to non-interactive
ENV DEBIAN_FRONTEND=noninteractive

# Set the timezone to your desired value (e.g., UTC)
RUN ln -fs /usr/share/zoneinfo/UTC /etc/localtime

# Install dependencies & node.js
RUN apt-get update && apt-get install -y curl g++ make curl \
gnupg chromium-browser git
RUN curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
apt-get install -y nodejs

# Install yarn
RUN npm install -g yarn

# Set working directory
WORKDIR $BP_WORKDIR

# Copy the rest of the code
COPY . .

# Install dependencies
RUN yarn install

# Build the application
RUN yarn build

# Start the application
CMD ["yarn", "start"]
4 changes: 2 additions & 2 deletions build/downloader/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ export const listFiles = async ({ platform, appData, output }: CommonArgs) => {
const isUsed = activeVersion && release.version.endsWith(activeVersion)

logger.info(
` ${release.version} ${isInstalled ? '[installed]' : ''} ${isUsed ? '[currently used in this workspace]' : ''}`
` ${release.version} ${isInstalled ? '[installed]' : ''} ${isUsed ? '[currently used in this tenant]' : ''}`
)
}
}

logger.info('')
logger.info('Type `yarn bpd init` to download & use binaries configured in package.json')
logger.info('Type `yarn bpd install <toolName>` to install the latest version')
logger.info('Type `yarn bpd use <toolName> <version>` to copy that specific version in the current workspace')
logger.info('Type `yarn bpd use <toolName> <version>` to copy that specific version in the current tenant')
logger.info('Type `yarn bpd clean` to remove all binaries')
}

Expand Down
6 changes: 3 additions & 3 deletions build/downloader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ yargs
return yargs
.options({
workspace: {
description: 'Set the location where the workspace is located',
description: 'Set the location where the tenant is located',
alias: ['w', 'path'],
type: 'string',
required: true,
Expand All @@ -129,10 +129,10 @@ yargs
})
.command(
['init', '$0e'],
'Setup a new workspace',
'Setup a new tenant',
{
pro: {
description: 'Includes Botpress Pro in the workspace',
description: 'Includes Botpress Pro in the tenant',
type: 'boolean',
default: false
}
Expand Down
4 changes: 2 additions & 2 deletions build/downloader/src/workspace-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class WorkspaceManager {

initializeWorkspace = async ({ usePro }: { usePro: boolean }) => {
if (await this.rootPathExists()) {
console.error('Cannot initialize a new workspace in an existing path')
console.error('Cannot initialize a new tenant in an existing path')
process.exit(0)
}

Expand All @@ -88,7 +88,7 @@ export class WorkspaceManager {
*/
async syncWorkspace({ forceCheckout, devMode }: { forceCheckout: boolean; devMode: boolean }) {
if (!(await this.rootPathExists())) {
console.error('To sync a workspace, the path must exist')
console.error('To sync a tenant, the path must exist')
process.exit(0)
}

Expand Down
2 changes: 1 addition & 1 deletion build/gulp.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const writeMetadata = async () => {
}

try {
const currentBranch = await Promise.fromCallback(cb => exec('git rev-parse --abbrev-ref HEAD', cb))
const currentBranch = 'master'
metadata.branch = currentBranch.replace('\n', '')
} catch (err) {
console.error(`Couldn't get active branch`, err)
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3'
services:
chato-db:
image: 'ankane/pgvector:v0.4.4'
container_name: 'chato-db'
ports:
- '${DOCKER_DATABASE_PORT}:5432'
volumes:
- ./tmp/pgdata:/var/lib/postgresql/data
environment:
POSTGRES_HOST_AUTH_METHOD: trust
chato-studio:
build: .
container_name: chato-studio
command: bash -c "yarn start"
ports:
- '${CHATO_STUDIO_WEB_PORT}:3000'
volumes:
- ./package.json:/botpress/package.json
- ./package-lock.json:/botpress/package-lock.json
- ./bench:/botpress/bench
- ./build:/botpress/build
- ./config:/botpress/config
- ./docs:/botpress/docs
- ./modules:/botpress/modules
- ./packages:/botpress/packages
depends_on:
- 'chato-db'
env_file:
- .env
Loading