Skip to content

Commit

Permalink
Merge branch 'master' into chore/rename-memories-struct
Browse files Browse the repository at this point in the history
  • Loading branch information
frsechet authored Sep 23, 2020
2 parents 93d761f + 67e7e27 commit cf6b01b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 35 deletions.
57 changes: 29 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,12 @@ start:
goto name

name:
say Question("I'd like to know you better, what's your name?",
say Question(
"I'd like to know you better, what's your name?",
buttons=[
Button("I'm anonymous 😎", accepts=["No", "Nope"]) as anonBtn
])
],
)
hold
if (event.match(anonBtn)) {
remember name = "anon"
Expand All @@ -73,43 +75,24 @@ known:
goto end
```
## Usage
The full documentation of the project is available on https://docs.csml.dev/language.
The CSML Engine and Language are built in Rust. The full documentation of the project is available on https://docs.csml.dev/language.
The conversational engine is available for use in several types of projects, depending on your environment of choice.
### With CSML Studio
## Using CSML Studio
The simplest way to get started with CSML is to use CSML Studio, a free online development environment with everything already setup to start creating bots right away, directly in your browser.
To get started with CSML Studio: https://studio.csml.dev
CSML Studio gives you a free playground to experiment with the language as well as options to deploy your chatbots at scale in one-click.
### With Docker
## Self-hosted / local installation
We also provide a docker image for easy self-hosted usage.
```
docker pull clevy/csml-engine
```
To get started with CSML Engine on Docker: https://github.com/CSML-by-Clevy/csml-engine-docker
### With Rust, from source
Make sure you are running Rust v1.46, then run:
```
cd csml_server
cargo build --release
```
CSML is available as a self-hostable web server that you can easily install with one of the options below.
Note that you will need a database available. The default choice is MongoDB, but Amazon DynamoDB
is also available with the `dynamodb` type with a slightly different set of environment variables.
Note that you will need a database. The default choice is **MongoDB**, but **Amazon DynamoDB**
is also available by choosing the `dynamodb` engine DB type with a slightly different set of environment variables.
Make sure that you have the environment set with following options:
Before you start, make sure that you have the environment set with following options:
```
ENGINE_DB_TYPE=mongodb # or dynamodb
Expand All @@ -135,6 +118,24 @@ DISABLE_SSL_VERIFY=false
DEBUG=true
```
### With Docker
We provide a docker image for easy self-hosted usage.
```
docker pull clevy/csml-engine
```
To get started with CSML Engine on Docker: https://github.com/CSML-by-Clevy/csml-engine-docker
### With Rust, from source
CSML is built in [Rust](https://www.rust-lang.org/). You don't need to know any Rust to run it though! Make sure you are running Rust v1.46, then run:
```
cd csml_server
cargo build --release
```
After that, execute your build (by default under ./targets/release/csml_server) and visit http://localhost:5000 for some request examples.
Expand Down
6 changes: 3 additions & 3 deletions csml_interpreter/src/error_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub const ERROR_PARENTHESES_END: &'static str =
"invalid argument expect one ',' between each argument or ')' to end the list";
pub const ERROR_NUMBER_AS_IDENT: &'static str = "Int/Float can't be used as identifier";
pub const ERROR_FLOW_STEP: &'static str =
"flow must have steps declared as 'step_name:' before any action";
"syntax error.";
pub const ERROR_RESERVED: &'static str = "reserved keyword can't be used as identifier";
pub const ERROR_PARSING: &'static str =
"invalid argument. Use one of the action keywords [say, do, if, ...]";
Expand Down Expand Up @@ -46,7 +46,7 @@ pub const ERROR_NO_FLOW: &'static str = "bot must have at least one flow";
pub const ERROR_STEP_EXIST: &'static str = "step does not exist";
pub const ERROR_INVALID_FLOW: &'static str = "invalid flow: ";
pub const ERROR_START_INSTRUCTIONS: &'static str =
"to start an action one of the following instructions is expected: [say, do, if, foreach, goto]";
"to start an action one of the following instructions is expected: [say, do, if, foreach, goto]";
pub const ERROR_FOREACH: &'static str =
"foreach only accepts array as iterable elements. Example: foreach(elem) in [1, 2, 3]";
pub const ERROR_FIND_BY_INDEX: &'static str =
Expand Down Expand Up @@ -80,7 +80,7 @@ pub const ERROR_JSON_TO_LITERAL: &'static str = "number is too big to be an int

// ### Memory
pub const ERROR_STEP_MEMORY: &'static str = "variable does not exist in step's memory";
pub const ERROR_FIND_MEMORY: &'static str = "is not set in memory";
pub const ERROR_FIND_MEMORY: &'static str = "is used before it was saved in memory";

// ### Built-in
pub const ERROR_TEXT: &'static str =
Expand Down
6 changes: 3 additions & 3 deletions csml_interpreter/tests/hold.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ fn hold_test_none() {
let data = r#"
{"memories":[],
"messages":[
{"content":{"error":"< this_hold > is not set in memory at line 2, column 5 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"error":"< this_hold > is used before it was saved in memory at line 2, column 5 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"text":"1"}, "content_type":"text"},
{"content":{"text":"2"}, "content_type":"text"},
{"content":{"error": "< this_hold > is not set in memory at line 8, column 6 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"error": "< this_hold > is used before it was saved in memory at line 8, column 6 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"text":"4"}, "content_type":"text"}]
}
"#;
Expand Down Expand Up @@ -48,7 +48,7 @@ fn hold_test_some_0() {
"messages":[
{"content":{"text":"1"}, "content_type":"text"},
{"content":{"text":"2"}, "content_type":"text"},
{"content":{"error": "< this_hold > is not set in memory at line 8, column 6 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"error": "< this_hold > is used before it was saved in memory at line 8, column 6 in step [start] from flow [flow]"}, "content_type":"error"},
{"content":{"text":"4"}, "content_type":"text"}
]
}
Expand Down
2 changes: 1 addition & 1 deletion csml_interpreter/tests/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fn ok_text_step4() {
let data = r#"
{
"messages":[
{"content":{"error": "< hola > is not set in memory at line 18, column 17 in step [text4] from flow [flow]"}, "content_type": "error"},
{"content":{"error": "< hola > is used before it was saved in memory at line 18, column 17 in step [text4] from flow [flow]"}, "content_type": "error"},
{"content":{"text": "😀 Null"},"content_type":"text"}
],"memories":[]
}"#;
Expand Down

0 comments on commit cf6b01b

Please sign in to comment.