'', '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'; $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_the_user_ip(); } 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 = '
' . $invite_msg . '
×
'; } $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 .= '
' . $custom_header . '
'; } $return_me .= '
' . $avatar_src . '
' . esc_html(trim($ai_message_preppend, ': ')) . '
' . esc_html($ai_role) . '
'; $return_me .= '
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)) { $return_me .= '
'; if($bubble_alignment != 'right' && !empty($avatar_url) && $show_ai_avatar == 'show') { $return_me .= '
'; } $return_me .= '
' . $fm[0] . '
'; if($bubble_alignment == 'right' && !empty($avatar_url) && $show_ai_avatar == 'show') { $return_me .= '
'; } $return_me .= '
'; } array_shift($fm); if(count($fm) > 0) { $complete_me .= ''; } } $return_me .= '
'; $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($persistent === 'history' && $assistant_id == '') { $conversation_data = array(); $user_id = get_current_user_id(); if($user_id == 0 && ($persistent_guests == 'on' || $persistent_guests == '1')) { $user_id = aimogen_get_the_user_ip(); } if($user_id != 0) { if(is_numeric($user_id)) { $conversation_data = get_user_meta($user_id, 'aimogen_chat_history_' . $persistent, true); if(!is_array($conversation_data)) { $conversation_data = array(); } else { uasort($conversation_data, function ($a, $b) { return $b['time'] <=> $a['time']; }); } } else { $conversation_data = get_transient('aimogen_chat_history_' . $persistent . '_' . $user_id); if(!is_array($conversation_data)) { $conversation_data = array(); } else { uasort($conversation_data, function ($a, $b) { return $b['time'] <=> $a['time']; }); } } } if($user_id !== 0) { $return_me .= ' '; $return_me .= '
'; $return_me .= '
' . esc_html__("Start a new chat", 'aimogen') . '
'; $conversations_by_date = array(); foreach($conversation_data as $cnvid => $cnvd) { if(isset($cnvd['name']) && isset($cnvd['main_index'])) { if($cnvd['main_index'] === $chat_unique_id) { $conv_timestamp = isset($cnvd['time']) ? intval($cnvd['time']) : null; if ($conv_timestamp) { $date_group = aimogen_get_date_group($conv_timestamp); $group_label = $date_group['label']; $group_order = $date_group['order']; if (!isset($conversations_by_date[$group_label])) { $conversations_by_date[$group_label] = array('order' => $group_order, 'conversations' => array()); } $conversations_by_date[$group_label]['conversations'][$cnvid] = $cnvd; } } } } uasort($conversations_by_date, function($a, $b) { return $a['order'] - $b['order']; }); foreach($conversations_by_date as $date_label => $data) { $return_me .= '
' . esc_html($date_label) . '
'; $conversations = $data['conversations']; uasort($conversations, function($a, $b) { $time_a = isset($a['time']) ? intval($a['time']) : 0; $time_b = isset($b['time']) ? intval($b['time']) : 0; return $time_b - $time_a; }); foreach($conversations as $cnvid => $cnvd) { $return_me .= '
' . esc_html($cnvd['name']) . 'X
'; } } $return_me .= '
'; } } if (isset($aimogen_Chatbot_Settings['allow_stream_stop']) && $aimogen_Chatbot_Settings['allow_stream_stop'] == 'on') { $return_me .= ''; } if($prompt_templates != '') { $predefined_prompts_arr = explode(';', $prompt_templates); $return_me .= ''; } if($model == 'default' || $model == '') { $return_me .= ''; } if($temp == 'default' || $temp == '') { $return_me .= ''; } if($top_p == 'default' || $top_p == '') { $return_me .= ''; } if($presence == 'default' || $presence == '') { $return_me .= ''; } if($frequency == 'default' || $frequency == '') { $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 = '' . esc_html($submit) . ''; } $return_me .= ' '; $return_me .= '
 
' . $compliance . '
'; if(!empty($custom_footer)) { $return_me .= ''; } if(!empty($custom_css)) { $return_me .= '' . $custom_css . ''; } if (isset($aimogen_Chatbot_Settings['show_gdpr']) && $aimogen_Chatbot_Settings['show_gdpr'] == 'on') { $privacy_url = '/privacy-policy'; if(function_exists('get_privacy_policy_url')) { $privacy_url = get_privacy_policy_url(); if(empty($privacy_url)) { $privacy_url = '/privacy-policy'; } } $gdpr_button = 'Start chatting'; if (isset($aimogen_Chatbot_Settings['gdpr_button']) && $aimogen_Chatbot_Settings['gdpr_button'] != '') { $gdpr_button = $aimogen_Chatbot_Settings['gdpr_button']; } $gdpr_checkbox = 'I agree to the terms.'; if (isset($aimogen_Chatbot_Settings['gdpr_checkbox']) && $aimogen_Chatbot_Settings['gdpr_checkbox'] != '') { $gdpr_checkbox = $aimogen_Chatbot_Settings['gdpr_checkbox']; } $gdpr_notice = 'By using this chatbot, you consent to the collection and use of your data as outlined in our Privacy Policy. Your data will only be used to assist with your inquiry.'; if (isset($aimogen_Chatbot_Settings['gdpr_notice']) && $aimogen_Chatbot_Settings['gdpr_notice'] != '') { $gdpr_notice = $aimogen_Chatbot_Settings['gdpr_notice']; } $gdpr_notice = str_replace('%%privacy_policy_url%%', $privacy_url, $gdpr_notice); $return_me .= '

' . wp_kses_post($gdpr_notice) . '

'; } $return_me .= ' '; } $return_me .= ''; return $return_me; } ?>