| 1 |
<div class="row g-0"> |
| 2 |
<div class="col-sm-6"> |
| 3 |
<div class="form-check form-switch my-4"> |
| 4 |
<input class="form-check-input" type="checkbox" <?php |
| 5 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 6 |
echo (get_option( 'ai_enabled') == 1) ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="is_ai_enabled"> |
| 7 |
<label class="form-check-label" for="is_ai_enabled"> |
| 8 |
<?php esc_html_e( 'Enable OpenAI','chatbot'); ?> |
| 9 |
</label> |
| 10 |
<span style="color:red"> <?php esc_html_e( '(if you want results from OpenAI only, disable Site Search from Settings->Start Menu)','chatbot'); ?></span> |
| 11 |
</div> |
| 12 |
</div> |
| 13 |
<div class="col-sm-6"> |
| 14 |
<div class="mb-3"> |
| 15 |
<div class="form-check form-switch my-4"> |
| 16 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'is_stream_enabled', '1' ) == '1' ) ? esc_attr( 'checked', 'chatbot' ) : ''; ?> role="switch" value="" id="is_stream_enabled"> |
| 17 |
<label class="form-check-label" for="is_stream_enabled"> |
| 18 |
<?php esc_html_e( 'Enable Streaming ', 'chatbot' ); ?> |
| 19 |
</label> |
| 20 |
<span> <?php esc_html_e( '(stream AI responses in real-time as they are generated)', 'chatbot' ); ?></span> |
| 21 |
|
| 22 |
</div> |
| 23 |
</div> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
<div class="row g-0"> |
| 27 |
<div class="col-sm-12"> |
| 28 |
<!-- /POST TYPE --> |
| 29 |
<div class="mb-3 form-check"> |
| 30 |
<label for="api_key" class="form-label"><?php esc_html_e( 'Api key','chatbot');?></label> |
| 31 |
<input type="password" class="form-control" id="api_key" name="api_key" placeholder="Api key" value="<?php echo esc_attr(get_option( 'open_ai_api_key')); ?>"> |
| 32 |
<span><?php esc_html_e('Get your API key from','chatbot'); ?> <a href="https://platform.openai.com/settings/organization/api-keys" target="_blank"><?php esc_html_e('HERE','chatbot'); ?></a></span><br> |
| 33 |
<span style="color:red"><?php esc_html_e('It requires a paid OpenAI API plan', 'chatbot'); ?> </span> |
| 34 |
</div> |
| 35 |
<div class="mb-3 form-check"> |
| 36 |
<label for="qcld_openai_system_content"><?php esc_attr_e( 'System Command (Use it to Instruct ChatGPT how to behave). You can write a detailed prompt here that includes details about your services, products, and how to contact you or anything relevant to get','chatbot');?> <span class="qcls_openAI_customized"><?php esc_attr_e( 'Customized Results','chatbot');?></span> <?php esc_attr_e( '. Upto 3000 words is fine.','chatbot');?> |
| 37 |
|
| 38 |
<br><br> |
| 39 |
|
| 40 |
</label> |
| 41 |
<textarea type="text" class="form-control" id="qcld_openai_system_content" placeholder="<?php echo esc_attr('You are a helpful and intelligent assistant for the website "' . site_url() . '". Use live website data and the provided context to respond accurately and briefly. Stay relevant and do not introduce additional topics.','chatbot'); ?>"><?php echo esc_html( get_option( 'qcld_openai_system_content')); ?></textarea> |
| 42 |
<label><small><?php esc_html_e("To set the ChatBot's tone and character set a system message according to your need",'chatbot'); ?></small></label></br> |
| 43 |
<label><small><?php esc_html_e("Example: You are a helpful and intelligent assistant for the website " . site_url() . ". Use live website data and the provided context to respond accurately and briefly. Stay relevant and do not introduce additional topics.",'chatbot'); ?></small></label> |
| 44 |
</div> |
| 45 |
<div class="form-check form-switch my-4"> |
| 46 |
<input class="form-check-input" type="checkbox" <?php echo (get_option('context_awareness_enabled') == '1') ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="is_context_awareness_enabled"> |
| 47 |
<label class="form-check-label" for="is_context_awareness_enabled"> |
| 48 |
<?php esc_html_e( 'Context awareness','chatbot'); ?> |
| 49 |
</label> |
| 50 |
|
| 51 |
</div> |
| 52 |
<div class="form-check form-switch my-4"> |
| 53 |
<input class="form-check-input" type="checkbox" <?php echo (get_option('page_suggestion_enabled') == '1') ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="is_page_suggestion_enabled"> |
| 54 |
<label class="form-check-label" for="is_page_suggestion_enabled"> |
| 55 |
<?php esc_html_e( 'Enable WordPress page suggestions with GPT Results (the links are suggested by WordPress and not AI)','chatbot'); ?> |
| 56 |
</label> |
| 57 |
</div> |
| 58 |
|
| 59 |
<!-- POST TYPE --> |
| 60 |
<div class="form-check form-switch my-4"> |
| 61 |
<label><?php esc_html_e( 'Select POST TYPE(s) to include with search results', 'chatbot' ); ?></label> |
| 62 |
<div id="wp-chatbot-post-converter"> |
| 63 |
<ul class="checkbox-list"> |
| 64 |
<?php |
| 65 |
$get_cpt_args = array( |
| 66 |
'public' => true, |
| 67 |
); |
| 68 |
$post_types = get_post_types( $get_cpt_args, 'object' ); |
| 69 |
|
| 70 |
foreach ($post_types as $post_type) { |
| 71 |
if ($post_type->name != 'attachment') { |
| 72 |
$is_pro = !in_array($post_type->name, ['post', 'page']); |
| 73 |
?> |
| 74 |
<div class="form-check form-check-inline"> |
| 75 |
<input |
| 76 |
id="site_search_posttypes_<?php echo esc_html( $post_type->name ); ?>" |
| 77 |
type="checkbox" |
| 78 |
name="site_search_posttypes[]" |
| 79 |
value="<?php echo esc_html( $post_type->name ); ?>" |
| 80 |
<?php echo (($is_pro) ? 'disabled' : ''); ?> |
| 81 |
|
| 82 |
<?php echo ((get_option('qcld_openai_relevant_post') != '') && in_array($post_type->name, get_option('qcld_openai_relevant_post'))) ? 'checked' : ''; ?>> |
| 83 |
<label class="form-check-label <?php echo ($is_pro ? 'pro-locked' : ''); ?>" for="site_search_posttypes_<?php echo esc_html( $post_type->name ); ?>"> |
| 84 |
<?php echo esc_html( $post_type->name ); ?> |
| 85 |
<?php if ($is_pro) { ?> |
| 86 |
<span class="pro-badge">PRO</span> |
| 87 |
<?php } ?> |
| 88 |
</label> |
| 89 |
</div> |
| 90 |
<?php |
| 91 |
} |
| 92 |
} |
| 93 |
?> |
| 94 |
</ul> |
| 95 |
</div> |
| 96 |
</div> |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
<div class="qcld-wpbot-pricing-filter-form-check"> |
| 102 |
</div> |
| 103 |
<div class="mb-3 form-check"> |
| 104 |
<label for="max_tokens" id="openai_engines" class="form-label"><?php esc_html_e( 'OpenAI Model','chatbot');?></label> |
| 105 |
<select class="form-select" aria-label="Default select example" name="openai_engines" id="openai_engines"> |
| 106 |
<option value="gpt-5.5" <?php echo ((get_option( 'openai_engines') == 'gpt-5.5') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5.5','chatbot');?></option> |
| 107 |
<option value="gpt-5.4-mini" <?php echo ((get_option( 'openai_engines') == 'gpt-5.4-mini') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5.4-Mini','chatbot');?></option> |
| 108 |
<option value="gpt-5.4-nano" <?php echo ((get_option( 'openai_engines') == 'gpt-5.4-nano') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5.4-Nano','chatbot');?></option> |
| 109 |
<option value="gpt-5-mini" <?php echo ((get_option( 'openai_engines') == 'gpt-5-mini') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5-Mini','chatbot');?></option> |
| 110 |
<option value="gpt-5-nano" <?php echo ((get_option( 'openai_engines') == 'gpt-5-nano') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5-Nano','chatbot');?></option> |
| 111 |
<option value="gpt-5" <?php echo ((get_option( 'openai_engines') == 'gpt-5') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-5','chatbot');?></option> |
| 112 |
<option value="gpt-4.1-mini" <?php echo ((get_option( 'openai_engines') == 'gpt-4.1-mini') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4.1-Mini','chatbot');?></option> |
| 113 |
<option value="gpt-4.1-nano" <?php echo ((get_option( 'openai_engines') == 'gpt-4.1-nano') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4.1-Nano','chatbot');?></option> |
| 114 |
<option value="gpt-4.1" <?php echo ((get_option( 'openai_engines') == 'gpt-4.1') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4.1','chatbot');?></option> |
| 115 |
<option value="gpt-4o-mini" <?php echo ((get_option( 'openai_engines') == 'gpt-4o-mini') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4o-Mini','chatbot');?></option> |
| 116 |
<option value="gpt-4o" <?php echo ((get_option( 'openai_engines') == 'gpt-4o') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4o','chatbot');?></option> |
| 117 |
<option value="gpt-4-turbo" <?php echo ((get_option( 'openai_engines') == 'gpt-4-turbo') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'gpt-4-turbo','chatbot');?></option> |
| 118 |
<option value="gpt-4" <?php echo ((get_option( 'openai_engines') == 'gpt-4') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-4','chatbot');?></option> |
| 119 |
<option value="gpt-3.5-turbo" <?php echo ((get_option( 'openai_engines') == 'gpt-3.5-turbo') ? esc_attr('selected') : '') ; ?>><?php esc_html_e( 'GPT-3 turbo','chatbot'); ?></option> |
| 120 |
</select> |
| 121 |
</div> |
| 122 |
|
| 123 |
|
| 124 |
<div class="mb-3 form-check"> |
| 125 |
<label for="qcld_openai_append_content"><?php esc_attr_e( 'Prompt to be Appended at the End of the User Query (Optional)','chatbot');?></label> |
| 126 |
<textarea type="text" class="form-control" id="qcld_openai_append_content" placeholder="<?php echo esc_attr('Content for the response'); ?>"><?php echo esc_html( get_option( 'qcld_openai_append_content')); ?></textarea> |
| 127 |
|
| 128 |
</div> |
| 129 |
<div class="alert alert-warning"> |
| 130 |
<p> <?php echo esc_html('Danger Zone (you may not get any responses from AI if the keywords are not set properly. Remove keywords if you face problems )'); ?></p> |
| 131 |
</div> |
| 132 |
<div class="mb-3 form-check"> |
| 133 |
<label for="qcld_openai_include_keyword"><?php esc_attr_e( 'Connect to OpenAI only when user query includes one of the following Comma Separated Keywords','chatbot');?></label> |
| 134 |
<textarea type="text" class="form-control" id="qcld_openai_include_keyword"><?php echo esc_attr( get_option( 'openai_include_keyword')); ?></textarea> |
| 135 |
</div> |
| 136 |
<div class="mb-3 form-check"> |
| 137 |
<label for="qcld_openai_exclude_keyword"><?php esc_attr_e( 'Connect to OpenAI only when user query does NOT include one of the following Comma Separated Keywords','chatbot');?></label> |
| 138 |
<textarea type="text" class="form-control" id="qcld_openai_exclude_keyword"><?php echo esc_attr( get_option( 'openai_exclude_keyword')); ?></textarea> |
| 139 |
</div> |
| 140 |
<div class="mb-3"> |
| 141 |
<div class="form-check form-switch my-4"> |
| 142 |
<input class="form-check-input" type="checkbox" <?php echo (get_option( 'qcld_openai_relevant_enabled') == 1) ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="is_relevant_enabled"> |
| 143 |
<label class="form-check-label" for="is_relevant_enabled"> |
| 144 |
<?php esc_html_e( 'Ask OpenAI to reply when question is relevant to above Keywords (Enabling this option will improve accuracy but it will use OpenAI Tokens)','chatbot'); ?> |
| 145 |
</label> |
| 146 |
</div> |
| 147 |
</div> |
| 148 |
|
| 149 |
|
| 150 |
<div class="mb-3"> |
| 151 |
<a class="btn btn-success" id="save_setting"><?php esc_html_e( 'Save settings','chatbot');?></a> |
| 152 |
</div> |
| 153 |
</br> |
| 154 |
<div class="mb-3 form-check"> |
| 155 |
<a class="btn btn-warning" id="qcld_check_connection"><?php esc_html_e( 'Check Connection ','chatbot');?><i class="dashicons dashicons-image-rotate" id="rotationloader"></i></a> <?php echo esc_html('Save the Settings first and then press the Check Connection button'); ?><br/> |
| 156 |
<div id="qcld_openAI_trubleshooter"></div> |
| 157 |
</div> |
| 158 |
<div class="alert alert-danger"> |
| 159 |
<p> <?php echo esc_html('**If OpenAI is not responding back and the bot is just loading, then likely you hit your OpenAI usage limit. Please pre-purchase credit to use OpenAI API and increase the Usage limit. You can add credits to your API account by visiting the '); ?> <a href="https://platform.openai.com/account/billing"><?php echo esc_html('billing page.'); ?></a></p> |
| 160 |
<p> |
| 161 |
<a href="https://wpbot.pro/docs/knowledgebase/how-to-save-money-and-reduce-openai-api-cost-for-your-chatbot/"> <?php echo esc_html('How to reduce cost '); ?></a><?php echo esc_html('and save money on OpenAI API cost for your ChatBot.'); ?> |
| 162 |
</p> |
| 163 |
</div> |
| 164 |
</div> |
| 165 |
</div> |
| 166 |
|