| 1 |
|
| 2 |
|
| 3 |
<div class="card-body p-sm-0"> |
| 4 |
|
| 5 |
<ul class="nav nav-tabs"> |
| 6 |
<li class="active"><a data-toggle="tab" href="#wp-chatbot-openrouter-settings"><i class="fa fa-cog"></i><?php echo esc_html__('OpenRouter settings', 'chatbot'); ?></a></li> |
| 7 |
<li><a data-toggle="tab" href="#wp-chatbot-openrouter-help"><i class="fa fa-question-circle"></i><?php echo esc_html__('OpenRouter Help', 'chatbot'); ?></a></li> |
| 8 |
</ul> |
| 9 |
|
| 10 |
<div class="tab-content"> |
| 11 |
<div id="wp-chatbot-openrouter-settings" class="tab-pane in active"> |
| 12 |
<div class="col-sm-12"> |
| 13 |
|
| 14 |
<div class="row gx-0"> |
| 15 |
<div class="mb-3"> |
| 16 |
<div class="form-check form-switch my-4"> |
| 17 |
<input class="form-check-input" type="checkbox" <?php echo (get_option('qcld_openrouter_enabled') == 1) ? esc_attr('checked','chatbot') :'';?> role="switch" value="" id="<?php esc_attr_e('qcld_openrouter_enabled','chatbot'); ?>"> |
| 18 |
<label class="form-check-label" for="<?php esc_attr_e('qcld_openrouter_enabled','chatbot'); ?>"> |
| 19 |
<?php esc_html_e('Enable OpenRouter AI','chatbot'); ?><span style="color:red"> <?php esc_html_e('(if you want results from OpenRouter only, disable Site Search from Settings->Start Menu)','chatbot'); ?></span> |
| 20 |
</label> |
| 21 |
</div> |
| 22 |
</div> |
| 23 |
</div> |
| 24 |
<div class="row gx-0"> |
| 25 |
<div class="form-check form-switch my-4"> |
| 26 |
<input class="form-check-input" type="checkbox" <?php echo (get_option('opnrouter_context_awareness_enabled') == '1') ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="opnrouter_is_context_awareness_enabled"> |
| 27 |
<label class="form-check-label" for="opnrouter_is_context_awareness_enabled"> |
| 28 |
<?php esc_html_e( 'Context awareness','chatbot'); ?> |
| 29 |
</label> |
| 30 |
|
| 31 |
</div> |
| 32 |
</div> |
| 33 |
<div class="row gx-0"> |
| 34 |
<div class="mb-3"> |
| 35 |
<div class="form-check form-switch my-4"> |
| 36 |
<input class="form-check-input" type="checkbox" <?php echo (get_option('qcld_openrouter_page_suggestion_enabled') == '1') ? esc_attr( 'checked','chatbot') :'';?> role="switch" value="" id="qcld_openrouter_page_suggestion_enabled"> |
| 37 |
<label class="form-check-label" for="<?php esc_attr_e( 'qcld_openrouter_page_suggestion_enabled','chatbot'); ?>"> |
| 38 |
<?php esc_html_e( 'Enable page suggestions with OpenRouter Result','chatbot'); ?> |
| 39 |
</label> |
| 40 |
</div> |
| 41 |
|
| 42 |
<!-- POST TYPE --> |
| 43 |
<div class="form-check form-switch my-4"> |
| 44 |
<label><?php esc_html_e( 'Select POST TYPE(s) to include with search results', 'chatbot' ); ?></label> |
| 45 |
<div id="wp-chatbot-post-converter"> |
| 46 |
<ul class="checkbox-list"> |
| 47 |
<?php |
| 48 |
$get_cpt_args = array( |
| 49 |
'public' => true, |
| 50 |
); |
| 51 |
$post_types = get_post_types($get_cpt_args, 'object'); |
| 52 |
foreach ($post_types as $post_type) { |
| 53 |
if ($post_type->name != 'attachment') { |
| 54 |
$is_pro = !in_array($post_type->name, ['post', 'page']); |
| 55 |
?> |
| 56 |
<div class="form-check form-check-inline"> |
| 57 |
<input |
| 58 |
id="site_openrouter_search_posttypes_<?php echo esc_html( $post_type->name ); ?>" |
| 59 |
type="checkbox" |
| 60 |
name="site_openrouter_search_posttypes[]" |
| 61 |
value="<?php echo esc_html( $post_type->name ); ?>" |
| 62 |
<?php echo (($is_pro) ? 'disabled' : ''); ?> |
| 63 |
|
| 64 |
<?php echo ((get_option('qcld_openai_relevant_post') != '') && in_array($post_type->name, get_option('qcld_openai_relevant_post'))) ? 'checked' : ''; ?>> |
| 65 |
<label class="form-check-label <?php echo ($is_pro ? 'pro-locked' : ''); ?>" for="site_openrouter_search_posttypes_<?php echo esc_html( $post_type->name ); ?>"> |
| 66 |
<?php echo esc_html( $post_type->name ); ?> |
| 67 |
<?php if ($is_pro) { ?> |
| 68 |
<span class="pro-badge">Pro</span> |
| 69 |
<?php } ?> |
| 70 |
</label> |
| 71 |
</div> |
| 72 |
<?php |
| 73 |
} |
| 74 |
} |
| 75 |
?> |
| 76 |
</ul> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
<!-- /POST TYPE --> |
| 80 |
|
| 81 |
</div> |
| 82 |
</div> |
| 83 |
<div class="row gx-0"> |
| 84 |
<div class="mb-3 form-check "> |
| 85 |
<label for="qcld_openrouter_api_key" class="form-label"><?php esc_html_e('OpenRouter API Key','chatbot');?></label> |
| 86 |
<input type="password" class="form-control" id="qcld_openrouter_api_key" name="qcld_openrouter_api_key" placeholder="Enter your OpenRouter API Key" value="<?php echo esc_attr(get_option('qcld_openrouter_api_key')); ?>"> |
| 87 |
<small class="form-text text-muted"><?php esc_html_e('Get your API key from https://openrouter.ai/settings/keys','chatbot'); ?></small> |
| 88 |
</div> |
| 89 |
</div> |
| 90 |
<div class="row g-0"> |
| 91 |
<div class="mb-3 form-check "> |
| 92 |
<label for="qcld_openrouter_model" class="form-label"><?php esc_html_e('OpenRouter Model','chatbot');?></label> |
| 93 |
<select id="qcld_openrouter_model" class="form-control" name="qcld_openrouter_model" data-current-model="<?php echo esc_attr(get_option('qcld_openrouter_model')); ?>"> |
| 94 |
<option value=""><?php esc_html_e('Loading models...','chatbot'); ?></option> |
| 95 |
</select> |
| 96 |
<small class="form-text text-muted"><?php esc_html_e('Select a model from OpenRouter','chatbot'); ?></small> |
| 97 |
</div> |
| 98 |
|
| 99 |
<div class="row gx-0"> |
| 100 |
<div class="mb-3 form-check "> |
| 101 |
<label for="qcld_openrouter_prepend_content" class="form-label"><?php esc_html_e('Your Prompt to be Added before the User Query for Customized Results (Optional)','chatbot');?></label> |
| 102 |
<input type="text" class="form-control" id="qcld_openrouter_prepend_content" name="qcld_openrouter_prepend_content" placeholder="Content for the response" value="<?php echo esc_attr( get_option('qcld_openrouter_prepend_content') ); ?>"> |
| 103 |
|
| 104 |
</div> |
| 105 |
</div> |
| 106 |
|
| 107 |
<div class="row gx-0"> |
| 108 |
<div class="mb-3 form-check "> |
| 109 |
<label for="qcld_openrouter_append_content" class="form-label"><?php esc_html_e('Your Prompt to be Appended at the End of the User Query for Customized Results (Optional)','chatbot');?></label> |
| 110 |
<input type="text" class="form-control" id="qcld_openrouter_append_content" name="qcld_openrouter_append_content" placeholder="Content for the response" value="<?php echo esc_attr( get_option('qcld_openrouter_append_content') ); ?>"> |
| 111 |
|
| 112 |
</div> |
| 113 |
</div> |
| 114 |
</div> |
| 115 |
<div class="mb-3"> |
| 116 |
<a class="btn btn-success" id="qcld_save_openrouter_setting"><?php esc_html_e('Save settings','chatbot');?></a> |
| 117 |
</div> |
| 118 |
</div> |
| 119 |
|
| 120 |
|
| 121 |
</div> |
| 122 |
<div id="wp-chatbot-openrouter-help" class="tab-pane"> |
| 123 |
<div class="accordion" id="qcldopenaiaccordion"> |
| 124 |
<div class="card"> |
| 125 |
<div class="card-header" id="panelsStayOpen-headingZero-openrouter"> |
| 126 |
<h2 class="mb-0"> |
| 127 |
<button class="btn btn-link btn-block text-left" type="button" data-toggle="collapse" data-target="#panelsStayOpen-collapseZero-openrouter" aria-expanded="true" aria-controls="panelsStayOpen-collapseZero-openrouter"> |
| 128 |
<?php esc_html_e( 'Getting Started with openrouter','chatbot');?> |
| 129 |
</button> |
| 130 |
</h2> |
| 131 |
</div> |
| 132 |
<div id="panelsStayOpen-collapseZero-openrouter" class="collapse" aria-labelledby="panelsStayOpen-headingZero-openrouter" data-parent="#qcldopenaiaccordion"> |
| 133 |
<div class="card-body-openrouter"> |
| 134 |
<h5><?php esc_html_e( 'OpenRouter is an unified Interface or Aggregator for LLMs. You can choose from hundreds of different AI models from OpenAI to Deepseek or Claude to get AI responses.','chatbot');?></h5> |
| 135 |
<h5><?php esc_html_e( 'All you have to do is add the OpenRouter API Key and select an OpenRouter Model.','chatbot');?></h5> |
| 136 |
<h5><?php esc_html_e( 'Grab your OpenAI API key from','chatbot');?> <a href="https://openrouter.ai/settings/keys">HERE</a></h5> |
| 137 |
<p><?php esc_html_e( 'Please make sure that DialogFlow, OpenAI are Disabled if you want OpenRouter to work.','chatbot');?></p> |
| 138 |
</div> |
| 139 |
</div> |
| 140 |
</div> |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
</div> |
| 145 |
</div> |
| 146 |
</div> |
| 147 |
</div> |