| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 3 |
/** |
| 4 |
* AI Admin Template |
| 5 |
* |
| 6 |
* @package Botmaster |
| 7 |
* @since 14.8.2 |
| 8 |
*/ |
| 9 |
?> |
| 10 |
|
| 11 |
<div class="card-body p-sm-0"> |
| 12 |
|
| 13 |
<ul class="nav nav-tabs"> |
| 14 |
<li class="active"><a data-toggle="tab" href="#wp-chatbot-grok-settings"><?php echo esc_html__( 'Grok AI settings', 'chatbot'); ?></a></li> |
| 15 |
<li><a data-toggle="tab" href="#wp-chatbot-grok-help"><?php echo esc_html__( 'Grok AI Help', 'chatbot'); ?></a></li> |
| 16 |
</ul> |
| 17 |
|
| 18 |
<div class="tab-content"> |
| 19 |
<div id="wp-chatbot-grok-settings" class="tab-pane in active"> |
| 20 |
<div class="col-sm-12"> |
| 21 |
<div class="row gx-0"> |
| 22 |
<div class="mb-3"> |
| 23 |
<div class="form-check form-switch my-4"> |
| 24 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_grok_enabled' ) == 1 ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_grok_enabled"> |
| 25 |
<label class="form-check-label" for="qcld_grok_enabled"> |
| 26 |
<?php esc_html_e( 'Enable Grok AI', 'chatbot'); ?><span style="color:red"> <?php esc_html_e( '(if you want results from grok only, disable Site Search from Settings->Start Menu)', 'chatbot'); ?></span> |
| 27 |
</label> |
| 28 |
</div> |
| 29 |
</div> |
| 30 |
</div> |
| 31 |
<div class="row gx-0"> |
| 32 |
<div class="mb-3"> |
| 33 |
<div class="form-check form-switch my-4"> |
| 34 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_grok_page_suggestion_enabled' ) == '1' ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_grok_page_suggestion_enabled"> |
| 35 |
<label class="form-check-label" for="qcld_grok_page_suggestion_enabled"> |
| 36 |
<?php esc_html_e( 'Enable page suggestions with grok Result', 'chatbot'); ?> |
| 37 |
</label> |
| 38 |
</div> |
| 39 |
<!-- POST TYPE --> |
| 40 |
<div class="form-check form-switch my-4"> |
| 41 |
<label><?php esc_html_e( 'Select POST TYPE(s) to include with search results', 'chatbot'); ?></label> |
| 42 |
<div id="wp-chatbot-post-converter"> |
| 43 |
<ul class="checkbox-list"> |
| 44 |
<?php |
| 45 |
$get_cpt_args = array( |
| 46 |
'public' => true, |
| 47 |
); |
| 48 |
$post_types = get_post_types( $get_cpt_args, 'object' ); |
| 49 |
foreach ( $post_types as $post_type ) { |
| 50 |
if ( $post_type->name != 'attachment' ) { |
| 51 |
?> |
| 52 |
<div class="form-check form-check-inline"> |
| 53 |
<input |
| 54 |
id="site_grok_search_posttypes_<?php echo esc_attr( $post_type->name ); ?>" |
| 55 |
type="checkbox" |
| 56 |
name="site_grok_search_posttypes[]" |
| 57 |
value="<?php echo esc_attr( $post_type->name ); ?>" <?php echo ( ( get_option( 'qcld_openai_relevant_post' ) != '' ) && in_array( $post_type->name, get_option( 'qcld_openai_relevant_post' ) ) ) ? 'checked' : ''; ?>> |
| 58 |
<label class="form-check-label" for="site_grok_search_posttypes_<?php echo esc_attr( $post_type->name ); ?>"> <?php echo esc_html( $post_type->name ); ?></label> |
| 59 |
</div> |
| 60 |
<?php |
| 61 |
} |
| 62 |
} |
| 63 |
?> |
| 64 |
</ul> |
| 65 |
</div> |
| 66 |
</div> |
| 67 |
<!-- /POST TYPE --> |
| 68 |
</div> |
| 69 |
</div> |
| 70 |
<div class="row gx-0"> |
| 71 |
<div class="form-group mb-3"> |
| 72 |
<label for="qcld_grok_api_key" class="form-label"><?php esc_html_e( 'Grok API Key', 'chatbot'); ?></label> |
| 73 |
<input type="password" class="form-control" id="qcld_grok_api_key" name="qcld_grok_api_key" placeholder="Enter your Grok API Key" value="<?php echo esc_attr( get_option( 'qcld_grok_api_key' ) ); ?>"> |
| 74 |
<small class="form-text text-muted"><?php esc_html_e( 'Get your API key from https://grok.ai/settings/keys', 'chatbot'); ?></br><span style="color:red"><?php esc_html_e('It requires a paid Grok API plan', 'chatbot'); ?> </span></small> |
| 75 |
</div> |
| 76 |
</div> |
| 77 |
|
| 78 |
<div class="row g-0"> |
| 79 |
<div class="gx-0"> |
| 80 |
<div class="form-group mb-3"> |
| 81 |
<label for="qcld_grok_system_content"><?php esc_attr_e( 'System Command or Prompt for RAG and OpenAI Direct (Use it to Instruct ChatGPT how to behave)', 'chatbot'); ?></label> |
| 82 |
<textarea type="text" rows="5" class="form-control" id="qcld_grok_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.' ); ?>"><?php echo esc_html( get_option( 'qcld_grok_system_content' ) ); ?></textarea><br> |
| 83 |
<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> |
| 84 |
<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> |
| 85 |
</div> |
| 86 |
</div> |
| 87 |
<div class="form-group mb-3"> |
| 88 |
<a class="btn btn-success" id="qcld_save_grok_setting"><?php esc_html_e( 'Save settings', 'chatbot'); ?></a> |
| 89 |
</div> |
| 90 |
</div> |
| 91 |
</div> |
| 92 |
</div> |
| 93 |
<div id="wp-chatbot-grok-help" class="tab-pane"> |
| 94 |
<?php |
| 95 |
require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/integration/grok/admin/help.php'; |
| 96 |
?> |
| 97 |
</div> |
| 98 |
<div id="wp-chatbot-grok-rag" class="tab-pane"> |
| 99 |
<?php |
| 100 |
// require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/integration/grok/admin/rag-manager.php'; |
| 101 |
?> |
| 102 |
</div> |
| 103 |
</div> |
| 104 |
</div> |
| 105 |
|
| 106 |
|
| 107 |
|