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

load generic components before validate #277

Merged
merged 1 commit into from
May 19, 2021
Merged
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
12 changes: 6 additions & 6 deletions csml_engine/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,12 @@ pub fn init_conversation_info<'a>(
* Initialize the bot
*/
pub fn init_bot(bot: &mut CsmlBot) -> Result<(), EngineError> {
// load native components into the bot
bot.native_components = match load_components() {
Ok(components) => Some(components),
Err(err) => return Err(EngineError::Interpreter(err.format_error())),
};

match validate_bot(&bot) {
CsmlResult {
flows: Some(flows),
Expand All @@ -122,12 +128,6 @@ pub fn init_bot(bot: &mut CsmlBot) -> Result<(), EngineError> {
_ => return Err(EngineError::Interpreter(format!("empty bot"))),
}

// load native components into the bot
bot.native_components = match load_components() {
Ok(components) => Some(components),
Err(err) => return Err(EngineError::Interpreter(err.format_error())),
};

Ok(())
}

Expand Down
3 changes: 1 addition & 2 deletions csml_engine/src/interpreter_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ pub fn interpret_step(
memories.insert(mem.key.clone(), mem);
},
MSG::Message(msg) => {
println!("{:?}", msg);
send_msg_to_callback_url(data, vec![msg.clone()], interaction_order, false);
data.messages.push(msg);
}
Expand Down Expand Up @@ -145,7 +144,7 @@ pub fn interpret_step(
if let Ok(var) = env::var(DEBUG) {
if var == "true" {
let el = now.elapsed()?;
println!(
eprintln!(
"Save message & memories bulk at the end of step - {}.{}",
el.as_secs(),
el.as_millis()
Expand Down
2 changes: 1 addition & 1 deletion csml_interpreter/src/data/primitive/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ impl PrimitiveObject {
interval
)
);
Ok(PrimitiveBoolean::get_literal(true, interval))
Ok(PrimitiveObject::get_literal(&object.value, interval))
}
None => Ok(PrimitiveBoolean::get_literal(false, interval))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ pub fn gen_generic_component(
}

for key in keys {
println!("=> {}", key);
if let Some(result) = memoization.get(key) {
hashmap.insert(
key.to_owned(),
Expand Down