Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tgc studio #417

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata.json
.idea/
.idea
.env.debug
tmp/

.pnp.*
.yarn/*
Expand Down
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
Expand All @@ -16,5 +16,6 @@
"typescript.tsdk": ".yarn/sdks/typescript/lib",
"files.associations": {
"*.styl": "scss"
}
},
"DevChat.PythonForCommands": "/home/guru/.chat/mamba/envs/devchat-commands/bin/python"
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Development workflow

Currently, it is not recommended to run the studio on its own. Therefore, you must start the Botpress Server, which will provide a couple of required parameters so the studio can work smoothly with the server.
Currently, it is not recommended to run the studio on its own. Therefore, you must start the TheGurúCompany Studio Server, which will provide a couple of required parameters so the studio can work smoothly with the server.

We use Yarn v3 in this repository, so if you have errors while trying to build the repository, ensure you have the latest version installed: `npm install -g yarn`

Expand All @@ -11,7 +11,7 @@ We use Yarn v3 in this repository, so if you have errors while trying to build t

Like before, any changes made on the frontend will be available after a simple page refresh. Changes on the backend will require a server restart.

Since this package MUST be started from the Botpress Server, you need to set a special environment variable on the server so it can load the correct files.
Since this package MUST be started from the TheGurúCompany Studio Server, you need to set a special environment variable on the server so it can load the correct files.
The variable is named `DEV_STUDIO_PATH` and must point to `packages/studio-be/out`. Watch out, path must be an abs path, env var doesn't support relative path.

## As standalone (NOT RECOMMENDED)
Expand All @@ -20,7 +20,7 @@ The studio can be executed as a standalone application, but there are still a co

When started as a standalone, these environment variables must be set:

- BP_MODULES_PATH: Path to the modules folder of a Botpress installation
- BP_MODULES_PATH: Path to the modules folder of a TheGurúCompany Studio installation
- BP_DATA_FOLDER: Path to the data folder (bots/, global/)
- BP_SERVER_URL: to determine

Expand Down
2 changes: 1 addition & 1 deletion packages/studio-be/src/common/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const asyncMiddleware =
* @constructor
* @param message - The error message that will be sent to the end-user
* @param statusCode - The HTTP status code
* @param errorCode - Botpress error codes e.g. BP_0001, BP_0002, etc.
* @param errorCode - TheGurúCompany Studio error codes e.g. BP_0001, BP_0002, etc.
*/
export class ResponseError extends Error {
errorCode: string | undefined
Expand Down
10 changes: 8 additions & 2 deletions packages/studio-be/src/core/app/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ async function start() {
process.LOADED_MODULES[loadedModule.entryPoint.definition.name] = loadedModule.moduleLocation
}

showBanner({ title: 'Botpress Studio', version: process.STUDIO_VERSION, logScopeLength: 9, bannerWidth: 75, logger })
showBanner({
title: 'TheGurúCompany Studio',
version: process.STUDIO_VERSION,
logScopeLength: 9,
bannerWidth: 75,
logger
})

if (!fs.existsSync(process.APP_DATA_PATH)) {
try {
Expand All @@ -128,7 +134,7 @@ This is a fatal error, process will exit.`
}

await app.botpress.start({ modules: loadedModules.map((m) => m.entryPoint) }).catch((err) => {
logger.attachError(err).error('Error starting Botpress Studio')
logger.attachError(err).error('Error starting TheGurúCompany Studio')

if (!process.IS_FAILSAFE) {
process.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-be/src/core/app/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export class HTTPServer {
return res
.status(503)
.send(
'<html><head><meta http-equiv="refresh" content="2"> </head><body>Botpress is loading. Please try again in a minute.</body></html>'
'<html><head><meta http-equiv="refresh" content="2"> </head><body>TheGurúCompany Studio is loading. Please try again in a minute.</body></html>'
)
}
}
Expand Down Expand Up @@ -264,7 +264,7 @@ export class HTTPServer {
const errorCode = err.errorCode
const message = err.message || err || 'Unexpected error'
const details = err.details || ''
const docs = err.docs || 'https://botpress.com/docs'
const docs = err.docs || 'https://chtostudio.com/docs'
const devOnly = process.IS_PRODUCTION ? {} : { showStackInDev: true, stack: err.stack, full: err.message }

res.status(statusCode).json({
Expand Down
4 changes: 2 additions & 2 deletions packages/studio-be/src/core/config/config-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ export class ConfigProvider {
public async getBrandingConfig(appName: 'admin' | 'studio') {
const defaultConfig = {
admin: {
title: 'Botpress Admin Panel',
title: 'TheGurúCompany Studio Admin Panel',
favicon: 'assets/admin/ui/public/favicon.ico',
customCss: ''
},
studio: {
title: 'Botpress Studio',
title: 'TheGurúCompany Studio',
favicon: 'assets/studio/ui/public/img/favicon.png',
customCss: ''
}
Expand Down
6 changes: 3 additions & 3 deletions packages/studio-be/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import metadata from './metadata.json'

const printPlainError = (err) => {
/* eslint-disable no-console */
console.log('Error starting botpress')
console.log('Error starting TheGurúCompany Studio')
console.log(err)
console.log(err.message)
console.log('---STACK---')
Expand Down Expand Up @@ -93,11 +93,11 @@ try {
require('yargs')
.command(
['serve', '$0'],
'Start your botpress server',
'Start your TheGurúCompany Studio server',
{
dataFolder: {
alias: ['d', 'data'],
description: 'Starts Botpress in standalone mode on that specific data folder',
description: 'Starts TheGurúCompany Studio in standalone mode on that specific data folder',
type: 'string'
}
},
Expand Down
34 changes: 17 additions & 17 deletions packages/studio-be/src/sdk/botpress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ declare module 'botpress/sdk' {
export type KnexExtended = Knex & KnexExtension

/**
* Returns the current version of Botpress
* Returns the current version of TheGurúCompany Studio
*/
export const version: string

/**
* This variable gives you access to the Botpress database via Knex.
* This variable gives you access to the TheGurúCompany Studio database via Knex.
* When developing modules, you can use this to create tables and manage data
* @example bp.database('srv_channel_users').insert()
*/
Expand Down Expand Up @@ -128,7 +128,7 @@ declare module 'botpress/sdk' {

/**
* The Module Entry Point is used by the module loader to bootstrap the module. It must be present in the index.js file
* of the module. The path to the module must also be specified in the global botpress config.
* of the module. The path to the module must also be specified in the global TheGurúCompany Studio config.
*/
export interface ModuleEntryPoint {
/** Additional metadata about the module */
Expand Down Expand Up @@ -182,7 +182,7 @@ declare module 'botpress/sdk' {
name: string
/** Gives a short description of your module, which is displayed once the template is selected */
desc: string
/** These are used internally by Botpress when they are registered on startup */
/** These are used internally by TheGurúCompany Studio when they are registered on startup */
readonly moduleId?: string
readonly moduleName?: string
}
Expand Down Expand Up @@ -384,7 +384,7 @@ declare module 'botpress/sdk' {
export const SKIP_DIALOG_ENGINE: symbol
/** When this flag is active, the QNA module won't intercept this event */
export const SKIP_QNA_PROCESSING: symbol
/** When this flag is active, Botpress Native NLU will not process this event */
/** When this flag is active, TheGurúCompany Studio Native NLU will not process this event */
export const SKIP_NATIVE_NLU: symbol
/** When this flag is active, the Event State is persisted even if the dialog engine is skipped */
export const FORCE_PERSIST_STATE: symbol
Expand All @@ -410,7 +410,7 @@ declare module 'botpress/sdk' {
}

/**
* A BotpressEvent is how conversational channels interact with Botpress. Events represent all the interactions
* A TheGurúCompany Studio Event is how conversational channels interact with TheGurúCompany Studio. Events represent all the interactions
* that make up a conversation. That means the different message types (text, image, buttons, carousels etc) but also
* the navigational events (chat open, user typing) and contextual events (user returned home, order delivered).
*/
Expand Down Expand Up @@ -543,7 +543,7 @@ declare module 'botpress/sdk' {
* store and retrieve data for different kind of situations.
*/
export interface EventState {
/** Data saved as user attributes; retention policies in Botpress global config applies */
/** Data saved as user attributes; retention policies in TheGurúCompany Studio global config applies */
user: any
/** Data is kept for the active session. Timeout configurable in the global config file */
session: CurrentSession
Expand All @@ -555,7 +555,7 @@ declare module 'botpress/sdk' {
* There is a possible race condition since it is loaded each time a messages comes in. Update it wisely
*/
bot: any
/** Used internally by Botpress to keep the user's current location and upcoming instructions */
/** Used internally by TheGurúCompany Studio to keep the user's current location and upcoming instructions */
context?: DialogContext
/** This variable points to the currently active workflow */
workflow: WorkflowHistory
Expand Down Expand Up @@ -972,7 +972,7 @@ declare module 'botpress/sdk' {
/**
* A Content Type describes a grouping of Content Elements @see ContentElement sharing the same properties.
* They can describe anything and everything – they most often are domain-specific to your bot. They also
* tells botpress how to display the content on various channels
* tells TheGurúCompany Studio how to display the content on various channels
*/
export interface ContentType {
id: string
Expand Down Expand Up @@ -1093,7 +1093,7 @@ declare module 'botpress/sdk' {
export interface FlowGenerationResult {
/**
* A partial flow originating from a skill flow generator. Missing pieces will be automatically added
* once the flow is sent to Botpress, the final product will be a Flow.
* once the flow is sent to TheGurúCompany Studio, the final product will be a Flow.
*/
flow: SkillFlow
/** An array of possible transitions for the parent node */
Expand Down Expand Up @@ -1319,7 +1319,7 @@ declare module 'botpress/sdk' {
inversify: any
}

/** These are additional information that Botpress may pass down to migrations (for ex: running bot-specific migration) */
/** These are additional information that TheGurúCompany Studio may pass down to migrations (for ex: running bot-specific migration) */
export interface MigrationMetadata {
botId?: string
}
Expand Down Expand Up @@ -1875,7 +1875,7 @@ declare module 'botpress/sdk' {
export function getModuleConfigForBot(moduleId: string, botId: string, ignoreGlobal?: boolean): Promise<any>

/**
* Returns the configuration options of Botpress
* Returns the configuration options of TheGurúCompany Studio
*/
export function getBotpressConfig(): Promise<any>

Expand Down Expand Up @@ -2169,7 +2169,7 @@ declare module 'botpress/sdk' {
*/
export namespace security {
/**
* Creates a message signature, which can be used as proof that the message was created on Botpress backend
* Creates a message signature, which can be used as proof that the message was created on TheGurúCompany Studio backend
* You can call this method twice to verify the authenticity of a message
*/
export function getMessageSignature(message: string): Promise<string>
Expand Down Expand Up @@ -2240,12 +2240,12 @@ declare module 'botpress/sdk' {
/**
* Creates a mapping of ids for a conversation in a given channel
* @param channel The channel for which to create the mapping
* @param localId The id of the conversation in botpress
* @param localId The id of the conversation in TheGurúCompany Studio
* @param foreignId The id of the conversation in that channel
* @example
* // I have been given an conversation id by facebook messenger
* const messengerConversationId = 134314
* // Let's say I have an already existing botpress conversation somewhere that I want to attach to this conversation
* // Let's say I have an already existing TheGurúCompany Studio conversation somewhere that I want to attach to this conversation
* const conversationId = '00001337-ca79-4235-8475-3785e41eb2be'
*
* // Create the mapping
Expand All @@ -2264,12 +2264,12 @@ declare module 'botpress/sdk' {
deleteMapping(channel: string, localId: uuid, foreignId: string): Promise<boolean>

/**
* Gets a conversations id specific to the given channel from a botpress conversation id
* Gets a conversations id specific to the given channel from a TheGurúCompany Studio conversation id
*/
getForeignId(channel: string, localId: uuid): Promise<string | undefined>

/**
* Gets a botpress conversation id from the foreign id of a conversation in a the given channel
* Gets a TheGurúCompany Studio conversation id from the foreign id of a conversation in a the given channel
*/
getLocalId(channel: string, foreignId: string): Promise<string | undefined>
}
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-be/src/studio/nlu/entities-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { NLUService } from './nlu-service'

const ENTITIES_DIR = './entities'

// copied from botpress/nlu repo
// copied from TheGurúCompany Studio/nlu repo
const SYSTEM_ENTITIES = [
'amountOfMoney',
'distance',
Expand Down
20 changes: 10 additions & 10 deletions packages/studio-be/src/typings/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ declare namespace NodeJS {
APP_SECRET: string
IS_STANDALONE: boolean
/**
* Path to the global APP DATA folder, shared across all installations of Botpress Server
* Path to the global APP DATA folder, shared across all installations of TheGurúCompany Studio Server
* Use this folder to store stuff you'd like to cache, like NLU language models etc
*/
APP_DATA_PATH: string
Expand All @@ -30,11 +30,11 @@ declare namespace NodeJS {
PROXY?: string
EXTERNAL_URL: string
LOCAL_URL: string
/** This is the subfolder where Botpress is located (ex: /botpress/). It is extracted from the external URL */
/** This is the subfolder where TheGurúCompany Studio is located (ex: /TheGurúCompany Studio/). It is extracted from the external URL */
ROOT_PATH: string
/** Path to the studio executable */
STUDIO_LOCATION: string
/** Either equal to studio location, or to the botpress source code file */
/** Either equal to studio location, or to the TheGurúCompany Studio source code file */
PROJECT_LOCATION: string
/** Location of the bots/, global/ and storage/ folders à */
DATA_LOCATION: string
Expand Down Expand Up @@ -80,7 +80,7 @@ declare interface BotpressEnvironmentVariables {
/** Change the BPFS storage mechanism ("database" or "disk"). Defaults to "disk" */
readonly BPFS_STORAGE?: 'database' | 'disk'

/** The URL exposed by Botpress to external users (eg: when displaying links) */
/** The URL exposed by TheGurúCompany Studio to external users (eg: when displaying links) */
readonly EXTERNAL_URL?: string

/**
Expand All @@ -95,21 +95,21 @@ declare interface BotpressEnvironmentVariables {
*/
readonly DATABASE_URL?: string

/** When running botpress in production, some optimizations are applied */
/** When running TheGurúCompany Studio in production, some optimizations are applied */
readonly BP_PRODUCTION?: boolean

/** Enable cluster mode */
readonly CLUSTER_ENABLED?: boolean

/**
* Set this to true if you're exposing Botpress through a reverse proxy such as Nginx
* Set this to true if you're exposing TheGurúCompany Studio through a reverse proxy such as Nginx
* Can also be either an IP address or a hostname
* Read more: https://expressjs.com/en/guide/behind-proxies.html
*/
readonly REVERSE_PROXY?: string

/** Use this proxy connection string to access external services, like Duckling and Licensing
* This values overwrites the value defined in the global Botpress configuration
* This values overwrites the value defined in the global TheGurúCompany Studio configuration
* @example http://username:password@hostname:port
*/
readonly BP_PROXY?: string
Expand All @@ -136,7 +136,7 @@ declare interface BotpressEnvironmentVariables {
readonly APP_DATA_PATH?: string

/**
* Truthy if running the official Botpress docker image
* Truthy if running the official TheGurúCompany Studio docker image
*/
readonly BP_IS_DOCKER?: boolean

Expand All @@ -147,7 +147,7 @@ declare interface BotpressEnvironmentVariables {
readonly BP_MAX_MEMORY_CACHE_SIZE?: string

/**
* When set to true, Botpress will not automatically restart on crash
* When set to true, TheGurúCompany Studio will not automatically restart on crash
* @default false
*/
readonly BP_DISABLE_AUTO_RESTART?: boolean
Expand All @@ -171,7 +171,7 @@ declare interface BotpressEnvironmentVariables {
readonly BP_DISABLE_SERVER_DIAG?: boolean

/**
* Prevents Botpress from closing cleanly when an error is encountered.
* Prevents TheGurúCompany Studio from closing cleanly when an error is encountered.
* This only affects fatal errors, it will not affect business rules checks (eg: licensing)
*/
readonly BP_FAILSAFE?: boolean
Expand Down
2 changes: 1 addition & 1 deletion packages/studio-ui/src/web/components/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class App extends Component<Props> {
}

componentDidMount() {
const appName = window.APP_NAME || 'Botpress Studio'
const appName = window.APP_NAME || 'TheGurúCompany Studio'
const botName = window.BOT_NAME ? ` – ${window.BOT_NAME}` : ''
window.document.title = `${appName}${botName}`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,5 @@ const ConnectedContentPicker = connect<DispatchProps, StateProps, OwnProps>(
mapDispatchToProps
)(withLanguage(ContentPickerWidget))

// Passing store explicitly since this component may be imported from another botpress-module
// Passing store explicitly since this component may be imported from another TheGurúCompany Studio-module
export default (props: OwnProps) => <ConnectedContentPicker {...props} store={store} />
Loading