| @@ -1,7 +1,35 @@ | ||
| 1 | 1 | jQuery(function ($) { |
| 2 | 2 | |
| 3 | 3 | $(document).ready(function () { |
| 4 | + var wpChatbotTabSections = { | |
| 5 | + started: '#section-flip-1', | |
| 6 | + general: '#section-flip-2', | |
| 7 | + themes: '#section-flip-3', | |
| 8 | + social: '#section-flip-51', | |
| 9 | + language: '#section-flip-5', | |
| 10 | + support: '#section-flip-4', | |
| 11 | + startmenu: '#section-flip-6', | |
| 12 | + ai: '#section-flip-7', | |
| 13 | + rpl: '#section-flip-9', | |
| 14 | + custom_css: '#section-flip-13' | |
| 15 | + }; | |
| 16 | + | |
| 17 | + function wpChatbotShowTabSection(tabData, fallbackIndex, sectionSelector) { | |
| 18 | + $(".content-wrap section").removeClass('content-current'); | |
| 19 | + | |
| 20 | + if (sectionSelector) { | |
| 21 | + $(sectionSelector).addClass('content-current'); | |
| 22 | + return; | |
| 23 | + } | |
| 24 | + | |
| 25 | + if (wpChatbotTabSections[tabData]) { | |
| 26 | + $(wpChatbotTabSections[tabData]).addClass('content-current'); | |
| 27 | + return; | |
| 28 | + } | |
| 29 | + | |
| 30 | + $(".content-wrap section").eq(fallbackIndex).addClass('content-current'); | |
| 31 | + } | |
| 4 | 32 | |
| 5 | 33 | var sbdstoredNoticeId = localStorage.getItem('qcld_wpbot_Notice_set'); |
| 6 | 34 | var qcld_chatbot_Notice_time_set = localStorage.getItem('qcld_wpbot_Notice_time_set'); |
| 7 | 35 | var notice_current_time = Math.round(new Date().getTime() / 1000); |
| @@ -26,10 +54,8 @@ | ||
| 26 | 54 | }); |
| 27 | 55 | |
| 28 | 56 | if(localStorage.getItem('tabData')){ |
| 29 | 57 | |
| 30 | - $(".content-wrap section").removeClass('content-current'); | |
| 31 | - | |
| 32 | 58 | $(".wp-chatbot-tabs nav ul li").each(function (index, elm) { |
| 33 | 59 | |
| 34 | 60 | if(localStorage.getItem('tabData')==$(this).attr('tab-data')){ |
| 35 | 61 | |
| @@ -34,9 +60,9 @@ | ||
| 34 | 60 | if(localStorage.getItem('tabData')==$(this).attr('tab-data')){ |
| 35 | 61 | |
| 36 | 62 | $(this).addClass('tab-current'); |
| 37 | 63 | |
| 38 | - $(".content-wrap section").eq(index).addClass('content-current'); | |
| 64 | + wpChatbotShowTabSection($(this).attr('tab-data'), index, $(this).attr('data-section')); | |
| 39 | 65 | |
| 40 | 66 | }else{ |
| 41 | 67 | |
| 42 | 68 | $(this).removeClass('tab-current'); |
| @@ -58,15 +84,13 @@ | ||
| 58 | 84 | // Remove others tab and contents |
| 59 | 85 | |
| 60 | 86 | $(".wp-chatbot-tabs nav ul li").removeClass('tab-current'); |
| 61 | 87 | |
| 62 | - $(".content-wrap section").removeClass('content-current'); | |
| 63 | - | |
| 64 | 88 | // add current tab and contents |
| 65 | 89 | |
| 66 | 90 | $(this).parent().addClass('tab-current'); |
| 67 | 91 | |
| 68 | - $(".content-wrap section").eq($(".wp-chatbot-tabs nav ul li a ").index(this)).addClass('content-current'); | |
| 92 | + wpChatbotShowTabSection($(this).parent().attr('tab-data'), $(".wp-chatbot-tabs nav ul li a ").index(this), $(this).parent().attr('data-section')); | |
| 69 | 93 | |
| 70 | 94 | //Change action url , set add localStorge and url change. |
| 71 | 95 | |
| 72 | 96 | $('#wp-chatbot-admin-form').attr('action',$(this).attr('href')); |
| @@ -214,9 +238,9 @@ | ||
| 214 | 238 | '<p class="qc-opt-dcs-font qc-opt-dcs-font-faq">FAQ Query </p>'+ |
| 215 | 239 | |
| 216 | 240 | '<input type="text" class="form-control" name="support_query[]" placeholder="FAQ Query">'+ |
| 217 | 241 | |
| 218 | - '<p class="qc-opt-dcs-font"><br><strong>Support answer</strong></p>'+ | |
| 242 | + '<p class="qc-opt-dcs-font"><br><strong>FAQ answer</strong></p>'+ | |
| 219 | 243 | |
| 220 | 244 | '<textarea id="'+textarea_id+'" name="support_ans[]" class="form-control chatbot-query-builder" cols="30" rows="2"></textarea>'+ |
| 221 | 245 | |
| 222 | 246 | '</div>'+ |
| @@ -1067,9 +1091,9 @@ | ||
| 1067 | 1091 | drop: function(event, ui) { |
| 1068 | 1092 | var droppable = $(this); |
| 1069 | 1093 | var draggable = ui.draggable; |
| 1070 | 1094 | // Move draggable into droppable |
| 1071 | - draggable.clone().removeClass("qc_draggable_item").addClass("qc_draggable_item_remove").appendTo(droppable); | |
| 1095 | + draggable.clone().removeClass("qc_draggable_item").addClass("qc_draggable_item_remove").removeAttr("style").appendTo(droppable); | |
| 1072 | 1096 | jQuery('#qc_wpbot_menu_order').val(jQuery('#qc_menu_area').html().trim()); |
| 1073 | 1097 | } |
| 1074 | 1098 | }); |
| 1075 | 1099 | $('#wp_chatbot_floatingiconbg_color, #wp_chatbot_text_color, #wp_chatbot_link_color,#wp_chatbot_link_hover_color,#wp_chatbot_bot_msg_bg_color,#wp_chatbot_bot_msg_text_color,#wp_chatbot_user_msg_bg_color,#wp_chatbot_header_background_color,#wp_chatbot_user_msg_text_color,#wp_chatbot_buttons_bg_color,#wp_chatbot_buttons_text_color,#wp_chatbot_theme_primary_color,#wp_chatbot_theme_secondary_color').wpColorPicker(); |
| @@ -1393,8 +1417,19 @@ | ||
| 1393 | 1417 | var openai_post_type = $("input[name='site_search_posttypes[]']:checked").map(function () { |
| 1394 | 1418 | return this.value; |
| 1395 | 1419 | }).get(); |
| 1396 | 1420 | |
| 1421 | + Swal.fire({ | |
| 1422 | + html: '<div class="qcld-save-settings-spinner"></div>', | |
| 1423 | + allowOutsideClick: false, | |
| 1424 | + allowEscapeKey: false, | |
| 1425 | + showConfirmButton: false, | |
| 1426 | + background: 'transparent', | |
| 1427 | + customClass: { | |
| 1428 | + popup: 'qcld-swal-loading-only' | |
| 1429 | + } | |
| 1430 | + }); | |
| 1431 | + | |
| 1397 | 1432 | $.ajax({ |
| 1398 | 1433 | url: qcld_gemini_admin_data.ajax_url, |
| 1399 | 1434 | type:'POST', |
| 1400 | 1435 | data: ({action : 'openai_settings_option',nonce: qcld_gemini_admin_data.ajax_nonce,api_key: api_key,openai_engines:openai_engines,qcld_openai_prompt: qcld_openai_prompt,max_tokens:max_tokens,file_id:file_id,temperature:temperature,presence_penalty:presence_penalty,frequency_penalty:frequency_penalty,qcld_openai_prompt_custom: qcld_openai_prompt_custom,openai_exclude_keyword:openai_exclude_keyword,is_relevant_enabled:is_relevant_enabled,openai_include_keyword:openai_include_keyword,ai_enabled:is_ai_enabled,is_page_suggestion_enabled:is_page_suggestion_enabled,is_context_awareness_enabled:is_context_awareness_enabled,qcld_openai_system_content:qcld_openai_system_content,qcld_openai_append_content:qcld_openai_append_content,ai_only_mode: is_ai_only_mode,conversation_continuity:conversation_continuity,openai_post_type:openai_post_type,is_page_rag_enabled:is_page_rag_enabled,is_stream_enabled:is_stream_enabled}), |
| @@ -1499,13 +1534,17 @@ | ||
| 1499 | 1534 | }) //Additional Code - 04-12-2023 ends here |
| 1500 | 1535 | } |
| 1501 | 1536 | var settingsRag = document.getElementById("save_rag_setting"); |
| 1502 | 1537 | if (settingsRag) { |
| 1538 | + $('.qcl-openai').on('change', '.rag_auto_sync_enabled', function () { | |
| 1539 | + $('.rag_auto_sync_enabled').prop('checked', this.checked); | |
| 1540 | + }); | |
| 1541 | + | |
| 1503 | 1542 | $('.qcl-openai').on('click', '#save_rag_setting', function () { |
| 1504 | 1543 | |
| 1505 | 1544 | var rag_embed_pages = $('#rag_embed_pages').is(':checked') ? 1 : 0; |
| 1506 | 1545 | var rag_embed_posts = $('#rag_embed_posts').is(':checked') ? 1 : 0; |
| 1507 | - var rag_auto_sync_enabled = $('#rag_auto_sync_enabled').is(':checked') ? 1 : 0; | |
| 1546 | + var rag_auto_sync_enabled = $('.rag_auto_sync_enabled').first().is(':checked') ? 1 : 0; | |
| 1508 | 1547 | var rag_embed_str = $('#rag_embed_str').is(':checked') ? 1 : 0; |
| 1509 | 1548 | |
| 1510 | 1549 | var rag_embed_cpts = []; |
| 1511 | 1550 | $('.rag_embed_cpts_checkbox:checked').each(function() { |
| @@ -1561,9 +1600,9 @@ | ||
| 1561 | 1600 | btn.text('Saving settings...'); |
| 1562 | 1601 | |
| 1563 | 1602 | var rag_embed_pages = $('#rag_embed_pages').is(':checked') ? 1 : 0; |
| 1564 | 1603 | var rag_embed_posts = $('#rag_embed_posts').is(':checked') ? 1 : 0; |
| 1565 | - var rag_auto_sync_enabled = $('#rag_auto_sync_enabled').is(':checked') ? 1 : 0; | |
| 1604 | + var rag_auto_sync_enabled = $('.rag_auto_sync_enabled').first().is(':checked') ? 1 : 0; | |
| 1566 | 1605 | var rag_embed_str = $('#rag_embed_str').is(':checked') ? 1 : 0; |
| 1567 | 1606 | |
| 1568 | 1607 | var rag_embed_cpts = []; |
| 1569 | 1608 | $('.rag_embed_cpts_checkbox:checked').each(function() { |