'',
'top_p' => '',
'presence_penalty' => '',
'frequency_penalty' => '',
'model' => '',
'enable_vision' => '',
'instant_response' => '',
'assistant_id' => '',
'chat_preppend_text' => '',
'user_message_preppend' => '',
'ai_message_preppend' => '',
'internet_access' => 'enabled',
'embeddings' => 'enabled',
'embeddings_namespace' => '',
'ai_first_message' => '',
'chat_mode' => '',
'user_token_cap_per_day' => '',
'persistent' => '',
'persistent_guests' => '',
'prompt_templates' => '',
'prompt_editable' => '',
'placeholder' => '',
'submit' => '',
'submit_image' => '',
'submit_full' => '',
'show_in_window' => '',
'window_location' => '',
'font_size' => '',
'height' => '',
'background' => '',
'minheight' => '',
'bubble_width' => '',
'bubble_alignment' => '',
'bubble_user_alignment' => '',
'show_user_avatar' => '',
'show_ai_avatar' => '',
'general_background' => '',
'width' => '',
'user_font_color' => '',
'user_background_color' => '',
'input_text_color' => '',
'persona_name_color' => '',
'persona_role_color' => '',
'input_placeholder_color' => '',
'ai_font_color' => '',
'ai_background_color' => '',
'input_border_color' => '',
'submit_color' => '',
'voice_color' => '',
'voice_color_activated' => '',
'submit_text_color' => '',
'ai_role' => '',
'ai_avatar' => '',
'user_avatar' => '',
'ai_name' => '',
'show_header' => '',
'show_dltxt' => '',
'show_mute' => '',
'show_internet' => '',
'overwrite_voice' => '',
'overwrite_avatar_image' => '',
'disable_streaming' => '',
'show_clear' => '',
'ai_persona' => '',
'compliance' => '',
'select_prompt' => '',
'chatbot_text_speech' => '',
'enable_god_mode' => '',
'upload_pdf' => '',
'file_uploads' => '',
'custom_header' => '',
'custom_footer' => '',
'custom_css' => '',
'send_message_sound' => '',
'receive_message_sound' => '',
'response_delay' => '',
'disable_filters' => '',
'no_padding' => '',
'bot_workflow' => '',
'store_data' => '',
'mcp_servers' => '',
'additional_bots' => ''
), $atts );
$chat_unique_id = aimogen_generateUniqueIdFromArray($atts);
$chatid = uniqid();
$return_me = '
';
$temp = $atts['temperature'];
$top_p = $atts['top_p'];
$presence = $atts['presence_penalty'];
$frequency = $atts['frequency_penalty'];
$model = $atts['model'];
$enable_vision = '';
$disable_streaming = $atts['disable_streaming'];
$instant_response = $atts['instant_response'];
$assistant_id = $atts['assistant_id'];
$chat_preppend_text = '';
$user_message_preppend = '';
$ai_message_preppend = '';
$ai_name = $atts['ai_name'];
$ai_first_message = $atts['ai_first_message'];
$chat_mode = $atts['chat_mode'];
$no_padding = $atts['no_padding'];
$bot_workflow = '';
$store_data = '';
$user_token_cap_per_day = '';
$persistent = '';
$prompt_templates = '';
$prompt_editable = '';
$internet_access = '';
$embeddings = '';
$embeddings_namespace = '';
$placeholder = $atts['placeholder'];
$submit = $atts['submit'];
$submit_image = $atts['submit_image'];
$submit_full = $atts['submit_full'];
$enable_front_end = $atts['show_in_window'];
$window_location = $atts['window_location'];
$font_size = $atts['font_size'];
$height = $atts['height'];
$background = $atts['background'];
$minheight = $atts['minheight'];
$bubble_width = $atts['bubble_width'];
$bubble_alignment = $atts['bubble_alignment'];
$bubble_user_alignment = $atts['bubble_user_alignment'];
$show_user_avatar = $atts['show_user_avatar'];
$show_ai_avatar = $atts['show_ai_avatar'];
$general_background = $atts['general_background'];
$user_font_color = $atts['user_font_color'];
$user_background_color = $atts['user_background_color'];
$ai_font_color = $atts['ai_font_color'];
$ai_background_color = $atts['ai_background_color'];
$input_border_color = $atts['input_border_color'];
$input_text_color = $atts['input_text_color'];
$persona_name_color = $atts['persona_name_color'];
$persona_role_color = $atts['persona_role_color'];
$input_placeholder_color = $atts['input_placeholder_color'];
$submit_color = $atts['submit_color'];
$voice_color = $atts['voice_color'];
$voice_color_activated = $atts['voice_color_activated'];
$submit_text_color = $atts['submit_text_color'];
$ai_role = $atts['ai_role'];
$ai_avatar = $atts['ai_avatar'];
$user_avatar = $atts['user_avatar'];
$width = $atts['width'];
$show_header = $atts['show_header'];
$show_dltxt = $atts['show_dltxt'];
$show_mute = $atts['show_mute'];
$show_internet = $atts['show_internet'];
$overwrite_voice = $atts['overwrite_voice'];
$overwrite_avatar_image = $atts['overwrite_avatar_image'];
$show_clear = $atts['show_clear'];
$persistent_guests = $atts['persistent_guests'];
$ai_persona = $atts['ai_persona'];
$compliance = $atts['compliance'];
$select_prompt = $atts['select_prompt'];
$chatbot_text_speech = '';
$enable_god_mode = '';
$upload_pdf = $atts['upload_pdf'];
$file_uploads = $atts['file_uploads'];
$custom_header = $atts['custom_header'];
$custom_footer = $atts['custom_footer'];
$custom_css = $atts['custom_css'];
$send_message_sound = '';
$receive_message_sound = '';
$response_delay = '';
$disable_filters = '';
$additional_bots = '';
$mcp_servers = '';
$aimogen_Chatbot_Settings = get_option('aimogen_Chatbot_Settings', false);
$aimogen_Main_Settings = get_option('aimogen_Main_Settings', false);
if (isset($aimogen_Chatbot_Settings['custom_footer']) && $aimogen_Chatbot_Settings['custom_footer'] != '' && $custom_footer == '')
{
$custom_footer = $aimogen_Chatbot_Settings['custom_footer'];
}
if (isset($aimogen_Chatbot_Settings['custom_header']) && $aimogen_Chatbot_Settings['custom_header'] != '' && $custom_header == '')
{
$custom_header = $aimogen_Chatbot_Settings['custom_header'];
}
if (isset($aimogen_Chatbot_Settings['custom_css']) && $aimogen_Chatbot_Settings['custom_css'] != '' && $custom_css == '')
{
$custom_css = $aimogen_Chatbot_Settings['custom_css'];
}
$strip_botname = '0';
if (isset($aimogen_Chatbot_Settings['strip_botname']) && $aimogen_Chatbot_Settings['strip_botname'] == 'on')
{
$strip_botname = '1';
}
if (isset($aimogen_Chatbot_Settings['additional_bots']) && $aimogen_Chatbot_Settings['additional_bots'] != '' && $additional_bots == '')
{
if(!empty($aimogen_Chatbot_Settings['additional_bots']) && is_array($aimogen_Chatbot_Settings['additional_bots']))
{
$additional_bots = implode(',', $aimogen_Chatbot_Settings['additional_bots']);
}
}
if (isset($aimogen_Chatbot_Settings['enable_mcp']) && $aimogen_Chatbot_Settings['enable_mcp'] != '' && $mcp_servers == '')
{
if(!empty($aimogen_Chatbot_Settings['enable_mcp']) && is_array($aimogen_Chatbot_Settings['enable_mcp']))
{
$mcp_servers = implode(',', $aimogen_Chatbot_Settings['enable_mcp']);
}
}
$custom_footer = html_entity_decode($custom_footer, ENT_QUOTES);
$custom_header = html_entity_decode($custom_header, ENT_QUOTES);
$custom_css = html_entity_decode($custom_css, ENT_QUOTES);
if (isset($aimogen_Chatbot_Settings['chat_model']) && $aimogen_Chatbot_Settings['chat_model'] != '' && $model == '')
{
$model = $aimogen_Chatbot_Settings['chat_model'];
}
if (isset($aimogen_Chatbot_Settings['temperature']) && $aimogen_Chatbot_Settings['temperature'] != '' && $temp == '')
{
$temp = $aimogen_Chatbot_Settings['temperature'];
}
if (isset($aimogen_Chatbot_Settings['top_p']) && $aimogen_Chatbot_Settings['top_p'] != '' && $top_p == '')
{
$top_p = $aimogen_Chatbot_Settings['top_p'];
}
if (isset($aimogen_Chatbot_Settings['presence_penalty']) && $aimogen_Chatbot_Settings['presence_penalty'] != '' && $presence == '')
{
$presence = $aimogen_Chatbot_Settings['presence_penalty'];
}
if (isset($aimogen_Chatbot_Settings['frequency_penalty']) && $aimogen_Chatbot_Settings['frequency_penalty'] != '' && $frequency == '')
{
$frequency = $aimogen_Chatbot_Settings['frequency_penalty'];
}
if (isset($aimogen_Chatbot_Settings['instant_response']) && $aimogen_Chatbot_Settings['instant_response'] != '' && $instant_response == '')
{
$instant_response = $aimogen_Chatbot_Settings['instant_response'];
}
if (isset($aimogen_Chatbot_Settings['assistant_id']) && $aimogen_Chatbot_Settings['assistant_id'] != '' && $assistant_id == '')
{
$assistant_id = $aimogen_Chatbot_Settings['assistant_id'];
}
if (isset($aimogen_Chatbot_Settings['ai_first_message']) && $aimogen_Chatbot_Settings['ai_first_message'] != '' && $ai_first_message == '')
{
$ai_first_message = $aimogen_Chatbot_Settings['ai_first_message'];
}
if (isset($aimogen_Chatbot_Settings['chat_mode']) && $aimogen_Chatbot_Settings['chat_mode'] != '' && $chat_mode == '')
{
$chat_mode = $aimogen_Chatbot_Settings['chat_mode'];
}
if (isset($aimogen_Chatbot_Settings['user_token_cap_per_day']) && $aimogen_Chatbot_Settings['user_token_cap_per_day'] != '' && $user_token_cap_per_day == '')
{
$user_token_cap_per_day = $aimogen_Chatbot_Settings['user_token_cap_per_day'];
}
if (isset($aimogen_Chatbot_Settings['persistent']) && $aimogen_Chatbot_Settings['persistent'] != '' && $persistent == '')
{
$persistent = $aimogen_Chatbot_Settings['persistent'];
}
if (isset($aimogen_Chatbot_Settings['persistent_guests']) && $aimogen_Chatbot_Settings['persistent_guests'] != '' && $persistent_guests == '')
{
$persistent_guests = $aimogen_Chatbot_Settings['persistent_guests'];
}
if (isset($aimogen_Chatbot_Settings['prompt_editable']) && $aimogen_Chatbot_Settings['prompt_editable'] != '' && $prompt_editable == '')
{
$prompt_editable = $aimogen_Chatbot_Settings['prompt_editable'];
}
if (isset($aimogen_Chatbot_Settings['prompt_templates']) && $aimogen_Chatbot_Settings['prompt_templates'] != '' && $prompt_templates == '')
{
$prompt_templates = $aimogen_Chatbot_Settings['prompt_templates'];
}
if (isset($aimogen_Chatbot_Settings['placeholder']) && $aimogen_Chatbot_Settings['placeholder'] != '' && $placeholder == '')
{
$placeholder = $aimogen_Chatbot_Settings['placeholder'];
}
if (isset($aimogen_Chatbot_Settings['submit']) && $aimogen_Chatbot_Settings['submit'] != '' && $submit == '')
{
$submit = $aimogen_Chatbot_Settings['submit'];
}
if (isset($aimogen_Chatbot_Settings['submit_image']) && $aimogen_Chatbot_Settings['submit_image'] != '' && $submit_image == '')
{
$submit_image = $aimogen_Chatbot_Settings['submit_image'];
}
if (isset($aimogen_Chatbot_Settings['submit_full']) && $aimogen_Chatbot_Settings['submit_full'] != '' && $submit_full == '')
{
$submit_full = $aimogen_Chatbot_Settings['submit_full'];
}
if (isset($aimogen_Chatbot_Settings['window_location']) && $aimogen_Chatbot_Settings['window_location'] != '' && $window_location == '')
{
$window_location = $aimogen_Chatbot_Settings['window_location'];
}
if (isset($aimogen_Chatbot_Settings['ai_role']) && $aimogen_Chatbot_Settings['ai_role'] != '' && $ai_role == '')
{
$ai_role = $aimogen_Chatbot_Settings['ai_role'];
}
if (isset($aimogen_Chatbot_Settings['ai_avatar']) && $aimogen_Chatbot_Settings['ai_avatar'] != '' && $ai_avatar == '')
{
$ai_avatar = $aimogen_Chatbot_Settings['ai_avatar'];
}
if (isset($aimogen_Chatbot_Settings['user_avatar']) && $aimogen_Chatbot_Settings['user_avatar'] != '' && $user_avatar == '')
{
$user_avatar = $aimogen_Chatbot_Settings['user_avatar'];
}
if (isset($aimogen_Chatbot_Settings['compliance']) && $aimogen_Chatbot_Settings['compliance'] != '' && $compliance == '')
{
$compliance = $aimogen_Chatbot_Settings['compliance'];
}
if (isset($aimogen_Chatbot_Settings['bubble_width']) && $aimogen_Chatbot_Settings['bubble_width'] != '' && $bubble_width == '')
{
$bubble_width = $aimogen_Chatbot_Settings['bubble_width'];
}
elseif ($bubble_width == '')
{
$bubble_width = 'full';
}
if (isset($aimogen_Chatbot_Settings['bubble_alignment']) && $aimogen_Chatbot_Settings['bubble_alignment'] != '' && $bubble_alignment == '')
{
$bubble_alignment = $aimogen_Chatbot_Settings['bubble_alignment'];
}
elseif ($bubble_alignment == '')
{
$bubble_alignment = 'left';
}
if (isset($aimogen_Chatbot_Settings['bubble_user_alignment']) && $aimogen_Chatbot_Settings['bubble_user_alignment'] != '' && $bubble_user_alignment == '')
{
$bubble_user_alignment = $aimogen_Chatbot_Settings['bubble_user_alignment'];
}
elseif ($bubble_user_alignment == '')
{
$bubble_user_alignment = 'right';
}
if (isset($aimogen_Chatbot_Settings['show_ai_avatar']) && $aimogen_Chatbot_Settings['show_ai_avatar'] != '' && $show_ai_avatar == '')
{
$show_ai_avatar = $aimogen_Chatbot_Settings['show_ai_avatar'];
}
if (isset($aimogen_Chatbot_Settings['show_user_avatar']) && $aimogen_Chatbot_Settings['show_user_avatar'] != '' && $show_user_avatar == '')
{
$show_user_avatar = $aimogen_Chatbot_Settings['show_user_avatar'];
}
if(empty($select_prompt))
{
$select_prompt = esc_html__("Please select a prompt", 'aimogen');
}
if($ai_message_preppend == '' && $ai_name != '')
{
$ai_message_preppend = $ai_name;
}
if(!empty($assistant_id) && is_numeric($assistant_id))
{
$my_post = array();
$my_post['post__in'] = array($assistant_id);
$my_post['post_type'] = 'aimogen_assistants';
$assistant = get_posts($my_post);
if($assistant !== null && !empty($assistant))
{
$assistant = $assistant[0];
$ai_message_preppend = $assistant->post_title;
$chat_preppend_text = $assistant->post_content;
$message = get_post_meta($assistant->ID, '_assistant_first_message', true);
$ai_first_message = $message;
$ai_role = $assistant->post_excerpt;
$ai_avatar = get_post_thumbnail_id($assistant->ID);
}
}
else
{
if(!empty($ai_persona) && is_numeric($ai_persona))
{
$my_post = array();
$my_post['post__in'] = array($ai_persona);
$my_post['post_type'] = 'aimogen_personas';
$persona = get_posts($my_post);
if($persona !== null && !empty($persona))
{
$persona = $persona[0];
$ai_message_preppend = $persona->post_title;
$chat_preppend_text = $persona->post_content;
$message = get_post_meta($persona->ID, '_persona_first_message', true);
$newmodel = get_post_meta($persona->ID, '_persona_model', true);
if(!empty($newmodel))
{
$model = $newmodel;
}
$ai_first_message = $message;
$ai_role = $persona->post_excerpt;
$ai_avatar = get_post_thumbnail_id($persona->ID);
}
}
}
$avatar_src = '';
$avatar_url = '';
if(is_numeric($ai_avatar))
{
$att_src = wp_get_attachment_image_src( $ai_avatar, 'thumbnail', false );
if ( $att_src )
{
$avatar_src = '
';
$avatar_url = $att_src[0];
}
}
if(empty($ai_avatar) && $show_ai_avatar == 'show')
{
$avatar_url = plugins_url('images/placeholder.jpg', __FILE__);
}
$avatar_url_user = '';
if (isset($aimogen_Chatbot_Settings['user_account_avatar']) && $aimogen_Chatbot_Settings['user_account_avatar'] == 'on' && is_user_logged_in())
{
$current_user_id = get_current_user_id();
$user_avatar_image = get_avatar_url($current_user_id);
if ($user_avatar_image !== false)
{
$avatar_url_user = $user_avatar_image;
}
else
{
if(is_numeric($user_avatar))
{
$att_src_user = wp_get_attachment_image_src( $user_avatar, 'thumbnail', false );
if ( $att_src_user )
{
$avatar_url_user = $att_src_user[0];
}
}
}
}
else
{
if(is_numeric($user_avatar))
{
$att_src_user = wp_get_attachment_image_src( $user_avatar, 'thumbnail', false );
if ( $att_src_user )
{
$avatar_url_user = $att_src_user[0];
}
}
}
if(aimogen_endsWith(trim($user_message_preppend), ':'))
{
$user_message_preppend = trim(trim($user_message_preppend), ':');
}
if(aimogen_endsWith(trim($ai_message_preppend), ':'))
{
$ai_message_preppend = trim(trim($ai_message_preppend), ':');
}
if(!empty($user_message_preppend))
{
$user_message_preppend .= ': ';
}
if(!empty($ai_message_preppend))
{
$ai_message_preppend .= ': ';
}
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
if ($disable_filters != '1' && isset($aimogen_Chatbot_Settings['min_time']) && $aimogen_Chatbot_Settings['min_time'] != '' && isset($aimogen_Chatbot_Settings['max_time']) && $aimogen_Chatbot_Settings['max_time'] != '')
{
$always_show = false;
if (isset($aimogen_Chatbot_Settings['always_show']) && is_array($aimogen_Chatbot_Settings['always_show']))
{
$this_day = gmdate('l');
if(in_array($this_day, $aimogen_Chatbot_Settings['always_show']))
{
$always_show = true;
}
}
if($always_show === false)
{
$exit = true;
$mytime = gmdate("H:i");
$min_time = $aimogen_Chatbot_Settings['min_time'];
$max_time = $aimogen_Chatbot_Settings['max_time'];
$date1 = DateTime::createFromFormat('H:i', $mytime);
$date2 = DateTime::createFromFormat('H:i', $min_time);
$date3 = DateTime::createFromFormat('H:i', $max_time);
if ($date1 > $date2 && $date1 < $date3)
{
$exit = false;
}
if($exit == true)
{
return '';
}
}
}
if (isset($aimogen_Chatbot_Settings['window_width']) && $aimogen_Chatbot_Settings['window_width'] != '')
{
$window_width = $aimogen_Chatbot_Settings['window_width'];
}
else
{
$window_width = '460px';
}
}
else
{
$window_width = '';
}
if(empty($window_location))
{
$window_location = 'bottom-right';
}
if($window_location != 'bottom-right' && $window_location != 'bottom-left' && $window_location != 'top-right' && $window_location != 'top-left')
{
$window_location = 'bottom-right';
}
if(empty($submit))
{
$submit = 'Submit';
}
if(empty($model))
{
$model = aimogen_get_default_model_name($aimogen_Main_Settings);
}
if(empty($instant_response))
{
$instant_response = 'false';
}
if($instant_response == 'true')
{
$instant_response = 'on';
}
if($instant_response == 'false')
{
$instant_response = 'off';
}
if(empty($frequency))
{
$frequency = '0';
}
if(empty($store_data))
{
$store_data = '';
}
if(empty($presence))
{
$presence = '0';
}
if(empty($top_p))
{
$top_p = '1';
}
if(empty($temp))
{
$temp = '0.8';
}
if (isset($aimogen_Chatbot_Settings['page_load_chat']) && $aimogen_Chatbot_Settings['page_load_chat'] == 'on' )
{
$autoload = '1';
}
else
{
$autoload = '0';
}
if (isset($aimogen_Chatbot_Settings['page_load_chat_delay']) && $aimogen_Chatbot_Settings['page_load_chat_delay'] != '' )
{
$autoload_delay = intval($aimogen_Chatbot_Settings['page_load_chat_delay']);
}
else
{
$autoload_delay = '';
}
if (isset($aimogen_Chatbot_Settings['page_load_chat_urls']) && $aimogen_Chatbot_Settings['page_load_chat_urls'] != '' )
{
$page_load_chat_urls = $aimogen_Chatbot_Settings['page_load_chat_urls'];
}
else
{
$page_load_chat_urls = '';
}
if (isset($aimogen_Chatbot_Settings['page_exit_chat_urls']) && $aimogen_Chatbot_Settings['page_exit_chat_urls'] != '' )
{
$page_exit_chat_urls = $aimogen_Chatbot_Settings['page_exit_chat_urls'];
}
else
{
$page_exit_chat_urls = '';
}
if (isset($aimogen_Chatbot_Settings['page_exit_chat_message']) && $aimogen_Chatbot_Settings['page_exit_chat_message'] != '' )
{
$page_exit_chat_message = $aimogen_Chatbot_Settings['page_exit_chat_message'];
}
else
{
$page_exit_chat_message = '';
}
if (isset($aimogen_Chatbot_Settings['page_scroll_chat_urls']) && $aimogen_Chatbot_Settings['page_scroll_chat_urls'] != '' )
{
$page_scroll_chat_urls = $aimogen_Chatbot_Settings['page_scroll_chat_urls'];
}
else
{
$page_scroll_chat_urls = '';
}
if (isset($aimogen_Chatbot_Settings['page_scroll_chat_message']) && $aimogen_Chatbot_Settings['page_scroll_chat_message'] != '' )
{
$page_scroll_chat_message = $aimogen_Chatbot_Settings['page_scroll_chat_message'];
}
else
{
$page_scroll_chat_message = '';
}
if (isset($aimogen_Chatbot_Settings['page_inactive_chat_urls']) && $aimogen_Chatbot_Settings['page_inactive_chat_urls'] != '' )
{
$page_inactive_chat_urls = $aimogen_Chatbot_Settings['page_inactive_chat_urls'];
}
else
{
$page_inactive_chat_urls = '';
}
if (isset($aimogen_Chatbot_Settings['page_inactive_chat_message']) && $aimogen_Chatbot_Settings['page_inactive_chat_message'] != '' )
{
$page_inactive_chat_message = $aimogen_Chatbot_Settings['page_inactive_chat_message'];
}
else
{
$page_inactive_chat_message = '';
}
if (isset($aimogen_Chatbot_Settings['page_load_chat_message']) && $aimogen_Chatbot_Settings['page_load_chat_message'] != '' )
{
$page_load_chat_message = $aimogen_Chatbot_Settings['page_load_chat_message'];
}
else
{
$page_load_chat_message = '';
}
if (isset($aimogen_Chatbot_Settings['page_scroll_chat_percent']) && $aimogen_Chatbot_Settings['page_scroll_chat_percent'] != '' )
{
$page_scroll_chat_percent = intval($aimogen_Chatbot_Settings['page_scroll_chat_percent']);
}
else
{
$page_scroll_chat_percent = 50;
}
if (isset($aimogen_Chatbot_Settings['page_inactive_chat_time']) && $aimogen_Chatbot_Settings['page_inactive_chat_time'] != '' )
{
$page_inactive_chat_time = intval($aimogen_Chatbot_Settings['page_inactive_chat_time']);
}
else
{
$page_inactive_chat_time = 30000;
}
if (isset($aimogen_Chatbot_Settings['page_load_chat_once']) && $aimogen_Chatbot_Settings['page_load_chat_once'] == 'on' )
{
$page_load_chat_once = '1';
}
else
{
$page_load_chat_once = '0';
}
if (isset($aimogen_Chatbot_Settings['page_exit_chat_once']) && $aimogen_Chatbot_Settings['page_exit_chat_once'] == 'on' )
{
$page_exit_chat_once = '1';
}
else
{
$page_exit_chat_once = '0';
}
if (isset($aimogen_Chatbot_Settings['page_scroll_chat_once']) && $aimogen_Chatbot_Settings['page_scroll_chat_once'] == 'on' )
{
$page_scroll_chat_once = '1';
}
else
{
$page_scroll_chat_once = '0';
}
if (isset($aimogen_Chatbot_Settings['page_inactive_chat_once']) && $aimogen_Chatbot_Settings['page_inactive_chat_once'] == 'on' )
{
$page_inactive_chat_once = '1';
}
else
{
$page_inactive_chat_once = '0';
}
if (isset($aimogen_Chatbot_Settings['page_exit_chat']) && $aimogen_Chatbot_Settings['page_exit_chat'] == 'on' )
{
$page_exit_chat = '1';
}
else
{
$page_exit_chat = '0';
}
if (isset($aimogen_Chatbot_Settings['page_scroll_chat']) && $aimogen_Chatbot_Settings['page_scroll_chat'] == 'on' )
{
$page_scroll_chat = '1';
}
else
{
$page_scroll_chat = '0';
}
if (isset($aimogen_Chatbot_Settings['page_inactive_chat']) && $aimogen_Chatbot_Settings['page_inactive_chat'] == 'on' )
{
$page_inactive_chat = '1';
}
else
{
$page_inactive_chat = '0';
}
if (isset($aimogen_Chatbot_Settings['free_voice']) && $aimogen_Chatbot_Settings['free_voice'] != '')
{
$free_voice = $aimogen_Chatbot_Settings['free_voice'];
}
else
{
$free_voice = 'Google US English;en-US';
}
if (isset($aimogen_Chatbot_Settings['chatbot_text_speech']) && $aimogen_Chatbot_Settings['chatbot_text_speech'] != 'off' && $aimogen_Chatbot_Settings['chatbot_text_speech'] != '' )
{
if($chatbot_text_speech == '')
{
$chatbot_text_speech = $aimogen_Chatbot_Settings['chatbot_text_speech'];
}
}
else
{
if($chatbot_text_speech == '')
{
$chatbot_text_speech = 'off';
}
}
if (isset($aimogen_Chatbot_Settings['store_data']) && trim($aimogen_Chatbot_Settings['store_data']) == 'on' && empty($store_data))
{
$store_data = 'on';
}
if($chat_mode == 'images' || $chat_mode == 'image')
{
$user_id = '0';
$chat_history = '';
if(!empty($user_token_cap_per_day) || ($persistent != 'off' && $persistent != '0' && $persistent != ''))
{
$user_id = get_current_user_id();
if($user_id == 0 && ($persistent_guests == 'on' || $persistent_guests == '1'))
{
$user_id = aimogen_get_guest_id();
}
if(($persistent != 'off' && $persistent != 'logs' && $persistent != 'history' && $persistent != 'vector' && $persistent != '0' && $persistent != '') && $user_id != 0)
{
if(is_numeric($user_id))
{
$chat_history = get_user_meta($user_id, 'aimogen_chat_history_' . $persistent, true);
if(empty($chat_history))
{
$chat_history = '';
}
}
else
{
$chat_history = get_transient('aimogen_chat_history_' . $persistent . '_' . $user_id);
if(empty($chat_history))
{
$chat_history = '';
}
}
}
}
$enable_moderation = '0';
if (isset($aimogen_Chatbot_Settings['enable_moderation']) && $aimogen_Chatbot_Settings['enable_moderation'] == 'on')
{
$enable_moderation = '1';
}
if (isset($aimogen_Chatbot_Settings['moderation_model']) && $aimogen_Chatbot_Settings['moderation_model'] == 'on')
{
$moderation_model = $aimogen_Chatbot_Settings['moderation_model'];
}
else
{
$moderation_model = 'omni-moderation-latest';
}
if (isset($aimogen_Chatbot_Settings['flagged_message']) && $aimogen_Chatbot_Settings['flagged_message'] == 'on')
{
$flagged_message = $aimogen_Chatbot_Settings['flagged_message'];
}
else
{
$flagged_message = 'Your message has been flagged as potentially harmful or inappropriate. Please review your language and content to ensure it aligns with our values of respect and sensitivity towards others. Thank you for your cooperation.';
}
if (isset($aimogen_Chatbot_Settings['enable_copy']) && $aimogen_Chatbot_Settings['enable_copy'] == 'on')
{
$enable_copy = $aimogen_Chatbot_Settings['enable_copy'];
}
else
{
$enable_copy = '0';
}
if (isset($aimogen_Chatbot_Settings['scroll_bot']) && $aimogen_Chatbot_Settings['scroll_bot'] == 'on')
{
$scroll_bot = $aimogen_Chatbot_Settings['scroll_bot'];
}
else
{
$scroll_bot = '0';
}
$no_empty = '';
if (isset($aimogen_Chatbot_Settings['no_empty']) && trim($aimogen_Chatbot_Settings['no_empty']) == 'on' && empty($input_text))
{
$no_empty = '1';
}
if(!function_exists('is_plugin_active'))
{
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_ok = true;
if (!is_plugin_active('aiomatic-extension-pdf-files/aiomatic-extension-pdf-files.php'))
{
$all_ok = false;
}
$chat_download_format = 'txt';
$name = md5(get_bloginfo());
wp_enqueue_script($name . 'openai-chat-images-ajax', plugins_url('scripts/openai-chat-images-ajax.js', __FILE__), array('jquery'), AIMOGEN_LITE_MAJOR_VERSION);
wp_localize_script($name . 'openai-chat-images-ajax', 'aimogen_chat_image_ajax_object' . $chatid, array(
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('openai-ajax-images-nonce'),
'persistent' => $persistent,
'persistentnonce' => wp_create_nonce('openai-persistent-nonce'),
'user_token_cap_per_day' => $user_token_cap_per_day,
'user_id' => $user_id,
'moderation_nonce' => wp_create_nonce('openai-moderation-nonce'),
'enable_moderation' => $enable_moderation,
'moderation_model' => $moderation_model,
'flagged_message' => $flagged_message,
'enable_copy' => $enable_copy,
'scroll_bot' => $scroll_bot,
'no_empty' => $no_empty,
'chatid' => $chatid,
'autoload' => $autoload,
'autoload_delay' => $autoload_delay,
'chat_download_format' => $chat_download_format,
'bubble_alignment' => $bubble_alignment,
'bubble_user_alignment' => $bubble_user_alignment,
'avatar_url_user' => $avatar_url_user,
'avatar_url' => $avatar_url,
'show_user_avatar' => $show_user_avatar,
'show_ai_avatar' => $show_ai_avatar
));
wp_enqueue_style($name . 'css-ai-front', plugins_url('styles/form-front.css', __FILE__), false, AIMOGEN_LITE_MAJOR_VERSION);
$css_added = false;
$reg_css_code = '.aimogen_chat_history{';
if($font_size != '')
{
$reg_css_code .= 'font-size:' . $font_size . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['font_size']) && $aimogen_Chatbot_Settings['font_size'] != '')
{
$reg_css_code .= 'font-size:' . $aimogen_Chatbot_Settings['font_size'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($height != '')
{
$reg_css_code .= 'height:' . $height . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['height']) && $aimogen_Chatbot_Settings['height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($minheight != '')
{
$reg_css_code .= 'min-height:' . $minheight . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['minheight']) && $aimogen_Chatbot_Settings['minheight'] != '')
{
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['minheight'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '.openai-ai-form{border-radius: 30px;';
if($general_background != '')
{
$reg_css_code .= 'background-color:' . $general_background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['general_background']) && $aimogen_Chatbot_Settings['general_background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['general_background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen_chat_history_log{';
if($font_size != '')
{
$reg_css_code .= 'font-size:' . $font_size . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['font_size']) && $aimogen_Chatbot_Settings['font_size'] != '')
{
$reg_css_code .= 'font-size:' . $aimogen_Chatbot_Settings['font_size'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($height != '')
{
$reg_css_code .= 'height:' . $height . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['height']) && $aimogen_Chatbot_Settings['height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($background != '')
{
$reg_css_code .= 'background-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($minheight != '')
{
$reg_css_code .= 'min-height:' . $minheight . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['minheight']) && $aimogen_Chatbot_Settings['minheight'] != '')
{
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['minheight'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '.openai-ai-image-form{
border-radius: 30px;
max-width: 800px;
margin: 0 auto;
width: 100% !important;';
if($no_padding != 'on')
{
$reg_css_code .= '
box-sizing: border-box;
padding-right: 20px;
padding-left: 20px;';
}
if($general_background != '')
{
$reg_css_code .= 'background-color:' . $general_background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['general_background']) && $aimogen_Chatbot_Settings['general_background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['general_background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($width != '')
{
$reg_css_code .= 'width:' . $width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['width']) && $aimogen_Chatbot_Settings['width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
if($bubble_width == 'full' || empty($bubble_width))
{
$reg_css_code .= '.ai-bubble{width:100%!important;}';
$css_added = true;
}
elseif($bubble_width == 'auto')
{
$reg_css_code .= '.ai-bubble{width:auto!important;}';
$css_added = true;
}
if($bubble_alignment == 'left' || empty($bubble_alignment))
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'right')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
if($bubble_user_alignment == 'left')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'right' || empty($bubble_user_alignment))
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
$reg_css_code .= '.ai-mine{';
if($user_font_color != '')
{
$reg_css_code .= 'color:' . $user_font_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['user_font_color']) && $aimogen_Chatbot_Settings['user_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['user_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($user_background_color != '')
{
$reg_css_code .= 'background-color:' . $user_background_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['user_background_color']) && $aimogen_Chatbot_Settings['user_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['user_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
if(!empty($avatar_url))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other {
background-image: url("' . esc_url($avatar_url) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
if($additional_bots != '')
{
$bot_list = explode(',', $additional_bots);
$bot_list = array_map('trim', $bot_list);
$bot_list = array_filter($bot_list);
foreach($bot_list as $my_bot)
{
if(is_numeric($my_bot))
{
$bot_post = get_post($my_bot);
if($bot_post != null)
{
if($bot_post->post_type === 'aimogen_personas' || $bot_post->post_type === 'aimogen_assistants')
{
$att_src = get_the_post_thumbnail_url( $bot_post->ID, 'thumbnail' );
if ( empty($att_src) )
{
$att_src = plugins_url('images/placeholder.jpg', __FILE__);
}
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other.aimogen-ainum-' . esc_html($bot_post->ID) . ' {
background-image: url("' . esc_url($att_src) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
}
}
}
}
if(!empty($avatar_url_user))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-mine {
background-image: url("' . esc_url($avatar_url_user) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
$reg_css_code .= '.ai-other{';
if($ai_font_color != '')
{
$reg_css_code .= 'color:' . $ai_font_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['ai_font_color']) && $aimogen_Chatbot_Settings['ai_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['ai_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($ai_background_color != '')
{
$reg_css_code .= 'background-color:' . $ai_background_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['ai_background_color']) && $aimogen_Chatbot_Settings['ai_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['ai_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '#aimogen_chat_input' . $chatid . '{';
if($background != '')
{
$reg_css_code .= 'background-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($input_border_color != '')
{
$reg_css_code .= 'border-color:' . $input_border_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($input_text_color != '')
{
$reg_css_code .= 'color:' . $input_text_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-ai-input{';
if($background != '')
{
$reg_css_code .= 'background-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($input_border_color != '')
{
$reg_css_code .= 'border-color:' . $input_border_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($input_text_color != '')
{
$reg_css_code .= 'color:' . $input_text_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}
#openai-persona-name' . $chatid . '{';
if($persona_name_color != '')
{
$reg_css_code .= 'color:' . $persona_name_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}
#openai-persona-role' . $chatid . '{';
if($persona_role_color != '')
{
$reg_css_code .= 'color:' . $persona_role_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['persona_role_color']) && $aimogen_Chatbot_Settings['persona_role_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_role_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}
#aimogen_chat_input' . $chatid . '::placeholder
{';
if($input_placeholder_color != '')
{
$reg_css_code .= 'color:' . $input_placeholder_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['input_placeholder_color']) && $aimogen_Chatbot_Settings['input_placeholder_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_placeholder_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}
.aimogen-close-button{';
if($submit_color != '')
{
$reg_css_code .= 'color:' . $submit_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$reg_css_code .= '#aiimagechatsubmitbut' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if($submit_color != '')
{
$reg_css_code .= 'background-color:' . $submit_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($submit_text_color != '')
{
$reg_css_code .= 'color:' . $submit_text_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
if($voice_color_activated == '')
{
if (isset($aimogen_Chatbot_Settings['voice_color_activated']) && $aimogen_Chatbot_Settings['voice_color_activated'] != '')
{
$voice_color_activated = $aimogen_Chatbot_Settings['voice_color_activated'];
}
}
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{';
if($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['voice_color']) && $aimogen_Chatbot_Settings['voice_color'] != '')
{
$voice_color = $aimogen_Chatbot_Settings['voice_color'];
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['voice_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-image-speech-button' . $chatid . '{';
if($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['voice_color']) && $aimogen_Chatbot_Settings['voice_color'] != '')
{
$voice_color = $aimogen_Chatbot_Settings['voice_color'];
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['voice_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
if (isset($aimogen_Chatbot_Settings['open_width']) && $aimogen_Chatbot_Settings['open_width'] != '')
{
$reg_css_code .= '.aimogen-open-image{width:' . $aimogen_Chatbot_Settings['open_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$css_added = true;
}
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{margin-left:20px;}
#aiimagechatsubmitbut' . $chatid . '{';
if($submit_color != '')
{
$reg_css_code .= 'background-color:' . $submit_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if($submit_text_color != '')
{
$reg_css_code .= 'color:' . $submit_text_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
$reg_css_code .= '}';
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$reg_css_code .= 'form.aimogen-window{';
$reg_css_code .= 'display:none;';
$reg_css_code .= '}';
$css_added = true;
}
if($window_width != '')
{
preg_match_all('#(\d+)\s*px#i', $window_width, $zamatches);
if(isset($zamatches[1][0]))
{
$myw = intval($zamatches[1][0]) + 100;
$wwidth = $myw . 'px';
}
else
{
$wwidth = $window_width;
}
$reg_css_code .= '@media only screen and (min-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$reg_css_code .= '@media only screen and (max-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$css_added = true;
}
if($no_padding != 'on')
{
$reg_css_code .= '#openai-ai-chat-form-' . $chatid . '
{
box-sizing: border-box;
padding-right: 20px;
padding-left: 20px;
}';
}
$reg_css_code .= '.openai-mr-4
{
margin-right: 1rem ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.openai-chat-avatar
{
border-radius: 50%;';
if (isset($aimogen_Chatbot_Settings['topavatar_width']) && $aimogen_Chatbot_Settings['topavatar_width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['topavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'width: 44px;';
}
if (isset($aimogen_Chatbot_Settings['topavatar_height']) && $aimogen_Chatbot_Settings['topavatar_height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['topavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'height: 44px;';
}
$reg_css_code .= 'clear: both;
display: block;
background: #E1F0FF;
position: relative;
}
.ai-avatar{';
if (isset($aimogen_Chatbot_Settings['convavatar_width']) && $aimogen_Chatbot_Settings['convavatar_width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['convavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'min-width:' . $aimogen_Chatbot_Settings['convavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'width: 40px;';
$reg_css_code .= 'min-width: 40px;';
}
if (isset($aimogen_Chatbot_Settings['convavatar_height']) && $aimogen_Chatbot_Settings['convavatar_height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['convavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['convavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'height: 40px;';
$reg_css_code .= 'min-height: 40px;';
}
$reg_css_code .= '}
.openai-font-weight-bold
{
font-weight: bold ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.openai-card-header{';
if (isset($aimogen_Chatbot_Settings['width']) && $aimogen_Chatbot_Settings['width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '
}
#openai-chat-response' . $chatid . ' {
padding-bottom: 5px;
text-align:center;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.openai-file-document {';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
}
.openai-file-document:hover {
transform: scale(1.1);
';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background-color:#f0f0f0' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
color: #333;
}
.aimogen-vision-image
{
max-width:300px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
max-height:300px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
display:block' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.aimogen-pdf-image {
user-select: none;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-pdf-image {
cursor: pointer;';
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%);
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-file-image {
user-select: none;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-file-image {
cursor: pointer;';
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($all_ok)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%);
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-stop-image {
user-select: none;
position: absolute;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-show-logs {
user-select: none;
position: absolute;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-show-logs {
cursor: pointer;';
$enable_file_uploads = false;
if (isset($aimogen_Chatbot_Settings['enable_file_uploads']) && $aimogen_Chatbot_Settings['enable_file_uploads'] != '' && $file_uploads == '')
{
$file_uploads = $aimogen_Chatbot_Settings['enable_file_uploads'];
}
if(!empty($assistant_id) && ($file_uploads == 'on' || $file_uploads == 'yes' || $file_uploads == '1' || $file_uploads == 'enable' || $file_uploads == 'enabled'))
{
$is_file_search = get_post_meta($assistant_id, '_assistant_tools', true);
if(is_array($is_file_search))
{
foreach($is_file_search as $isfs)
{
if($isfs['type'] == 'file_search')
{
$enable_file_uploads = true;
break;
}
}
}
}
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
else
{
if($all_ok)
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%)!important;
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-stop-image {
cursor: pointer;';
$allow_stream_stop = false;
if (isset($aimogen_Chatbot_Settings['allow_stream_stop']) && $aimogen_Chatbot_Settings['allow_stream_stop'] == 'on' && $persistent === 'history' && $assistant_id == '')
{
$allow_stream_stop = true;
}
$enable_file_uploads = false;
if (isset($aimogen_Chatbot_Settings['enable_file_uploads']) && $aimogen_Chatbot_Settings['enable_file_uploads'] != '' && $file_uploads == '')
{
$file_uploads = $aimogen_Chatbot_Settings['enable_file_uploads'];
}
if(!empty($assistant_id) && ($file_uploads == 'on' || $file_uploads == 'yes' || $file_uploads == '1' || $file_uploads == 'enable' || $file_uploads == 'enabled'))
{
$is_file_search = get_post_meta($assistant_id, '_assistant_tools', true);
if(is_array($is_file_search))
{
foreach($is_file_search as $isfs)
{
if($isfs['type'] == 'file_search')
{
$enable_file_uploads = true;
break;
}
}
}
}
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 122px;';
}
else
{
$reg_css_code .= 'right: 94px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
}
else
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
}
else
{
if($all_ok)
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
else
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%)!important;
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-gg-image {
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-invite-popup {
position: fixed;
background: #fff;
color: #333;
border-radius: 10px;
padding: 14px 18px;
box-shadow: 0 6px 20px rgba(0,0,0,0.15);
font-size: 15px;
max-width: 260px;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 9999;
animation: aimogen-popup-fade 0.5s ease-out;
}
/* Position handling */
.aimogen-invite-popup.aimogen-bottom-right {
bottom: 100px;
right: 20px;
}
.aimogen-invite-popup.aimogen-bottom-left {
bottom: 100px;
left: 20px;
}
.aimogen-invite-popup.aimogen-top-right {
top: 100px;
right: 20px;
}
.aimogen-invite-popup.aimogen-top-left {
top: 100px;
left: 20px;
}
.aimogen-invite-content {
flex: 1;
padding-right: 10px;
}
.aimogen-invite-close {
cursor: pointer;
font-size: 18px;
color: #888;
transition: color 0.2s ease;
}
.aimogen-invite-close:hover {
color: #000;
}
/* Subtle fade animation */
@keyframes aimogen-popup-fade {
from {opacity: 0; transform: translateY(20px);}
to {opacity: 1; transform: translateY(0);}
}
/* Small directional arrow ???tail??? depending on location */
.aimogen-invite-popup::after {
content: "";
position: absolute;
width: 0;
height: 0;
border: 8px solid transparent;
}
.aimogen-invite-popup.aimogen-bottom-right::after {
border-top-color: #fff;
bottom: -16px;
right: 25px;
}
.aimogen-invite-popup.aimogen-bottom-left::after {
border-top-color: #fff;
bottom: -16px;
left: 25px;
}
.aimogen-invite-popup.aimogen-top-right::after {
border-bottom-color: #fff;
top: -16px;
right: 25px;
}
.aimogen-invite-popup.aimogen-top-left::after {
border-bottom-color: #fff;
top: -16px;
left: 25px;
}
.openai-relative
{
position: relative;
}
.openai-widget-user-name
{
line-height: 1.8;
}
.cr_none
{
display:none;
}
.cr_visible
{
display: block !important;
}
.cr_abs{position: absolute;}
.aimogen-gg-image::after,
.aimogen-gg-image::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border: 2px solid
}
.aimogen-gg-mute:hover {
i:before {
transform: scale(.8) translate(-3px, 0) rotate(42deg);
}
}
.aimogen-hide {display:none!important;visibility:hidden}
.image_max_w_ai{width:100%;max-width:100%;}
.aimogen-pdf-remove, .aimogen-file-remove{
font-size: 30px;
justify-content: center;
align-items: center;
width: 18px;
height: 18px;
line-height: unset;
font-family: Arial, serif;
border-radius: 50%;
font-weight: normal;
padding: 0;
margin: 0;
}
.aimogen-loading-indicator {
position: absolute;
top: 5px;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
.aimogen-gg-trash::after,
.aimogen-gg-trash::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute
}
.aimogen-gg-trash::after {
background: currentColor;
border-radius: 3px;
width: 17px;
height: 2px;
top: -4px;
left: -5px
}
.aimogen-gg-trash::before {
width: 10px;
height: 4px;
border: 2px solid;
border-bottom: transparent;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
top: -7px;
left: -1px
}
.aimogen-gg-trash {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 10px;
height: 12px;
border: 2px solid transparent;
box-shadow:
0 0 0 1px,
inset -2px 0 0,
inset 2px 0 0;
border-bottom-left-radius: 1px;
border-bottom-right-radius: 1px;
margin-top: 4px;
}
.aimogen-gg-mute {
margin-left:10px;
cursor: pointer;
top: -1px;
right: -3px;
height: 20px;
width: 20px;
position: relative;
overflow: hidden;
display: inline-block;
}
.aimogen-gg-image::after {
transform: rotate(45deg);
border-radius: 3px;
width: 16px;
height: 16px;
top: 9px;
left: 6px
}
.aimogen-gg-image::before {
width: 6px;
height: 6px;
border-radius: 100%;
top: 2px;
left: 2px
}
.aimogen-cursor
{
cursor: pointer;
}
.aimogen-left-padding
{
padding-left: 10px;
}
.aimogen-gg-globe {
top:-1px;
position: relative;
transform: scale(var(--ggs,1));
width: 18px;
border-radius: 22px;
}
.aimogen-gg-globe::after,
.aimogen-gg-globe::before {
content: "";
position: absolute;
width: 8px;
border-radius: 100%;
top: -2px;
left: 3px;
}
.aimogen-gg-unmute {
cursor: pointer;
margin-left:10px;
top: -1px;
right: -3px;
height: 20px;
width: 20px;
position: relative;
overflow: hidden;
display: inline-block;
}
.aimogen-gg-image {
box-sizing: border-box;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 20px;
height: 16px;
overflow: hidden;
box-shadow: 0 0 0 2px;
border-radius: 2px;
cursor: pointer;
right: 10px;
top: 50%;
transform: translateY(-50%);
padding: 10px;
cursor: pointer;
}
.openai-file-document::after,
.openai-file-document::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
}
.openai-file-document::before {
background: currentColor;
box-shadow: 0 4px 0, -6px -4px 0;
left: 0;
width: 10px;
height: 2px;
top: 8px;
}
.openai-file-document::after {
width: 6px;
height: 6px;
border-left: 2px solid;
border-bottom: 2px solid;
right: -1px;
top: -1px;
}
.openai-file-document
{
cursor: pointer;
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 14px;
height: 16px;
border: 2px solid transparent;
border-right: 0;
border-top: 0;
box-shadow: 0 0 0 1.3px;
border-radius: 1px;
border-top-right-radius: 4px;
overflow: hidden;
transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.openai-card-header
{
margin: 0 auto;
position: absolute;
left: 0px;
padding: 3px;
border-radius: 0 50px 50px 0;
height: auto;
background: transparent;
padding-top: 10px;
display: flex;
min-height: 3.5rem;
align-items: center;
margin-bottom: 0;
position: relative;
}
.ai-export-txt
{
cursor: pointer;
padding-left:10px;
}
.ai-clear-chat
{
cursor: pointer;
padding-left:10px;
}
.openai-text-right
{
display: flex;
text-align: right;
margin-left: auto;
margin-right: 10px
}
.openai-d-flex
{
display: flex;
}';
$reg_css_code .= '.aimogen-gg-unmute {
i {
display: block;
width: 5.33px;
height: 5.33px;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
margin: 7px 0 0 1.33px;
}
i:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-style: solid;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color: transparent' . $aimogen_Chatbot_Settings['submit_color'] . ' transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:transparent #55a7e2 transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 6.67px 9.33px 6.67px 10px;
left: -8.67px;
top: 3.33px;
}
}
.aimogen-gg-globe,
.aimogen-gg-globe::after,
.aimogen-gg-globe::before {
display: block;
box-sizing: border-box;
height: 18px;
border: 2px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
}
.aimogen-gg-globe::after {
width: 24px;
height: 20px;
border: 2px solid transparent;
border-bottom: 2px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
top: -11px;
left: -5px;
}
.aimogen-gg-globe:hover {
transform: scale(1.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
.ai-compare-button.active {
background-color: ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= ';
border: 1px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= ';
}
.aimogen-globe-bar {
position: absolute;
width: 22px;
height: 2px;
background: ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
}
.aimogen-gg-mute {
i {
display: block;
width: 5.33px;
height: 5.33px;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
margin: 7px 0 0 1.33px;
}
i:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-style: solid;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color: transparent' . $aimogen_Chatbot_Settings['submit_color'] . ' transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:transparent #55a7e2 transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 6.67px 9.33px 6.67px 10px;
left: -8.67px;
top: 3.33px;
}
i:before {
transform: rotate(45deg);
border-radius: 0 33.33px 0 0;
content: "";
position: absolute;
width: 3.33px;
height: 3.33px;
border-style: double;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 4.67px 4.67px 0 0;
left: 12px;
top: 6px;
transition: all 0.2s ease-out;
}
}
.aimogen-gg-trash {';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
}
.aimogen-gg-trash:hover {
transform: scale(1.1);
';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background-color:#f0f0f0' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$loader_color = '#fff';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$loader_color = $aimogen_Chatbot_Settings['persona_name_color'];
}
$reg_css_code .= '
}
.aimogen-loading-indicator::before {
content: \'\';
box-sizing: border-box;
width: 50px;
height: 50px;
border-radius: 50%;
border-top: 3px solid ' . $loader_color. ';
border-right: 3px solid transparent;
animation: keysspin 1s linear infinite;
}
@keyframes keysspin {
to {
transform: rotate(360deg);
}
}
#aimogen-video-wrapper' . $chatid . '
{
position: relative;
padding-top: 10px;
}
.aimogen-hide {display:none!important;}';
$reg_css_code .= '.openai-ai-form{
border-radius: 30px;';
if($general_background != '')
{
$reg_css_code .= 'background-color:' . $general_background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['general_background']) && $aimogen_Chatbot_Settings['general_background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['general_background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if (isset($aimogen_Chatbot_Settings['width']) && $aimogen_Chatbot_Settings['width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if($bubble_width == 'full' || empty($bubble_width))
{
$reg_css_code .= '.ai-bubble{width:100%!important;}';
$css_added = true;
}
elseif($bubble_width == 'auto')
{
$reg_css_code .= '.ai-bubble{width:auto!important;}';
$css_added = true;
}
if($bubble_alignment == 'left' || empty($bubble_alignment))
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'right')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
if($bubble_user_alignment == 'left')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'right' || empty($bubble_user_alignment))
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
$reg_css_code .= '.ai-mine{';
if (isset($aimogen_Chatbot_Settings['user_font_color']) && $aimogen_Chatbot_Settings['user_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['user_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['user_background_color']) && $aimogen_Chatbot_Settings['user_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['user_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if(!empty($avatar_url))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other {
background-image: url("' . esc_url($avatar_url) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
if($additional_bots != '')
{
$bot_list = explode(',', $additional_bots);
$bot_list = array_map('trim', $bot_list);
$bot_list = array_filter($bot_list);
foreach($bot_list as $my_bot)
{
if(is_numeric($my_bot))
{
$bot_post = get_post($my_bot);
if($bot_post != null)
{
if($bot_post->post_type === 'aimogen_personas' || $bot_post->post_type === 'aimogen_assistants')
{
$att_src = get_the_post_thumbnail_url( $bot_post->ID, 'thumbnail' );
if ( empty($att_src) )
{
$att_src = plugins_url('images/placeholder.jpg', __FILE__);
}
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other.aimogen-ainum-' . esc_html($bot_post->ID) . ' {
background-image: url("' . esc_url($att_src) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
}
}
}
}
if(!empty($avatar_url_user))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-mine {
background-image: url("' . esc_url($avatar_url_user) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
$reg_css_code .= '.ai-other{';
if (isset($aimogen_Chatbot_Settings['ai_font_color']) && $aimogen_Chatbot_Settings['ai_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['ai_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['ai_background_color']) && $aimogen_Chatbot_Settings['ai_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['ai_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$go_color = $aimogen_Chatbot_Settings['input_text_color'];
}
else
{
$go_color = '#ffffff';
}
$reg_css_code .= '}
.aimogen-pdf-loading, .aimogen-file-loading{
border: 2px solid ' . $go_color . ';
border-bottom-color: transparent;
border-radius: 50%;
box-sizing: border-box;
animation: aimogen_rotation 1s linear infinite;
display: inline-block;
width: 18px;
height: 18px;
}
@keyframes aimogen_rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}';
$reg_css_code .= '#aimogen_chat_input' . $chatid . '{min-height:62px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-name' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-role' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_role_color']) && $aimogen_Chatbot_Settings['persona_role_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_role_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-ai-text{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-ai-input{min-height:62px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-name' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-role' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_role_color']) && $aimogen_Chatbot_Settings['persona_role_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_role_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#aimogen_chat_input' . $chatid . '::placeholder{';
if (isset($aimogen_Chatbot_Settings['input_placeholder_color']) && $aimogen_Chatbot_Settings['input_placeholder_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_placeholder_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-close-button{';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{';
if ($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-image-speech-button' . $chatid . '{';
if ($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if (isset($aimogen_Chatbot_Settings['open_width']) && $aimogen_Chatbot_Settings['open_width'] != '')
{
$reg_css_code .= '.aimogen-open-image{width:' . $aimogen_Chatbot_Settings['open_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$css_added = true;
}
$reg_css_code .= '#aiimagechatsubmitbut' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{margin-left:20px;}
#aiimagechatsubmitbut' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$reg_css_code .= 'form.aimogen-window{';
$reg_css_code .= 'display:none;';
$reg_css_code .= '}';
$css_added = true;
}
if($window_width != '')
{
preg_match_all('#(\d+)\s*px#i', $window_width, $zamatches);
if(isset($zamatches[1][0]))
{
$myw = intval($zamatches[1][0]) + 100;
$wwidth = $myw . 'px';
}
else
{
$wwidth = $window_width;
}
$reg_css_code .= '@media only screen and (min-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$reg_css_code .= '@media only screen and (max-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$css_added = true;
}
if($css_added === true)
{
wp_add_inline_style( $name . 'css-ai-front', wp_kses_post($reg_css_code) );
}
// Display the form
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$show_me = '
';
if (isset($aimogen_Chatbot_Settings['chatbot_icon']) && $aimogen_Chatbot_Settings['chatbot_icon'] != '')
{
if($aimogen_Chatbot_Settings['chatbot_icon'] != 'x')
{
$show_me = '
';
}
elseif (isset($aimogen_Chatbot_Settings['chatbot_icon_html']) && $aimogen_Chatbot_Settings['chatbot_icon_html'] != '')
{
$show_me = $aimogen_Chatbot_Settings['chatbot_icon_html'];
if(aimogen_starts_with($show_me, 'http') === true)
{
$show_me = '
';
}
}
}
$invite_html = '';
if (!empty($aimogen_Chatbot_Settings['chatbot_invite_message'])) {
$invite_msg = esc_html($aimogen_Chatbot_Settings['chatbot_invite_message']);
$invite_html = '
';
}
$return_me .= $invite_html . '
' . $show_me . ' ';
}
$return_me .= '
';
}
else
{
$persistent_assistant = false;
$user_id = '0';
$chat_history = '';
if(!empty($user_token_cap_per_day) || ($persistent != 'off' && $persistent != '0' && $persistent != ''))
{
$user_id = get_current_user_id();
if($user_id == 0 && ($persistent_guests == 'on' || $persistent_guests == '1'))
{
$user_id = aimogen_get_guest_id();
}
if(($persistent != 'off' && $persistent != 'logs' && $persistent != 'vector' && $persistent != 'history' && $persistent != '0' && $persistent != '') && $user_id != 0)
{
if(is_numeric($user_id))
{
if($assistant_id != '')
{
$chat_history = get_user_meta($user_id, 'aimogen_assistant_history_thread', true);
if(empty($chat_history))
{
$chat_history = '';
}
else
{
$persistent_assistant = true;
}
}
else
{
$chat_history = get_user_meta($user_id, 'aimogen_chat_history_' . $persistent, true);
if(empty($chat_history))
{
$chat_history = '';
}
}
}
else
{
if($assistant_id != '')
{
$chat_history = get_transient('aimogen_assistant_history_thread_' . $user_id);
if(empty($chat_history))
{
$chat_history = '';
}
else
{
$persistent_assistant = true;
}
}
else
{
$chat_history = get_transient('aimogen_chat_history_' . $persistent . '_' . $user_id);
if(empty($chat_history))
{
$chat_history = '';
}
}
}
}
}
$name = md5(get_bloginfo());
wp_enqueue_script($name . 'openai-chat-ajax', plugins_url('scripts/openai-chat-ajax.js', __FILE__), array('jquery'), AIMOGEN_LITE_MAJOR_VERSION);
$chat_preppend_text = do_shortcode($chat_preppend_text);
if(stristr($chat_preppend_text, '%%') !== false)
{
$post_link = '';
$post_title = '';
$blog_title = html_entity_decode(get_bloginfo('title'));
$post_excerpt = '';
$final_content = '';
$user_name = '';
$featured_image = '';
$post_cats = '';
$post_tagz = '';
$postID = '';
global $post;
if(isset($post->ID))
{
$post_link = get_permalink($post->ID);
$blog_title = html_entity_decode(get_bloginfo('title'));
$author_obj = get_user_by('id', $post->post_author);
if($author_obj !== false)
{
$user_name = $author_obj->user_nicename;
}
$final_content = $post->post_content;
$post_title = $post->post_title;
$featured_image = '';
wp_suspend_cache_addition(true);
$metas = get_post_custom($post->ID);
wp_suspend_cache_addition(false);
if(is_array($metas))
{
$rez_meta = aimogen_preg_grep_keys('#.+?_featured_ima?ge?#i', $metas);
}
else
{
$rez_meta = array();
}
if(count($rez_meta) > 0)
{
foreach($rez_meta as $rm)
{
if(isset($rm[0]) && filter_var($rm[0], FILTER_VALIDATE_URL))
{
$featured_image = $rm[0];
break;
}
}
}
if($featured_image == '')
{
$featured_image = aimogen_generate_thumbmail($post->ID);
}
if($featured_image == '' && $final_content != '')
{
$dom = new DOMDocument();
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($final_content);
libxml_use_internal_errors($internalErrors);
$tags = $dom->getElementsByTagName('img');
foreach ($tags as $tag) {
$temp_get_img = $tag->getAttribute('src');
if ($temp_get_img != '') {
$temp_get_img = strtok($temp_get_img, '?');
$featured_image = rtrim($temp_get_img, '/');
}
}
}
$post_cats = '';
$post_categories = wp_get_post_categories( $post->ID );
foreach($post_categories as $c){
$cat = get_category( $c );
$post_cats .= $cat->name . ',';
}
$post_cats = trim($post_cats, ',');
if($post_cats != '')
{
$post_categories = explode(',', $post_cats);
}
else
{
$post_categories = array();
}
if(count($post_categories) == 0)
{
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_categories[] = $term->slug;
}
$post_cats = implode(',', $post_categories);
}
}
$post_tagz = '';
$post_tags = wp_get_post_tags( $post->ID );
foreach($post_tags as $t){
$post_tagz .= $t->name . ',';
}
$post_tagz = trim($post_tagz, ',');
if($post_tagz != '')
{
$post_tags = explode(',', $post_tagz);
}
else
{
$post_tags = array();
}
if(count($post_tags) == 0)
{
$terms = get_the_terms( $post->ID, 'product_tag' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_tags[] = $term->slug;
}
$post_tagz = implode(',', $post_tags);
}
}
$post_excerpt = $post->post_excerpt;
$postID = $post->ID;
}
$chat_preppend_text = aimogen_replaceAIPostShortcodes($chat_preppend_text, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
if (filter_var($chat_preppend_text, FILTER_VALIDATE_URL) !== false && aimogen_endsWith($chat_preppend_text, '.txt'))
{
$txt_content = aimogen_get_web_page($chat_preppend_text);
if ($txt_content !== FALSE)
{
$txt_content = preg_split('/\r\n|\r|\n/', $txt_content);
$txt_content = array_filter($txt_content);
if(count($txt_content) > 0)
{
$txt_content = $txt_content[array_rand($txt_content)];
if(trim($txt_content) != '')
{
$chat_preppend_text = $txt_content;
$chat_preppend_text = aimogen_replaceAIPostShortcodes($chat_preppend_text, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
$chat_preppend_text = do_shortcode($chat_preppend_text);
}
}
}
}
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$chat_preppend_text = str_replace('%%user_name%%', '', $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_email%%', '' , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_display_name%%', '', $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_role%%', '', $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_id%%', '' , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_firstname%%', '' , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_lastname%%', '' , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_description%%', '' , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_url%%', '' , $chat_preppend_text);
}
else
{
$chat_preppend_text = str_replace('%%user_name%%', $current_user->user_login, $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_email%%', $current_user->user_email , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_display_name%%', $current_user->display_name , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_role%%', implode(',', $current_user->roles), $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_id%%', $current_user->ID , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_firstname%%', $current_user->user_firstname , $chat_preppend_text);
$chat_preppend_text = str_replace('%%user_lastname%%', $current_user->user_lastname , $chat_preppend_text);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$chat_preppend_text = str_replace('%%user_description%%', $user_desc , $chat_preppend_text);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$chat_preppend_text = str_replace('%%user_url%%', $user_url , $chat_preppend_text);
}
}
if(stristr($ai_message_preppend, '%%') !== false)
{
$post_link = '';
$post_title = '';
$blog_title = html_entity_decode(get_bloginfo('title'));
$post_excerpt = '';
$final_content = '';
$user_name = '';
$featured_image = '';
$post_cats = '';
$post_tagz = '';
$postID = '';
global $post;
if(isset($post->ID))
{
$post_link = get_permalink($post->ID);
$blog_title = html_entity_decode(get_bloginfo('title'));
$author_obj = get_user_by('id', $post->post_author);
if($author_obj !== false)
{
$user_name = $author_obj->user_nicename;
}
$final_content = $post->post_content;
$post_title = $post->post_title;
$featured_image = '';
wp_suspend_cache_addition(true);
$metas = get_post_custom($post->ID);
wp_suspend_cache_addition(false);
if(is_array($metas))
{
$rez_meta = aimogen_preg_grep_keys('#.+?_featured_ima?ge?#i', $metas);
}
else
{
$rez_meta = array();
}
if(count($rez_meta) > 0)
{
foreach($rez_meta as $rm)
{
if(isset($rm[0]) && filter_var($rm[0], FILTER_VALIDATE_URL))
{
$featured_image = $rm[0];
break;
}
}
}
if($featured_image == '')
{
$featured_image = aimogen_generate_thumbmail($post->ID);
}
if($featured_image == '' && $final_content != '')
{
$dom = new DOMDocument();
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($final_content);
libxml_use_internal_errors($internalErrors);
$tags = $dom->getElementsByTagName('img');
foreach ($tags as $tag) {
$temp_get_img = $tag->getAttribute('src');
if ($temp_get_img != '') {
$temp_get_img = strtok($temp_get_img, '?');
$featured_image = rtrim($temp_get_img, '/');
}
}
}
$post_cats = '';
$post_categories = wp_get_post_categories( $post->ID );
foreach($post_categories as $c){
$cat = get_category( $c );
$post_cats .= $cat->name . ',';
}
$post_cats = trim($post_cats, ',');
if($post_cats != '')
{
$post_categories = explode(',', $post_cats);
}
else
{
$post_categories = array();
}
if(count($post_categories) == 0)
{
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_categories[] = $term->slug;
}
$post_cats = implode(',', $post_categories);
}
}
$post_tagz = '';
$post_tags = wp_get_post_tags( $post->ID );
foreach($post_tags as $t){
$post_tagz .= $t->name . ',';
}
$post_tagz = trim($post_tagz, ',');
if($post_tagz != '')
{
$post_tags = explode(',', $post_tagz);
}
else
{
$post_tags = array();
}
if(count($post_tags) == 0)
{
$terms = get_the_terms( $post->ID, 'product_tag' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_tags[] = $term->slug;
}
$post_tagz = implode(',', $post_tags);
}
}
$post_excerpt = $post->post_excerpt;
$postID = $post->ID;
}
$ai_message_preppend = aimogen_replaceAIPostShortcodes($ai_message_preppend, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
if (filter_var($ai_message_preppend, FILTER_VALIDATE_URL) !== false && aimogen_endsWith($ai_message_preppend, '.txt'))
{
$txt_content = aimogen_get_web_page($ai_message_preppend);
if ($txt_content !== FALSE)
{
$txt_content = preg_split('/\r\n|\r|\n/', $txt_content);
$txt_content = array_filter($txt_content);
if(count($txt_content) > 0)
{
$txt_content = $txt_content[array_rand($txt_content)];
if(trim($txt_content) != '')
{
$ai_message_preppend = $txt_content;
$ai_message_preppend = aimogen_replaceAIPostShortcodes($ai_message_preppend, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
}
}
}
}
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$ai_message_preppend = str_replace('%%user_name%%', '', $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_email%%', '' , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_display_name%%', '', $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_role%%', '', $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_id%%', '' , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_firstname%%', '' , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_lastname%%', '' , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_description%%', '' , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_url%%', '' , $ai_message_preppend);
}
else
{
$ai_message_preppend = str_replace('%%user_name%%', $current_user->user_login, $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_email%%', $current_user->user_email , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_display_name%%', $current_user->display_name , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_role%%', implode(',', $current_user->roles), $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_id%%', $current_user->ID , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_firstname%%', $current_user->user_firstname , $ai_message_preppend);
$ai_message_preppend = str_replace('%%user_lastname%%', $current_user->user_lastname , $ai_message_preppend);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$ai_message_preppend = str_replace('%%user_description%%', $user_desc , $ai_message_preppend);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$ai_message_preppend = str_replace('%%user_url%%', $user_url , $ai_message_preppend);
}
}
if(stristr($user_message_preppend, '%%') !== false)
{
$post_link = '';
$post_title = '';
$blog_title = html_entity_decode(get_bloginfo('title'));
$post_excerpt = '';
$final_content = '';
$user_name = '';
$featured_image = '';
$post_cats = '';
$post_tagz = '';
$postID = '';
global $post;
if(isset($post->ID))
{
$post_link = get_permalink($post->ID);
$blog_title = html_entity_decode(get_bloginfo('title'));
$author_obj = get_user_by('id', $post->post_author);
if($author_obj !== false)
{
$user_name = $author_obj->user_nicename;
}
$final_content = $post->post_content;
$post_title = $post->post_title;
$featured_image = '';
wp_suspend_cache_addition(true);
$metas = get_post_custom($post->ID);
wp_suspend_cache_addition(false);
if(is_array($metas))
{
$rez_meta = aimogen_preg_grep_keys('#.+?_featured_ima?ge?#i', $metas);
}
else
{
$rez_meta = array();
}
if(count($rez_meta) > 0)
{
foreach($rez_meta as $rm)
{
if(isset($rm[0]) && filter_var($rm[0], FILTER_VALIDATE_URL))
{
$featured_image = $rm[0];
break;
}
}
}
if($featured_image == '')
{
$featured_image = aimogen_generate_thumbmail($post->ID);
}
if($featured_image == '' && $final_content != '')
{
$dom = new DOMDocument();
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($final_content);
libxml_use_internal_errors($internalErrors);
$tags = $dom->getElementsByTagName('img');
foreach ($tags as $tag) {
$temp_get_img = $tag->getAttribute('src');
if ($temp_get_img != '') {
$temp_get_img = strtok($temp_get_img, '?');
$featured_image = rtrim($temp_get_img, '/');
}
}
}
$post_cats = '';
$post_categories = wp_get_post_categories( $post->ID );
foreach($post_categories as $c){
$cat = get_category( $c );
$post_cats .= $cat->name . ',';
}
$post_cats = trim($post_cats, ',');
if($post_cats != '')
{
$post_categories = explode(',', $post_cats);
}
else
{
$post_categories = array();
}
if(count($post_categories) == 0)
{
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_categories[] = $term->slug;
}
$post_cats = implode(',', $post_categories);
}
}
$post_tagz = '';
$post_tags = wp_get_post_tags( $post->ID );
foreach($post_tags as $t){
$post_tagz .= $t->name . ',';
}
$post_tagz = trim($post_tagz, ',');
if($post_tagz != '')
{
$post_tags = explode(',', $post_tagz);
}
else
{
$post_tags = array();
}
if(count($post_tags) == 0)
{
$terms = get_the_terms( $post->ID, 'product_tag' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_tags[] = $term->slug;
}
$post_tagz = implode(',', $post_tags);
}
}
$post_excerpt = $post->post_excerpt;
$postID = $post->ID;
}
$user_message_preppend = aimogen_replaceAIPostShortcodes($user_message_preppend, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
if (filter_var($user_message_preppend, FILTER_VALIDATE_URL) !== false && aimogen_endsWith($user_message_preppend, '.txt'))
{
$txt_content = aimogen_get_web_page($user_message_preppend);
if ($txt_content !== FALSE)
{
$txt_content = preg_split('/\r\n|\r|\n/', $txt_content);
$txt_content = array_filter($txt_content);
if(count($txt_content) > 0)
{
$txt_content = $txt_content[array_rand($txt_content)];
if(trim($txt_content) != '')
{
$user_message_preppend = $txt_content;
$user_message_preppend = aimogen_replaceAIPostShortcodes($user_message_preppend, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
}
}
}
}
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$user_message_preppend = str_replace('%%user_name%%', '', $user_message_preppend);
$user_message_preppend = str_replace('%%user_email%%', '' , $user_message_preppend);
$user_message_preppend = str_replace('%%user_display_name%%', '', $user_message_preppend);
$user_message_preppend = str_replace('%%user_role%%', '', $user_message_preppend);
$user_message_preppend = str_replace('%%user_id%%', '' , $user_message_preppend);
$user_message_preppend = str_replace('%%user_firstname%%', '' , $user_message_preppend);
$user_message_preppend = str_replace('%%user_lastname%%', '' , $user_message_preppend);
$user_message_preppend = str_replace('%%user_description%%', '' , $user_message_preppend);
$user_message_preppend = str_replace('%%user_url%%', '' , $user_message_preppend);
}
else
{
$user_message_preppend = str_replace('%%user_name%%', $current_user->user_login, $user_message_preppend);
$user_message_preppend = str_replace('%%user_email%%', $current_user->user_email , $user_message_preppend);
$user_message_preppend = str_replace('%%user_display_name%%', $current_user->display_name , $user_message_preppend);
$user_message_preppend = str_replace('%%user_role%%', implode(',', $current_user->roles), $user_message_preppend);
$user_message_preppend = str_replace('%%user_id%%', $current_user->ID , $user_message_preppend);
$user_message_preppend = str_replace('%%user_firstname%%', $current_user->user_firstname , $user_message_preppend);
$user_message_preppend = str_replace('%%user_lastname%%', $current_user->user_lastname , $user_message_preppend);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$user_message_preppend = str_replace('%%user_description%%', $user_desc , $user_message_preppend);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$user_message_preppend = str_replace('%%user_url%%', $user_url , $user_message_preppend);
}
}
$enable_moderation = '0';
if (isset($aimogen_Chatbot_Settings['enable_moderation']) && $aimogen_Chatbot_Settings['enable_moderation'] == 'on')
{
$enable_moderation = '1';
}
if (isset($aimogen_Chatbot_Settings['moderation_model']) && $aimogen_Chatbot_Settings['moderation_model'] == 'on')
{
$moderation_model = $aimogen_Chatbot_Settings['moderation_model'];
}
else
{
$moderation_model = 'omni-moderation-latest';
}
if (isset($aimogen_Chatbot_Settings['flagged_message']) && $aimogen_Chatbot_Settings['flagged_message'] == 'on')
{
$flagged_message = $aimogen_Chatbot_Settings['flagged_message'];
}
else
{
$flagged_message = esc_html__('Your message has been flagged as potentially harmful or inappropriate. Please review your language and content to ensure it aligns with our values of respect and sensitivity towards others. Thank you for your cooperation.', 'aimogen');
}
if (isset($aimogen_Chatbot_Settings['enable_copy']) && $aimogen_Chatbot_Settings['enable_copy'] == 'on')
{
$enable_copy = $aimogen_Chatbot_Settings['enable_copy'];
}
else
{
$enable_copy = '0';
}
if (isset($aimogen_Chatbot_Settings['scroll_bot']) && $aimogen_Chatbot_Settings['scroll_bot'] == 'on')
{
$scroll_bot = $aimogen_Chatbot_Settings['scroll_bot'];
}
else
{
$scroll_bot = '0';
}
$chat_waveform = '0';
if (isset($aimogen_Chatbot_Settings['waveform_color']) && $aimogen_Chatbot_Settings['waveform_color'] != '')
{
$waveform_color = $aimogen_Chatbot_Settings['waveform_color'];
}
else
{
$waveform_color = 'purple';
}
$max_messages = '';
if (isset($aimogen_Chatbot_Settings['max_message_count']) && $aimogen_Chatbot_Settings['max_message_count'] != '' && is_numeric($aimogen_Chatbot_Settings['max_message_count']))
{
$max_messages = $aimogen_Chatbot_Settings['max_message_count'];
}
$max_message_context = '';
if (isset($aimogen_Chatbot_Settings['max_message_context']) && $aimogen_Chatbot_Settings['max_message_context'] != '' && is_numeric($aimogen_Chatbot_Settings['max_message_context']))
{
$max_message_context = $aimogen_Chatbot_Settings['max_message_context'];
}
$no_empty = '';
if (isset($aimogen_Chatbot_Settings['no_empty']) && trim($aimogen_Chatbot_Settings['no_empty']) == 'on' && empty($input_text))
{
$no_empty = '1';
}
if($persistent_assistant == true)
{
$thread_id = $chat_history;
}
else
{
$thread_id = '';
}
if ((isset($aimogen_Main_Settings['did_app_id']) && trim($aimogen_Main_Settings['did_app_id']) != ''))
{
$did_app_id = trim($aimogen_Main_Settings['did_app_id']);
}
else
{
$did_app_id = '';
}
if ((isset($aimogen_Main_Settings['azure_speech_id']) && trim($aimogen_Main_Settings['azure_speech_id']) != ''))
{
$azure_speech_id = trim($aimogen_Main_Settings['azure_speech_id']);
}
else
{
$azure_speech_id = '';
}
if ((isset($aimogen_Chatbot_Settings['azure_voice']) && trim($aimogen_Chatbot_Settings['azure_voice']) != ''))
{
$azure_voice = trim($aimogen_Chatbot_Settings['azure_voice']);
}
else
{
$azure_voice = 'en-US-AvaMultilingualNeural';
}
if ((isset($aimogen_Chatbot_Settings['azure_private_endpoint']) && trim($aimogen_Chatbot_Settings['azure_private_endpoint']) != ''))
{
$azure_private_endpoint = trim($aimogen_Chatbot_Settings['azure_private_endpoint']);
}
else
{
$azure_private_endpoint = '';
}
if ((isset($aimogen_Chatbot_Settings['azure_voice_endpoint']) && trim($aimogen_Chatbot_Settings['azure_voice_endpoint']) != ''))
{
$azure_voice_endpoint = trim($aimogen_Chatbot_Settings['azure_voice_endpoint']);
}
else
{
$azure_voice_endpoint = '';
}
if ((isset($aimogen_Chatbot_Settings['azure_character']) && trim($aimogen_Chatbot_Settings['azure_character']) != ''))
{
$azure_character = trim($aimogen_Chatbot_Settings['azure_character']);
}
else
{
$azure_character = 'lisa';
}
if ((isset($aimogen_Chatbot_Settings['azure_character_style']) && trim($aimogen_Chatbot_Settings['azure_character_style']) != ''))
{
$azure_character_style = trim($aimogen_Chatbot_Settings['azure_character_style']);
}
else
{
$azure_character_style = 'casual-sitting';
}
if ((isset($aimogen_Chatbot_Settings['azure_region']) && trim($aimogen_Chatbot_Settings['azure_region']) != ''))
{
$azure_region = trim($aimogen_Chatbot_Settings['azure_region']);
}
else
{
$azure_region = 'westus2';
}
if ((isset($aimogen_Chatbot_Settings['azure_voice_profile']) && trim($aimogen_Chatbot_Settings['azure_voice_profile']) != ''))
{
$azure_voice_profile = trim($aimogen_Chatbot_Settings['azure_voice_profile']);
}
else
{
$azure_voice_profile = '';
}
$did_image = '';
if(isset($aimogen_Chatbot_Settings['did_voice']) && $aimogen_Chatbot_Settings['did_voice'] != '')
{
$did_voice = $aimogen_Chatbot_Settings['did_voice'];
}
else
{
$did_voice = 'microsoft:en-US-JennyNeural:Cheerful';
}
if(aimogen_is_claude_model($model))
{
$stream_url = esc_html(add_query_arg(array(
'aimogen_claude_stream' => 'yes',
'nonce' => wp_create_nonce('aimogen-streaming-nonce')
), site_url() . '/index.php'));
}
else
{
$stream_url = esc_html(add_query_arg(array(
'aimogen_stream' => 'yes',
'nonce' => wp_create_nonce('aimogen-streaming-nonce')
), site_url() . '/index.php'));
}
if(aimogen_is_claude_model($model))
{
$model_type = 'claude';
}
else
{
if(aimogen_is_google_model($model))
{
$model_type = 'google';
}
elseif(aimogen_is_huggingface_model($model))
{
$model_type = 'huggingface';
}
elseif(aimogen_is_ollama_model($model))
{
$model_type = 'ollama';
}
else
{
$model_type = 'gpt';
}
}
if (isset($aimogen_Main_Settings['pdf_ok']) && trim($aimogen_Main_Settings['pdf_ok']) != '')
{
$pdf_ok = trim($aimogen_Main_Settings['pdf_ok']);
}
else
{
$pdf_ok = esc_html__('PDF file uploaded successfully! You can ask questions about it.', 'aimogen');
}
if (isset($aimogen_Main_Settings['pdf_end']) && trim($aimogen_Main_Settings['pdf_end']) != '')
{
$pdf_end = trim($aimogen_Main_Settings['pdf_end']);
}
else
{
$pdf_end = esc_html__('PDF file session ended.', 'aimogen');
}
if (isset($aimogen_Main_Settings['pdf_fail']) && trim($aimogen_Main_Settings['pdf_fail']) != '')
{
$pdf_fail = trim($aimogen_Main_Settings['pdf_fail']);
}
else
{
$pdf_fail = esc_html__('Failed to upload the PDF file, please try again later.', 'aimogen');
}
$is_modern_gpt = '0';
if (!isset($aimogen_Chatbot_Settings['disable_modern_chat']) || $aimogen_Chatbot_Settings['disable_modern_chat'] != 'on')
{
if(empty(trim($assistant_id)))
{
$checkappids = preg_split('/\r\n|\r|\n/', trim($aimogen_Main_Settings['app_id']));
$checkappids = array_filter($checkappids);
if(!empty($checkappids))
{
$checktoken = $checkappids[array_rand($checkappids)];
if(!aimogen_is_aimogen_key($checktoken) && (!aimogen_check_if_azure_or_others($aimogen_Main_Settings, $model) || aimogen_is_perplexity_model($model) || aimogen_is_groq_model($model) || aimogen_is_nvidia_model($model) || aimogen_is_xai_model($model)))
{
if(aimogen_is_chatgpt_model($model) || aimogen_is_chatgpt_turbo_model($model) || aimogen_is_perplexity_model($model) || aimogen_is_groq_model($model) || aimogen_is_nvidia_model($model) || aimogen_is_xai_model($model) || aimogen_is_chatgpt_o_model($model) || aimogen_is_o1_model($model))
{
$is_modern_gpt = '1';
}
}
}
}
}
if($voice_color_activated == '')
{
if (isset($aimogen_Chatbot_Settings['voice_color_activated']) && $aimogen_Chatbot_Settings['voice_color_activated'] != '')
{
$voice_color_activated = $aimogen_Chatbot_Settings['voice_color_activated'];
}
}
if($voice_color == '')
{
if (isset($aimogen_Chatbot_Settings['voice_color']) && $aimogen_Chatbot_Settings['voice_color'] != '')
{
$voice_color = $aimogen_Chatbot_Settings['voice_color'];
}
}
if(!function_exists('is_plugin_active'))
{
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$all_ok = true;
if (!is_plugin_active('aimogen-extension-pdf-files/aimogen-extension-pdf-files.php'))
{
$all_ok = false;
}
$chat_download_format = 'txt';
if (isset($aimogen_Chatbot_Settings['auto_submit_voice']) && $aimogen_Chatbot_Settings['auto_submit_voice'] == 'on')
{
$auto_submit_voice = 'on';
}
else
{
$auto_submit_voice = 'off';
}
if ($send_message_sound == '' && isset($aimogen_Chatbot_Settings['send_message_sound']) && trim($aimogen_Chatbot_Settings['send_message_sound']) != '')
{
$send_message_sound = trim($aimogen_Chatbot_Settings['send_message_sound']);
}
if ($receive_message_sound == '' && isset($aimogen_Chatbot_Settings['receive_message_sound']) && trim($aimogen_Chatbot_Settings['receive_message_sound']) != '')
{
$receive_message_sound = trim($aimogen_Chatbot_Settings['receive_message_sound']);
}
if ($response_delay == '' && isset($aimogen_Chatbot_Settings['response_delay']) && trim($aimogen_Chatbot_Settings['response_delay']) != '')
{
$response_delay = trim($aimogen_Chatbot_Settings['response_delay']);
}
$markdown_parse = 'off';
if ((isset($aimogen_Main_Settings['markdown_parse']) && $aimogen_Main_Settings['markdown_parse'] == 'on') || (isset($aimogen_Chatbot_Settings['markdown_parse']) && $aimogen_Chatbot_Settings['markdown_parse'] == 'on'))
{
$markdown_parse = 'on';
}
if(aimogen_check_if_azure($aimogen_Main_Settings))
{
$is_azure = '1';
}
else
{
$is_azure = '0';
}
wp_enqueue_style($name . 'css-ai-front', plugins_url('styles/form-front.css', __FILE__), false, AIMOGEN_LITE_MAJOR_VERSION);
$css_added = false;
$reg_css_code = '.aimogen_chat_history{';
if (isset($aimogen_Chatbot_Settings['font_size']) && $aimogen_Chatbot_Settings['font_size'] != '')
{
$reg_css_code .= 'font-size:' . $aimogen_Chatbot_Settings['font_size'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['height']) && $aimogen_Chatbot_Settings['height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['minheight']) && $aimogen_Chatbot_Settings['minheight'] != '')
{
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['minheight'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen_chat_history_log{';
if (isset($aimogen_Chatbot_Settings['font_size']) && $aimogen_Chatbot_Settings['font_size'] != '')
{
$reg_css_code .= 'font-size:' . $aimogen_Chatbot_Settings['font_size'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['height']) && $aimogen_Chatbot_Settings['height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['minheight']) && $aimogen_Chatbot_Settings['minheight'] != '')
{
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['minheight'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$all_ok = true;
if ($upload_pdf == 'on' || $upload_pdf == 'enabled' || $upload_pdf == 'yes' || $upload_pdf == '1' || (isset($aimogen_Chatbot_Settings['upload_pdf']) && $aimogen_Chatbot_Settings['upload_pdf'] == 'on' && $upload_pdf != 'disabled' && $upload_pdf != 'no' && $upload_pdf != '0' && $upload_pdf != 'off'))
{
if(!function_exists('is_plugin_active'))
{
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
if (!is_plugin_active('aimogen-extension-pdf-files/aimogen-extension-pdf-files.php'))
{
$all_ok = false;
}
if (isset($aimogen_Main_Settings['pinecone_app_id'])) {
$pinecone_app_id = $aimogen_Main_Settings['pinecone_app_id'];
} else {
$pinecone_app_id = '';
}
if (isset($aimogen_Main_Settings['qdrant_app_id'])) {
$qdrant_app_id = $aimogen_Main_Settings['qdrant_app_id'];
} else {
$qdrant_app_id = '';
}
if($pinecone_app_id == '' && $qdrant_app_id == '')
{
$all_ok = false;
}
if (!isset($aimogen_Main_Settings['embeddings_chat_short']) || trim($aimogen_Main_Settings['embeddings_chat_short']) != 'on')
{
$all_ok = false;
}
}
else
{
$all_ok = false;
}
if($no_padding != 'on')
{
$reg_css_code .= '#openai-ai-chat-form-' . $chatid . '
{
box-sizing: border-box;
padding-right: 20px;
padding-left: 20px;
}';
}
$reg_css_code .= '.openai-mr-4
{
margin-right: 1rem ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.openai-chat-avatar
{
border-radius: 50%;';
if (isset($aimogen_Chatbot_Settings['topavatar_width']) && $aimogen_Chatbot_Settings['topavatar_width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['topavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'width: 44px;';
}
if (isset($aimogen_Chatbot_Settings['topavatar_height']) && $aimogen_Chatbot_Settings['topavatar_height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['topavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'height: 44px;';
}
$reg_css_code .= 'clear: both;
display: block;
background: #E1F0FF;
position: relative;
}
.ai-avatar{';
if (isset($aimogen_Chatbot_Settings['convavatar_width']) && $aimogen_Chatbot_Settings['convavatar_width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['convavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'min-width:' . $aimogen_Chatbot_Settings['convavatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'width: 40px;';
$reg_css_code .= 'min-width: 40px;';
}
if (isset($aimogen_Chatbot_Settings['convavatar_height']) && $aimogen_Chatbot_Settings['convavatar_height'] != '')
{
$reg_css_code .= 'height:' . $aimogen_Chatbot_Settings['convavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'min-height:' . $aimogen_Chatbot_Settings['convavatar_height'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
$reg_css_code .= 'height: 40px;';
$reg_css_code .= 'min-height: 40px;';
}
$reg_css_code .= '}
.openai-font-weight-bold
{
font-weight: bold ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.openai-card-header{';
if (isset($aimogen_Chatbot_Settings['width']) && $aimogen_Chatbot_Settings['width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '
}
#openai-chat-response' . $chatid . ' {
padding-bottom: 5px;
text-align:center;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.openai-file-document {';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
}
.openai-file-document:hover {
transform: scale(1.1);
';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background-color:#f0f0f0' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
color: #333;
}
.aimogen-vision-image
{
max-width:300px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
max-height:300px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
display:block' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '
}
.aimogen-pdf-image {
user-select: none;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-pdf-image {
cursor: pointer;';
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%);
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-file-image {
user-select: none;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-file-image {
cursor: pointer;';
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($all_ok)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%);
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-stop-image {
user-select: none;
position: absolute;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-show-logs {
user-select: none;
position: absolute;
transform: scale(var(--ggs,1));
width: 25px;
overflow: hidden;
border-radius: 2px;
}
.aimogen-show-logs {
cursor: pointer;';
$enable_file_uploads = false;
if (isset($aimogen_Chatbot_Settings['enable_file_uploads']) && $aimogen_Chatbot_Settings['enable_file_uploads'] != '' && $file_uploads == '')
{
$file_uploads = $aimogen_Chatbot_Settings['enable_file_uploads'];
}
if(!empty($assistant_id) && ($file_uploads == 'on' || $file_uploads == 'yes' || $file_uploads == '1' || $file_uploads == 'enable' || $file_uploads == 'enabled'))
{
$is_file_search = get_post_meta($assistant_id, '_assistant_tools', true);
if(is_array($is_file_search))
{
foreach($is_file_search as $isfs)
{
if($isfs['type'] == 'file_search')
{
$enable_file_uploads = true;
break;
}
}
}
}
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
else
{
if($all_ok)
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($enable_file_uploads)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%)!important;
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-stop-image {
cursor: pointer;';
$allow_stream_stop = false;
if (isset($aimogen_Chatbot_Settings['allow_stream_stop']) && $aimogen_Chatbot_Settings['allow_stream_stop'] == 'on' && $persistent === 'history' && $assistant_id == '')
{
$allow_stream_stop = true;
}
$enable_file_uploads = false;
if (isset($aimogen_Chatbot_Settings['enable_file_uploads']) && $aimogen_Chatbot_Settings['enable_file_uploads'] != '' && $file_uploads == '')
{
$file_uploads = $aimogen_Chatbot_Settings['enable_file_uploads'];
}
if(!empty($assistant_id) && ($file_uploads == 'on' || $file_uploads == 'yes' || $file_uploads == '1' || $file_uploads == 'enable' || $file_uploads == 'enabled'))
{
$is_file_search = get_post_meta($assistant_id, '_assistant_tools', true);
if(is_array($is_file_search))
{
foreach($is_file_search as $isfs)
{
if($isfs['type'] == 'file_search')
{
$enable_file_uploads = true;
break;
}
}
}
}
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
if($all_ok)
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 122px;';
}
else
{
$reg_css_code .= 'right: 94px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
}
else
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
}
else
{
if($all_ok)
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 94px;';
}
else
{
$reg_css_code .= 'right: 66px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
}
else
{
if($enable_file_uploads)
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 66px;';
}
else
{
$reg_css_code .= 'right: 38px;';
}
}
else
{
if($allow_stream_stop == true)
{
$reg_css_code .= 'right: 38px;';
}
else
{
$reg_css_code .= 'right: 10px;';
}
}
}
}
$reg_css_code .= 'top: 53%;
transform: translateY(-50%)!important;
cursor: pointer;
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}
.aimogen-gg-image {
color: white;';
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-invite-popup {
position: fixed;
background: #fff;
color: #333;
border-radius: 10px;
padding: 14px 18px;
box-shadow: 0 6px 20px rgba(0,0,0,0.15);
font-size: 15px;
max-width: 260px;
line-height: 1.5;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 9999;
animation: aimogen-popup-fade 0.5s ease-out;
}
/* Position handling */
.aimogen-invite-popup.aimogen-bottom-right {
bottom: 100px;
right: 20px;
}
.aimogen-invite-popup.aimogen-bottom-left {
bottom: 100px;
left: 20px;
}
.aimogen-invite-popup.aimogen-top-right {
top: 100px;
right: 20px;
}
.aimogen-invite-popup.aimogen-top-left {
top: 100px;
left: 20px;
}
.aimogen-invite-content {
flex: 1;
padding-right: 10px;
}
.aimogen-invite-close {
cursor: pointer;
font-size: 18px;
color: #888;
transition: color 0.2s ease;
}
.aimogen-invite-close:hover {
color: #000;
}
/* Subtle fade animation */
@keyframes aimogen-popup-fade {
from {opacity: 0; transform: translateY(20px);}
to {opacity: 1; transform: translateY(0);}
}
/* Small directional arrow ???tail??? depending on location */
.aimogen-invite-popup::after {
content: "";
position: absolute;
width: 0;
height: 0;
border: 8px solid transparent;
}
.aimogen-invite-popup.aimogen-bottom-right::after {
border-top-color: #fff;
bottom: -16px;
right: 25px;
}
.aimogen-invite-popup.aimogen-bottom-left::after {
border-top-color: #fff;
bottom: -16px;
left: 25px;
}
.aimogen-invite-popup.aimogen-top-right::after {
border-bottom-color: #fff;
top: -16px;
right: 25px;
}
.aimogen-invite-popup.aimogen-top-left::after {
border-bottom-color: #fff;
top: -16px;
left: 25px;
}
.openai-relative
{
position: relative;
}
.openai-widget-user-name
{
line-height: 1.8;
}
.cr_none
{
display:none;
}
.cr_visible
{
display: block !important;
}
.cr_abs{position: absolute;}
.aimogen-gg-image::after,
.aimogen-gg-image::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
border: 2px solid
}
.aimogen-gg-mute:hover {
i:before {
transform: scale(.8) translate(-3px, 0) rotate(42deg);
}
}
.aimogen-hide {display:none!important;visibility:hidden}
.image_max_w_ai{width:100%;max-width:100%;}
.aimogen-pdf-remove, .aimogen-file-remove{
font-size: 30px;
justify-content: center;
align-items: center;
width: 18px;
line-height: unset;
font-family: Arial, serif;
border-radius: 50%;
font-weight: normal;
padding: 0;
margin: 0;
}
.aimogen-loading-indicator {
position: absolute;
top: 5px;
left: 0;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 10;
}
.aimogen-gg-trash::after,
.aimogen-gg-trash::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute
}
.aimogen-gg-trash::after {
background: currentColor;
border-radius: 3px;
width: 17px;
height: 2px;
top: -4px;
left: -5px
}
.aimogen-gg-trash::before {
width: 10px;
height: 4px;
border: 2px solid;
border-bottom: transparent;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
top: -7px;
left: -1px
}
.aimogen-gg-trash {
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 10px;
height: 12px;
border: 2px solid transparent;
box-shadow:
0 0 0 1px,
inset -2px 0 0,
inset 2px 0 0;
border-bottom-left-radius: 1px;
border-bottom-right-radius: 1px;
margin-top: 4px;
}
.aimogen-gg-mute {
margin-left:10px;
cursor: pointer;
top: -1px;
right: -3px;
height: 20px;
width: 20px;
position: relative;
overflow: hidden;
display: inline-block;
}
.aimogen-gg-image::after {
transform: rotate(45deg);
border-radius: 3px;
width: 16px;
height: 16px;
top: 9px;
left: 6px
}
.aimogen-gg-image::before {
width: 6px;
height: 6px;
border-radius: 100%;
top: 2px;
left: 2px
}
.aimogen-cursor
{
cursor: pointer;
}
.aimogen-left-padding
{
padding-left: 10px;
}
.aimogen-gg-globe {
top:-1px;
position: relative;
transform: scale(var(--ggs,1));
width: 18px;
border-radius: 22px;
}
.aimogen-gg-globe::after,
.aimogen-gg-globe::before {
content: "";
position: absolute;
width: 8px;
border-radius: 100%;
top: -2px;
left: 3px;
}
.aimogen-gg-unmute {
cursor: pointer;
margin-left:10px;
top: -1px;
right: -3px;
height: 20px;
width: 20px;
position: relative;
overflow: hidden;
display: inline-block;
}
.aimogen-gg-image {
box-sizing: border-box;
position: absolute;
display: block;
transform: scale(var(--ggs,1));
width: 20px;
height: 16px;
overflow: hidden;
box-shadow: 0 0 0 2px;
border-radius: 2px;
cursor: pointer;
right: 10px;
top: 50%;
transform: translateY(-50%);
padding: 10px;
cursor: pointer;
}
.openai-file-document::after,
.openai-file-document::before {
content: "";
display: block;
box-sizing: border-box;
position: absolute;
}
.openai-file-document::before {
background: currentColor;
box-shadow: 0 4px 0, -6px -4px 0;
left: 0;
width: 10px;
height: 2px;
top: 8px;
}
.openai-file-document::after {
width: 6px;
height: 6px;
border-left: 2px solid;
border-bottom: 2px solid;
right: -1px;
top: -1px;
}
.openai-file-document
{
cursor: pointer;
box-sizing: border-box;
position: relative;
display: block;
transform: scale(var(--ggs,1));
width: 14px;
height: 16px;
border: 2px solid transparent;
border-right: 0;
border-top: 0;
box-shadow: 0 0 0 1.3px;
border-radius: 1px;
border-top-right-radius: 4px;
overflow: hidden;
transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
.openai-card-header
{
margin: 0 auto;
position: absolute;
left: 0px;
padding: 3px;
border-radius: 0 50px 50px 0;
height: auto;
background: transparent;
padding-top: 10px;
display: flex;
min-height: 3.5rem;
align-items: center;
margin-bottom: 0;
position: relative;
}
.ai-export-txt
{
cursor: pointer;
padding-left:10px;
}
.ai-clear-chat
{
cursor: pointer;
padding-left:10px;
}
.openai-text-right
{
display: flex;
text-align: right;
margin-left: auto;
margin-right: 10px
}
.openai-d-flex
{
display: flex;
}';
$reg_css_code .= '.aimogen-gg-unmute {
i {
display: block;
width: 5.33px;
height: 5.33px;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
margin: 7px 0 0 1.33px;
}
i:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-style: solid;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color: transparent' . $aimogen_Chatbot_Settings['submit_color'] . ' transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:transparent #55a7e2 transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 6.67px 9.33px 6.67px 10px;
left: -8.67px;
top: 3.33px;
}
}
.aimogen-gg-globe,
.aimogen-gg-globe::after,
.aimogen-gg-globe::before {
display: block;
box-sizing: border-box;
height: 18px;
border: 2px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
}
.aimogen-gg-globe::after {
width: 24px;
height: 20px;
border: 2px solid transparent;
border-bottom: 2px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
top: -11px;
left: -5px;
}
.aimogen-gg-globe:hover {
transform: scale(1.1);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
.ai-compare-button.active {
background-color: ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#ffffff' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= ';
border: 1px solid ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= ';
}
.aimogen-globe-bar {
position: absolute;
width: 22px;
height: 2px;
background: ';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= $aimogen_Chatbot_Settings['submit_color'] . ';';
}
else
{
$reg_css_code .= '#55a7e2;';
}
$reg_css_code .= '
top: 50%;
left: 50%;
transform: translate(-50%, -50%) rotate(45deg);
}
.aimogen-gg-mute {
i {
display: block;
width: 5.33px;
height: 5.33px;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
margin: 7px 0 0 1.33px;
}
i:after {
content: "";
position: absolute;
width: 0;
height: 0;
border-style: solid;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color: transparent' . $aimogen_Chatbot_Settings['submit_color'] . ' transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:transparent #55a7e2 transparent transparent ' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 6.67px 9.33px 6.67px 10px;
left: -8.67px;
top: 3.33px;
}
i:before {
transform: rotate(45deg);
border-radius: 0 33.33px 0 0;
content: "";
position: absolute;
width: 3.33px;
height: 3.33px;
border-style: double;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'border-color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
border-width: 4.67px 4.67px 0 0;
left: 12px;
top: 6px;
transition: all 0.2s ease-out;
}
}
.aimogen-gg-trash {';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'color:#55a7e2' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$reg_css_code .= '
}
.aimogen-gg-trash:hover {
transform: scale(1.1);
';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
else
{
$reg_css_code .= 'background-color:#f0f0f0' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
}
$loader_color = '#fff';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$loader_color = $aimogen_Chatbot_Settings['persona_name_color'];
}
$reg_css_code .= '
}
.aimogen-loading-indicator::before {
content: \'\';
box-sizing: border-box;
width: 50px;
height: 50px;
border-radius: 50%;
border-top: 3px solid ' . $loader_color. ';
border-right: 3px solid transparent;
animation: keysspin 1s linear infinite;
}
@keyframes keysspin {
to {
transform: rotate(360deg);
}
}
#aimogen-video-wrapper' . $chatid . '
{
position: relative;
padding-top: 10px;
}
.aimogen-hide {display:none!important;}';
$reg_css_code .= '.openai-ai-form{
border-radius: 30px;';
if($general_background != '')
{
$reg_css_code .= 'background-color:' . $general_background . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
else
{
if (isset($aimogen_Chatbot_Settings['general_background']) && $aimogen_Chatbot_Settings['general_background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['general_background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
}
if (isset($aimogen_Chatbot_Settings['width']) && $aimogen_Chatbot_Settings['width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if($bubble_width == 'full' || empty($bubble_width))
{
$reg_css_code .= '.ai-bubble{width:100%!important;}';
$css_added = true;
}
elseif($bubble_width == 'auto')
{
$reg_css_code .= '.ai-bubble{width:auto!important;}';
$css_added = true;
}
if($bubble_alignment == 'left' || empty($bubble_alignment))
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'right')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-other{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
if($bubble_user_alignment == 'left')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:unset!important;margin-right:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'right' || empty($bubble_user_alignment))
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-right:unset!important;margin-left:auto!important;}';
$css_added = true;
}
elseif($bubble_user_alignment == 'center')
{
$reg_css_code .= '.ai-bubble.ai-mine{margin-left:auto!important;margin-right:auto!important;}';
$css_added = true;
}
$reg_css_code .= '.aimogen-conversation-starter {';
if (isset($aimogen_Chatbot_Settings['user_font_color']) && $aimogen_Chatbot_Settings['user_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['user_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['user_background_color']) && $aimogen_Chatbot_Settings['user_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['user_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= 'padding: 10px 15px;
border-radius: 20px;
cursor: pointer;
font-size: 14px;
max-width: 300px;
text-align: center;
}';
$reg_css_code .= '.ai-mine{';
if (isset($aimogen_Chatbot_Settings['user_font_color']) && $aimogen_Chatbot_Settings['user_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['user_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['user_background_color']) && $aimogen_Chatbot_Settings['user_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['user_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if(!empty($avatar_url))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other {
background-image: url("' . esc_url($avatar_url) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
if($additional_bots != '')
{
$bot_list = explode(',', $additional_bots);
$bot_list = array_map('trim', $bot_list);
$bot_list = array_filter($bot_list);
foreach($bot_list as $my_bot)
{
if(is_numeric($my_bot))
{
$bot_post = get_post($my_bot);
if($bot_post != null)
{
if($bot_post->post_type === 'aimogen_personas' || $bot_post->post_type === 'aimogen_assistants')
{
$att_src = get_the_post_thumbnail_url( $bot_post->ID, 'thumbnail' );
if ( empty($att_src) )
{
$att_src = plugins_url('images/placeholder.jpg', __FILE__);
}
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-other.aimogen-ainum-' . esc_html($bot_post->ID) . ' {
background-image: url("' . esc_url($att_src) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
}
}
}
}
if(!empty($avatar_url_user))
{
$css_added = true;
$reg_css_code .= '.ai-avatar.ai-mine {
background-image: url("' . esc_url($avatar_url_user) . '");
background-size: cover;
background-position: center;
margin-left: 3px;
margin-right: 3px;
}';
}
$reg_css_code .= '.ai-other{';
if (isset($aimogen_Chatbot_Settings['ai_font_color']) && $aimogen_Chatbot_Settings['ai_font_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['ai_font_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['ai_background_color']) && $aimogen_Chatbot_Settings['ai_background_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['ai_background_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$go_color = $aimogen_Chatbot_Settings['input_text_color'];
}
else
{
$go_color = '#ffffff';
}
$reg_css_code .= '}
.aimogen-pdf-loading, .aimogen-file-loading{
border: 2px solid ' . $go_color . ';
border-bottom-color: transparent;
border-radius: 50%;
box-sizing: border-box;
animation: aimogen_rotation 1s linear infinite;
display: inline-block;
width: 18px;
height: 18px;
}
@keyframes aimogen_rotation {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}';
$reg_css_code .= '#aimogen_chat_input' . $chatid . '{min-height:62px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-name' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-role' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_role_color']) && $aimogen_Chatbot_Settings['persona_role_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_role_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-ai-text{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-ai-input{min-height:62px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['background']) && $aimogen_Chatbot_Settings['background'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['background'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_border_color']) && $aimogen_Chatbot_Settings['input_border_color'] != '')
{
$reg_css_code .= 'border-color:' . $aimogen_Chatbot_Settings['input_border_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['input_text_color']) && $aimogen_Chatbot_Settings['input_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-name' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_name_color']) && $aimogen_Chatbot_Settings['persona_name_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_name_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-persona-role' . $chatid . '{';
if (isset($aimogen_Chatbot_Settings['persona_role_color']) && $aimogen_Chatbot_Settings['persona_role_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['persona_role_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#aimogen_chat_input' . $chatid . '::placeholder{';
if (isset($aimogen_Chatbot_Settings['input_placeholder_color']) && $aimogen_Chatbot_Settings['input_placeholder_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['input_placeholder_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '.aimogen-close-button{';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$reg_css_code .= '#openai-chat-speech-button' . $chatid . '{';
if ($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
$reg_css_code .= '#openai-image-speech-button' . $chatid . '{';
if ($voice_color != '')
{
$reg_css_code .= 'background-color:' . $voice_color . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if (isset($aimogen_Chatbot_Settings['open_width']) && $aimogen_Chatbot_Settings['open_width'] != '')
{
$reg_css_code .= '.aimogen-open-image{width:' . $aimogen_Chatbot_Settings['open_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;') . '}';
$css_added = true;
}
$reg_css_code .= '#aichatsubmitbut' . $chatid . '{margin-top: 5px' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}
#aiimagechatsubmitbut' . $chatid . '{margin-left:20px;';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$reg_css_code .= 'background-color:' . $aimogen_Chatbot_Settings['submit_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
if (isset($aimogen_Chatbot_Settings['submit_text_color']) && $aimogen_Chatbot_Settings['submit_text_color'] != '')
{
$reg_css_code .= 'color:' . $aimogen_Chatbot_Settings['submit_text_color'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}
.cr_transp_canvas{background-color: transparent;';
if (isset($aimogen_Chatbot_Settings['canvas_avatar_width']) && $aimogen_Chatbot_Settings['canvas_avatar_width'] != '')
{
$reg_css_code .= 'width:' . $aimogen_Chatbot_Settings['canvas_avatar_width'] . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$css_added = true;
}
$reg_css_code .= '}';
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$reg_css_code .= 'form.aimogen-window{';
$reg_css_code .= 'display:none;';
$reg_css_code .= '}';
$css_added = true;
}
if($window_width != '')
{
preg_match_all('#(\d+)\s*px#i', $window_width, $zamatches);
if(isset($zamatches[1][0]))
{
$myw = intval($zamatches[1][0]) + 100;
$wwidth = $myw . 'px';
}
else
{
$wwidth = $window_width;
}
$reg_css_code .= '@media only screen and (min-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:' . $window_width . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$reg_css_code .= '@media only screen and (max-width: ' . $wwidth . ') {form.aimogen-window{';
$reg_css_code .= 'width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= 'max-width:75%' . ((isset($aimogen_Main_Settings['not_important']) && $aimogen_Main_Settings['not_important'] === 'on') ? ';' : '!important;');
$reg_css_code .= '}}';
$css_added = true;
}
if($css_added === true)
{
wp_add_inline_style( $name . 'css-ai-front', wp_strip_all_tags($reg_css_code) );
}
$all_models = aimogen_get_all_models();
$models = $all_models;
if($model != 'default' && !in_array($model, $models))
{
$return_me .= 'Invalid model provided!';
return $return_me;
}
if($temp != 'default' && floatval($temp) < 0 || floatval($temp) > 1)
{
$return_me .= 'Invalid temperature provided!';
return $return_me;
}
if($top_p != 'default' && floatval($top_p) < 0 || floatval($top_p) > 1)
{
$return_me .= 'Invalid top_p provided!';
return $return_me;
}
if($presence != 'default' && floatval($presence) < -2 || floatval($presence) > 2)
{
$return_me .= 'Invalid presence_penalty provided!';
return $return_me;
}
if($frequency != 'default' && floatval($frequency) < -2 || floatval($frequency) > 2)
{
$return_me .= 'Invalid frequency_penalty provided!';
return $return_me;
}
// Display the form
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$show_me = '
';
if (isset($aimogen_Chatbot_Settings['chatbot_icon']) && $aimogen_Chatbot_Settings['chatbot_icon'] != '')
{
if($aimogen_Chatbot_Settings['chatbot_icon'] != 'x')
{
$show_me = '
';
}
elseif (isset($aimogen_Chatbot_Settings['chatbot_icon_html']) && $aimogen_Chatbot_Settings['chatbot_icon_html'] != '')
{
$show_me = trim($aimogen_Chatbot_Settings['chatbot_icon_html']);
if(aimogen_starts_with($show_me, 'http') === true)
{
$show_me = '
';
}
}
}
$invite_html = '';
if (!empty($aimogen_Chatbot_Settings['chatbot_invite_message'])) {
$invite_msg = esc_html($aimogen_Chatbot_Settings['chatbot_invite_message']);
$invite_html = '
';
}
$return_me .= $invite_html . '
' . $show_me . ' ';
}
$return_me .= '
';
if (isset($aimogen_Chatbot_Settings['show_header']) && $aimogen_Chatbot_Settings['show_header'] != '' && $show_header == '')
{
$show_header = $aimogen_Chatbot_Settings['show_header'];
}
$hclass = '';
if($show_header != 'show')
{
$hclass = ' aimogen-hide';
}
if (isset($aimogen_Chatbot_Settings['show_dltxt']) && $aimogen_Chatbot_Settings['show_dltxt'] != '' && $show_dltxt == '')
{
$show_dltxt = $aimogen_Chatbot_Settings['show_dltxt'];
}
if (isset($aimogen_Chatbot_Settings['show_mute']) && $aimogen_Chatbot_Settings['show_mute'] != '' && $show_mute == '')
{
$show_mute = $aimogen_Chatbot_Settings['show_mute'];
}
if (isset($aimogen_Chatbot_Settings['show_internet']) && $aimogen_Chatbot_Settings['show_internet'] != '' && $show_internet == '')
{
$show_internet = $aimogen_Chatbot_Settings['show_internet'];
}
if (isset($aimogen_Chatbot_Settings['show_clear']) && $aimogen_Chatbot_Settings['show_clear'] != '' && $show_clear == '')
{
$show_clear = $aimogen_Chatbot_Settings['show_clear'];
}
$tclass = '';
if($show_dltxt != 'show')
{
$tclass = ' aimogen-hide';
}
$mclass = '';
if($show_mute != 'show' || $chatbot_text_speech == 'off')
{
$mclass = ' aimogen-hide';
}
$iclass = '';
if(!isset($aimogen_Main_Settings['internet_chat_short']) || $aimogen_Main_Settings['internet_chat_short'] != 'on')
{
$iclass = ' aimogen-hide';
}
else
{
if($show_internet != 'show' || $internet_access == 'off' || $internet_access == 'disable' || $internet_access == 'disabled' || $internet_access == 'Disabled' || $internet_access === '0' || $internet_access === '0')
{
$iclass = ' aimogen-hide';
}
}
$dclass = '';
if($show_clear != 'show')
{
$dclass = ' aimogen-hide';
}
$ai_prep = trim($ai_message_preppend, ': ');
if($ai_prep != '')
{
$ai_prep .= ': ';
}
$user_prep = trim($user_message_preppend, ': ');
if($user_prep != '')
{
$user_prep .= ': ';
}
if($enable_front_end == 'on' || $enable_front_end == '1' || $enable_front_end == 'true' || $enable_front_end == 'yes' || $enable_front_end == 'front' || $enable_front_end == 'back' || $enable_front_end == 'both')
{
$return_me .= ' × ';
}
if(!empty($custom_header))
{
$return_me .= '';
}
$return_me .= '';
$return_me .= '
';
if($bubble_user_alignment == 'right' && !empty($avatar_url_user) && $show_user_avatar == 'show')
{
$chat_initial_messages .= '
';
}
$chat_initial_messages .= '
';
}
elseif($om['role'] == 'assistant')
{
$chat_initial_messages .= '
';
if($bubble_alignment != 'right' && !empty($avatar_url) && $show_ai_avatar == 'show')
{
$chat_initial_messages .= '
';
}
$chat_initial_messages .= '
' . $om['content'][0]['text']['value'] . '
';
if($bubble_alignment == 'right' && !empty($avatar_url) && $show_ai_avatar == 'show')
{
$chat_initial_messages .= '
';
}
$chat_initial_messages .= '
';
}
}
}
}
}
}
}
catch(Exception $e)
{
aimogen_log_to_file('Failed to list persistent messages for thread ID: ' . $thread_id);
}
}
}
else
{
if(!empty($chat_history))
{
$chat_initial_messages .= $chat_history;
}
if($ai_first_message != '')
{
if(stristr($ai_first_message, '%%') !== false)
{
$post_link = '';
$post_title = '';
$blog_title = html_entity_decode(get_bloginfo('title'));
$post_excerpt = '';
$final_content = '';
$user_name = '';
$featured_image = '';
$post_cats = '';
$post_tagz = '';
$postID = '';
global $post;
if(isset($post->ID))
{
$post_link = get_permalink($post->ID);
$blog_title = html_entity_decode(get_bloginfo('title'));
$author_obj = get_user_by('id', $post->post_author);
if($author_obj !== false)
{
$user_name = $author_obj->user_nicename;
}
$final_content = $post->post_content;
$post_title = $post->post_title;
$featured_image = '';
wp_suspend_cache_addition(true);
$metas = get_post_custom($post->ID);
wp_suspend_cache_addition(false);
if(is_array($metas))
{
$rez_meta = aimogen_preg_grep_keys('#.+?_featured_ima?ge?#i', $metas);
}
else
{
$rez_meta = array();
}
if(count($rez_meta) > 0)
{
foreach($rez_meta as $rm)
{
if(isset($rm[0]) && filter_var($rm[0], FILTER_VALIDATE_URL))
{
$featured_image = $rm[0];
break;
}
}
}
if($featured_image == '')
{
$featured_image = aimogen_generate_thumbmail($post->ID);
}
if($featured_image == '' && $final_content != '')
{
$dom = new DOMDocument();
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($final_content);
libxml_use_internal_errors($internalErrors);
$tags = $dom->getElementsByTagName('img');
foreach ($tags as $tag) {
$temp_get_img = $tag->getAttribute('src');
if ($temp_get_img != '') {
$temp_get_img = strtok($temp_get_img, '?');
$featured_image = rtrim($temp_get_img, '/');
}
}
}
$post_cats = '';
$post_categories = wp_get_post_categories( $post->ID );
foreach($post_categories as $c){
$cat = get_category( $c );
$post_cats .= $cat->name . ',';
}
$post_cats = trim($post_cats, ',');
if($post_cats != '')
{
$post_categories = explode(',', $post_cats);
}
else
{
$post_categories = array();
}
if(count($post_categories) == 0)
{
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_categories[] = $term->slug;
}
$post_cats = implode(',', $post_categories);
}
}
$post_tagz = '';
$post_tags = wp_get_post_tags( $post->ID );
foreach($post_tags as $t){
$post_tagz .= $t->name . ',';
}
$post_tagz = trim($post_tagz, ',');
if($post_tagz != '')
{
$post_tags = explode(',', $post_tagz);
}
else
{
$post_tags = array();
}
if(count($post_tags) == 0)
{
$terms = get_the_terms( $post->ID, 'product_tag' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_tags[] = $term->slug;
}
$post_tagz = implode(',', $post_tags);
}
}
$post_excerpt = $post->post_excerpt;
$postID = $post->ID;
}
$ai_first_message = aimogen_replaceAIPostShortcodes($ai_first_message, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
if (filter_var($ai_first_message, FILTER_VALIDATE_URL) !== false && aimogen_endsWith($ai_first_message, '.txt'))
{
$txt_content = aimogen_get_web_page($ai_first_message);
if ($txt_content !== FALSE)
{
$txt_content = preg_split('/\r\n|\r|\n/', $txt_content);
$txt_content = array_filter($txt_content);
if(count($txt_content) > 0)
{
$txt_content = $txt_content[array_rand($txt_content)];
if(trim($txt_content) != '')
{
$ai_first_message = $txt_content;
$ai_first_message = aimogen_replaceAIPostShortcodes($ai_first_message, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
}
}
}
}
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$ai_first_message = str_replace('%%user_name%%', '', $ai_first_message);
$ai_first_message = str_replace('%%user_email%%', '' , $ai_first_message);
$ai_first_message = str_replace('%%user_display_name%%', '', $ai_first_message);
$ai_first_message = str_replace('%%user_role%%', '', $ai_first_message);
$ai_first_message = str_replace('%%user_id%%', '' , $ai_first_message);
$ai_first_message = str_replace('%%user_firstname%%', '' , $ai_first_message);
$ai_first_message = str_replace('%%user_lastname%%', '' , $ai_first_message);
$ai_first_message = str_replace('%%user_description%%', '' , $ai_first_message);
$ai_first_message = str_replace('%%user_url%%', '' , $ai_first_message);
}
else
{
$ai_first_message = str_replace('%%user_name%%', $current_user->user_login, $ai_first_message);
$ai_first_message = str_replace('%%user_email%%', $current_user->user_email , $ai_first_message);
$ai_first_message = str_replace('%%user_display_name%%', $current_user->display_name , $ai_first_message);
$ai_first_message = str_replace('%%user_role%%', implode(',', $current_user->roles), $ai_first_message);
$ai_first_message = str_replace('%%user_id%%', $current_user->ID , $ai_first_message);
$ai_first_message = str_replace('%%user_firstname%%', $current_user->user_firstname , $ai_first_message);
$ai_first_message = str_replace('%%user_lastname%%', $current_user->user_lastname , $ai_first_message);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$ai_first_message = str_replace('%%user_description%%', $user_desc , $ai_first_message);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$ai_first_message = str_replace('%%user_url%%', $user_url , $ai_first_message);
}
}
$fm = preg_split('/\r\n|\r|\n/', trim($ai_first_message));
$fm = array_filter($fm);
if(empty($chat_history))
{
$chat_initial_messages .= '
';
if($bubble_alignment != 'right' && !empty($avatar_url) && $show_ai_avatar == 'show')
{
$chat_initial_messages .= '
';
}
$chat_initial_messages .= '
' . $fm[0] . '
';
if($bubble_alignment == 'right' && !empty($avatar_url) && $show_ai_avatar == 'show')
{
$chat_initial_messages .= '
';
}
$chat_initial_messages .= '
';
}
array_shift($fm);
if(count($fm) > 0)
{
$complete_me .= '
';
}
}
}
$return_me .= $chat_initial_messages;
if (isset($aimogen_Chatbot_Settings['chat_editing']) && trim($aimogen_Chatbot_Settings['chat_editing']) != '')
{
$chat_editing = trim($aimogen_Chatbot_Settings['chat_editing']);
}
else
{
$chat_editing = '';
}
$show_gdpr = '0';
if (isset($aimogen_Chatbot_Settings['show_gdpr']) && $aimogen_Chatbot_Settings['show_gdpr'] == 'on')
{
$show_gdpr = '1';
}
$bots_data = array();
if($additional_bots != '')
{
$bot_list = explode(',', $additional_bots);
$bot_list = array_map('trim', $bot_list);
$bot_list = array_filter($bot_list);
foreach($bot_list as $my_bot)
{
if(is_numeric($my_bot))
{
$bot_post = get_post($my_bot);
if($bot_post != null)
{
if(!empty(trim($bot_post->post_title)))
{
if($bot_post->post_type === 'aimogen_personas' || $bot_post->post_type === 'aimogen_assistants')
{
$new_bot['name'] = $bot_post->post_title;
$new_bot['ID'] = $bot_post->ID;
$botprompt = $bot_post->post_content;
$botprompt = do_shortcode($botprompt);
if(stristr($botprompt, '%%') !== false)
{
$post_link = '';
$post_title = '';
$blog_title = html_entity_decode(get_bloginfo('title'));
$post_excerpt = '';
$final_content = '';
$user_name = '';
$featured_image = '';
$post_cats = '';
$post_tagz = '';
$postID = '';
global $post;
if(isset($post->ID))
{
$post_link = get_permalink($post->ID);
$blog_title = html_entity_decode(get_bloginfo('title'));
$author_obj = get_user_by('id', $post->post_author);
if($author_obj !== false)
{
$user_name = $author_obj->user_nicename;
}
$final_content = $post->post_content;
$post_title = $post->post_title;
$featured_image = '';
wp_suspend_cache_addition(true);
$metas = get_post_custom($post->ID);
wp_suspend_cache_addition(false);
if(is_array($metas))
{
$rez_meta = aimogen_preg_grep_keys('#.+?_featured_ima?ge?#i', $metas);
}
else
{
$rez_meta = array();
}
if(count($rez_meta) > 0)
{
foreach($rez_meta as $rm)
{
if(isset($rm[0]) && filter_var($rm[0], FILTER_VALIDATE_URL))
{
$featured_image = $rm[0];
break;
}
}
}
if($featured_image == '')
{
$featured_image = aimogen_generate_thumbmail($post->ID);
}
if($featured_image == '' && $final_content != '')
{
$dom = new DOMDocument();
$internalErrors = libxml_use_internal_errors(true);
$dom->loadHTML($final_content);
libxml_use_internal_errors($internalErrors);
$tags = $dom->getElementsByTagName('img');
foreach ($tags as $tag) {
$temp_get_img = $tag->getAttribute('src');
if ($temp_get_img != '') {
$temp_get_img = strtok($temp_get_img, '?');
$featured_image = rtrim($temp_get_img, '/');
}
}
}
$post_cats = '';
$post_categories = wp_get_post_categories( $post->ID );
foreach($post_categories as $c){
$cat = get_category( $c );
$post_cats .= $cat->name . ',';
}
$post_cats = trim($post_cats, ',');
if($post_cats != '')
{
$post_categories = explode(',', $post_cats);
}
else
{
$post_categories = array();
}
if(count($post_categories) == 0)
{
$terms = get_the_terms( $post->ID, 'product_cat' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_categories[] = $term->slug;
}
$post_cats = implode(',', $post_categories);
}
}
$post_tagz = '';
$post_tags = wp_get_post_tags( $post->ID );
foreach($post_tags as $t){
$post_tagz .= $t->name . ',';
}
$post_tagz = trim($post_tagz, ',');
if($post_tagz != '')
{
$post_tags = explode(',', $post_tagz);
}
else
{
$post_tags = array();
}
if(count($post_tags) == 0)
{
$terms = get_the_terms( $post->ID, 'product_tag' );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
$post_tags[] = $term->slug;
}
$post_tagz = implode(',', $post_tags);
}
}
$post_excerpt = $post->post_excerpt;
$postID = $post->ID;
}
$botprompt = aimogen_replaceAIPostShortcodes($botprompt, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
if (filter_var($botprompt, FILTER_VALIDATE_URL) !== false && aimogen_endsWith($botprompt, '.txt'))
{
$txt_content = aimogen_get_web_page($botprompt);
if ($txt_content !== FALSE)
{
$txt_content = preg_split('/\r\n|\r|\n/', $txt_content);
$txt_content = array_filter($txt_content);
if(count($txt_content) > 0)
{
$txt_content = $txt_content[array_rand($txt_content)];
if(trim($txt_content) != '')
{
$botprompt = $txt_content;
$botprompt = aimogen_replaceAIPostShortcodes($botprompt, $post_link, $post_title, $blog_title, $post_excerpt, $final_content, $user_name, $featured_image, $post_cats, $post_tagz, $postID, '', '', '', '', '', '');
$botprompt = do_shortcode($botprompt);
}
}
}
}
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$botprompt = str_replace('%%user_name%%', '', $botprompt);
$botprompt = str_replace('%%user_email%%', '' , $botprompt);
$botprompt = str_replace('%%user_display_name%%', '', $botprompt);
$botprompt = str_replace('%%user_role%%', '', $botprompt);
$botprompt = str_replace('%%user_id%%', '' , $botprompt);
$botprompt = str_replace('%%user_firstname%%', '' , $botprompt);
$botprompt = str_replace('%%user_lastname%%', '' , $botprompt);
$botprompt = str_replace('%%user_description%%', '' , $botprompt);
$botprompt = str_replace('%%user_url%%', '' , $botprompt);
}
else
{
$botprompt = str_replace('%%user_name%%', $current_user->user_login, $botprompt);
$botprompt = str_replace('%%user_email%%', $current_user->user_email , $botprompt);
$botprompt = str_replace('%%user_display_name%%', $current_user->display_name , $botprompt);
$botprompt = str_replace('%%user_role%%', implode(',', $current_user->roles), $botprompt);
$botprompt = str_replace('%%user_id%%', $current_user->ID , $botprompt);
$botprompt = str_replace('%%user_firstname%%', $current_user->user_firstname , $botprompt);
$botprompt = str_replace('%%user_lastname%%', $current_user->user_lastname , $botprompt);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$botprompt = str_replace('%%user_description%%', $user_desc , $botprompt);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$botprompt = str_replace('%%user_url%%', $user_url , $botprompt);
}
}
if($bot_post->post_type === 'aimogen_assistants')
{
$botassistantid = $bot_post->ID;
$botmodel = get_post_meta($bot_post->ID, '_assistant_model', true);
}
elseif($bot_post->post_type === 'aimogen_personas')
{
$botassistantid = '';
$botmodel = get_post_meta($bot_post->ID, '_persona_model', true);
}
if(empty($botmodel))
{
$botmodel = AIMOGEN_DEFAULT_MODEL;
}
$new_bot['assistentid'] = $botassistantid;
$new_bot['model'] = $botmodel;
$new_bot['prompt'] = $botprompt;
$bots_data[] = $new_bot;
}
}
}
}
}
}
if(strstr($embeddings_namespace, '%%') !== false)
{
$current_user = wp_get_current_user();
if ( !($current_user instanceof WP_User) || !is_user_logged_in())
{
$embeddings_namespace = str_replace('%%user_name%%', '', $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_email%%', '' , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_display_name%%', '', $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_role%%', '', $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_id%%', '' , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_firstname%%', '' , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_lastname%%', '' , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_description%%', '' , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_url%%', '' , $embeddings_namespace);
}
else
{
$embeddings_namespace = str_replace('%%user_name%%', $current_user->user_login, $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_email%%', $current_user->user_email , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_display_name%%', $current_user->display_name, $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_role%%', implode(',', $current_user->roles), $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_id%%', $current_user->ID , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_firstname%%', $current_user->user_firstname , $embeddings_namespace);
$embeddings_namespace = str_replace('%%user_lastname%%', $current_user->user_lastname , $embeddings_namespace);
$user_desc = get_the_author_meta( 'description', $current_user->ID );
$embeddings_namespace = str_replace('%%user_description%%', $user_desc , $embeddings_namespace);
$user_url = get_the_author_meta( 'user_url', $current_user->ID );
$embeddings_namespace = str_replace('%%user_url%%', $user_url , $embeddings_namespace);
}
}
$return_me .= '
';
if(($enable_vision == 'on' || $enable_vision == 'yes' || $enable_vision == '1' || $enable_vision == 'enable' || $enable_vision == 'enabled') && aimogen_is_vision_model($model, $assistant_id))
{
$return_me .= ' ';
}
if($enable_file_uploads)
{
$return_me .= ' ';
}
if ($upload_pdf == 'on' || $upload_pdf == 'enabled' || $upload_pdf == 'yes' || $upload_pdf == '1' || (isset($aimogen_Chatbot_Settings['upload_pdf']) && $aimogen_Chatbot_Settings['upload_pdf'] == 'on' && $upload_pdf != 'disabled' && $upload_pdf != 'no' && $upload_pdf != '0' && $upload_pdf != 'off'))
{
if($all_ok === true)
{
$return_me .= ' ';
}
}
if (!empty($bots_data))
{
$return_me .= '';
$return_me .= '
';
foreach($bots_data as $bd)
{
$thumbimg = get_the_post_thumbnail_url($bd['ID'], 'thumbnail');
if(empty($thumbimg))
{
$thumbimg = plugins_url('images/placeholder.jpg', __FILE__);
}
$return_me .= '
';
$return_me .= '
@' . esc_html(str_replace(' ', '', $bd['name'])) . '
';
}
$return_me .= '
';
}
$blocked_words = '';
if (isset($aimogen_Chatbot_Settings['blocked_words']) && trim($aimogen_Chatbot_Settings['blocked_words']) != '')
{
$blocked_words = trim($aimogen_Chatbot_Settings['blocked_words']);
}
if(!empty($bot_workflow))
{
$bot_workflow_decode = base64_decode($bot_workflow);
if($bot_workflow_decode !== false)
{
$bot_workflow = $bot_workflow_decode;
}
else
{
$bot_workflow = '';
}
}
if (isset($aimogen_Chatbot_Settings['bot_workflow']) && $aimogen_Chatbot_Settings['bot_workflow'] != '' && $bot_workflow == '')
{
$bot_workflow = $aimogen_Chatbot_Settings['bot_workflow'];
}
$typewriter_delay = 50;
if (isset($aimogen_Chatbot_Settings['typewriter_delay']) && $aimogen_Chatbot_Settings['typewriter_delay'] != '')
{
$typewriter_delay = intval($aimogen_Chatbot_Settings['typewriter_delay']);
}
if(!empty($bot_workflow) && $bot_workflow != '[]')
{
$workflow = json_decode($bot_workflow, true);
$errs = aimogen_validate_workflows($workflow);
if(!empty($errs))
{
if (isset($aimogen_Main_Settings['enable_detailed_logging']))
{
aimogen_log_to_file('Errors in chatbot workflows: ' . json_encode($errs));
}
$bot_workflow = '';
}
}
$u_is_logged_in = is_user_logged_in() ? 1 : 0;
$u_current_user = wp_get_current_user();
$u_user_name = $u_is_logged_in ? $u_current_user->user_login : '';
$u_user_roles = $u_is_logged_in ? $u_current_user->roles : [];
$current_post_id = is_singular() ? get_the_ID() : 0;
$current_post_categories = array();
if (is_singular('product')) {
$terms = wp_get_post_terms(get_the_ID(), 'product_cat');
if (!is_wp_error($terms) && !empty($terms)) {
$current_post_categories = array_map(function($term) {
return array(
'id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
);
}, $terms);
}
} elseif (is_singular()) {
$terms = wp_get_post_terms(get_the_ID(), 'category');
if (!is_wp_error($terms) && !empty($terms)) {
$current_post_categories = array_map(function($term) {
return array(
'id' => $term->term_id,
'name' => $term->name,
'slug' => $term->slug,
);
}, $terms);
}
}
if (empty($current_post_categories)) {
$current_post_categories = array();
}
$bg_color = '#6077e6';
if (isset($aimogen_Chatbot_Settings['submit_color']) && $aimogen_Chatbot_Settings['submit_color'] != '')
{
$bg_color = $aimogen_Chatbot_Settings['submit_color'];
}
$enable_html = false;
if (isset($aimogen_Chatbot_Settings['enable_html']) && $aimogen_Chatbot_Settings['enable_html'] == 'on')
{
$enable_html = true;
}
$strip_js = false;
if (isset($aimogen_Chatbot_Settings['strip_js']) && $aimogen_Chatbot_Settings['strip_js'] == 'on')
{
$strip_js = true;
}
$current_post_type = isset($post) ? get_post_type($post) : '';
$custom_vars = array(
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('openai-ajax-nonce'),
'stream_url' => $stream_url,
'model_type' => $model_type,
'model' => $model,
'temp' => $temp,
'enable_html' => $enable_html,
'strip_js' => $strip_js,
'top_p' => $top_p,
'presence' => $presence,
'frequency' => $frequency,
'is_logged_in' => $u_is_logged_in,
'current_post_id' => $current_post_id,
'current_post_categories' => $current_post_categories,
'current_post_type' => $current_post_type,
'user_name' => $u_user_name,
'user_roles' => $u_user_roles,
'store_data' => $store_data,
'instant_response' => $instant_response,
'chat_preppend_text' => $chat_preppend_text,
'user_message_preppend' => $user_message_preppend,
'ai_message_preppend' => $ai_message_preppend,
'user_token_cap_per_day' => $user_token_cap_per_day,
'user_id' => $user_id,
'persistent' => $persistent,
'persistentnonce' => wp_create_nonce('openai-persistent-nonce'),
'moderation_nonce' => wp_create_nonce('openai-moderation-nonce'),
'enable_moderation' => $enable_moderation,
'moderation_model' => $moderation_model,
'flagged_message' => $flagged_message,
'enable_copy' => $enable_copy,
'scroll_bot' => $scroll_bot,
'chat_waveform' => $chat_waveform,
'waveform_color' => $waveform_color,
'text_speech' => $chatbot_text_speech,
'free_voice' => $free_voice,
'max_messages' => $max_messages,
'max_message_context' => $max_message_context,
'no_empty' => $no_empty,
'overwrite_voice' => $overwrite_voice,
'chatid' => $chatid,
'did_image' => $did_image,
'did_voice' => $did_voice,
'did_app_id' => $did_app_id,
'azure_speech_id' => $azure_speech_id,
'azure_voice' => $azure_voice,
'azure_voice_profile' => $azure_voice_profile,
'azure_private_endpoint' => $azure_private_endpoint,
'azure_voice_endpoint' => $azure_voice_endpoint,
'azure_character' => $azure_character,
'azure_character_style' => $azure_character_style,
'azure_region' => $azure_region,
'threadid' => $thread_id,
'pdf_ok' => $pdf_ok,
'pdf_end' => $pdf_end,
'pdf_fail' => $pdf_fail,
'conversation_end' => esc_html__('The AI considers this as the end of the text. Please try using a different text input', 'aimogen'),
'file_end' => esc_html__('File session ended', 'aimogen'),
'file_ok' => esc_html__('File upload successful', 'aimogen'),
'file_fail' => esc_html__('File upload failed', 'aimogen'),
'processing_issue' => esc_html__('There was an issue with processing, please try again later', 'aimogen'),
'message_required' => esc_html__('You need to enter a message to speak to the chatbot', 'aimogen'),
'text_copied' => esc_html__('Text copied!', 'aimogen'),
'conversation_ended' => esc_html__('Conversation ended', 'aimogen'),
'enable_god_mode' => $enable_god_mode,
'is_modern_gpt' => $is_modern_gpt,
'voice_color' => $voice_color,
'voice_color_activated' => $voice_color_activated,
'chat_download_format' => $chat_download_format,
'internet_access' => $internet_access,
'embeddings' => $embeddings,
'embeddings_namespace' => $embeddings_namespace,
'autoload' => $autoload,
'autoload_delay' => $autoload_delay,
'page_load_chat_once' => $page_load_chat_once,
'page_load_chat_urls' => $page_load_chat_urls,
'page_load_chat_message' => $page_load_chat_message,
'page_exit_chat' => $page_exit_chat,
'page_exit_chat_once' => $page_exit_chat_once,
'page_exit_chat_urls' => $page_exit_chat_urls,
'page_exit_chat_message' => $page_exit_chat_message,
'page_scroll_chat' => $page_scroll_chat,
'page_scroll_chat_percent' => $page_scroll_chat_percent,
'page_scroll_chat_once' => $page_scroll_chat_once,
'page_scroll_chat_urls' => $page_scroll_chat_urls,
'page_scroll_chat_message' => $page_scroll_chat_message,
'page_inactive_chat' => $page_inactive_chat,
'page_inactive_chat_time' => $page_inactive_chat_time,
'page_inactive_chat_once' => $page_inactive_chat_once,
'page_inactive_chat_urls' => $page_inactive_chat_urls,
'page_inactive_chat_message' => $page_inactive_chat_message,
'auto_submit_voice' => $auto_submit_voice,
'send_message_sound' => $send_message_sound,
'receive_message_sound' => $receive_message_sound,
'response_delay' => $response_delay,
'bubble_alignment' => $bubble_alignment,
'bubble_user_alignment' => $bubble_user_alignment,
'avatar_url_user' => $avatar_url_user,
'avatar_url' => $avatar_url,
'show_user_avatar' => $show_user_avatar,
'show_ai_avatar' => $show_ai_avatar,
'markdown_parse' => $markdown_parse,
'is_azure' => $is_azure,
'persistent_guests' => $persistent_guests,
'chat_initial_messages' => $chat_initial_messages,
'chat_editing' => $chat_editing,
'show_gdpr' => $show_gdpr,
'blocked_words' => $blocked_words,
'typewriter_delay' => $typewriter_delay,
'workflows' => $bot_workflow,
'strip_botname' => $strip_botname,
'bots_data' => $bots_data,
'bg_color' => $bg_color,
'mcp_servers' => $mcp_servers
);
wp_localize_script($name . 'openai-chat-ajax', 'aimogen_chat_ajax_object' . $chatid, $custom_vars);
$return_me .= '
';
$return_me .= '';
if (isset($aimogen_Chatbot_Settings['voice_input']) && $aimogen_Chatbot_Settings['voice_input'] == 'on')
{
if(!($prompt_editable == 'no' || $prompt_editable === '0' || $prompt_editable == 'off' || $prompt_editable == 'disabled' || $prompt_editable == 'disable' || $prompt_editable == "false") || $prompt_templates == '')
{
$return_me .= '
';
}
}
if(!empty($assistant_id))
{
$ai_assistant_id = get_post_meta($assistant_id, '_assistant_id', true);
}
else
{
$ai_assistant_id = '';
}
$return_me .= $complete_me;
if($submit_image != '')
{
$submit = ' ';
}
$return_me .= '
' . $submit . ' ';
$return_me .= '
' . $compliance . '
';
if(!empty($custom_footer))
{
$return_me .= '';
}
if(!empty($custom_css))
{
$return_me .= '