$convoArr['conversation']['user_id'] = $user_id; $convoArr['conversation']['convo_id'] = $new_convo_id; runDebug(__FILE__, __FUNCTION__, __LINE__, "User ID = {$user_id}.", 4); $sql = "delete from `{$dbn}`.`client_properties` where `user_id` = {$user_id};"; runDebug(__FILE__, __FUNCTION__, __LINE__, "Clear client properties from the DB - SQL:\n{$sql}", 4); } $say = "Hello"; } //add any pre-processing addons $say = run_pre_input_addons($convoArr, $say); /** @noinspection PhpUndefinedVariableInspection */ $bot_id = isset($form_vars['bot_id']) ? $form_vars['bot_id'] : $bot_id; runDebug(__FILE__, __FUNCTION__, __LINE__, "Details:\nUser say: " . $say . "\nConvo id: " . $convo_id . "\nBot id: " . $bot_id . "\nFormat: " . $form_vars['format'], 2); //get the stored vars $convoArr = read_from_session(); $convoArr = load_default_bot_values($convoArr); //now overwrite with the recieved data $convoArr = check_set_convo_id($convoArr); $convoArr = check_set_bot($convoArr); $convoArr = check_set_user($convoArr); if (!isset($convoArr['conversation']['user_id']) and isset($user_id)) { $convoArr['conversation']['user_id'] = $user_id; } $convoArr = check_set_format($convoArr); $convoArr = load_that($convoArr); $convoArr = buildNounList($convoArr); $convoArr['time_start'] = $time_start; $convoArr = load_bot_config($convoArr); //if totallines isn't set then this is new user runDebug(__FILE__, __FUNCTION__, __LINE__, "Debug level = {$debug_level}", 0); $debug_level = $convoArr['conversation']['debug_level'];
/** * function add_firstturn_conversation_vars() * A function add the bot values to the conversation state if this is the first turn * @param array $convoArr - the current state of the conversation array * @return $convoArr (updated) **/ function add_firstturn_conversation_vars($convoArr) { runDebug(__FILE__, __FUNCTION__, __LINE__, "First turn", 4); if (!isset($convoArr['bot_properties'])) { $convoArr = load_default_bot_values($convoArr); } return $convoArr; }