| 1 |
<?php |
| 2 |
/** |
| 3 |
* AI Admin Template |
| 4 |
* |
| 5 |
* @package Botmaster |
| 6 |
* @since 14.8.2 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; // Exit if accessed directly. |
| 11 |
} |
| 12 |
?> |
| 13 |
|
| 14 |
<div class="card-header bg-dark text-white py-sm-4 border-0"> |
| 15 |
<div class="row"> |
| 16 |
<div class="col-auto me-auto"> |
| 17 |
<h4><?php esc_html_e( 'Claude AI Settings', 'chatbot' ); ?></h4> |
| 18 |
</div> |
| 19 |
</div> |
| 20 |
</div> |
| 21 |
<div class="card-body p-sm-0"> |
| 22 |
|
| 23 |
<ul class="nav nav-tabs"> |
| 24 |
<li class="active"><a data-toggle="tab" href="#wp-chatbot-claude-settings"><?php echo esc_html__( 'Claude AI settings', 'chatbot' ); ?></a></li> |
| 25 |
<li><a data-toggle="tab" href="#wp-chatbot-claude-help"><?php echo esc_html__( 'Claude AI Help', 'chatbot' ); ?></a></li> |
| 26 |
</ul> |
| 27 |
|
| 28 |
<div class="tab-content"> |
| 29 |
<div id="wp-chatbot-claude-settings" class="tab-pane in active"> |
| 30 |
<div class="row gx-0"> |
| 31 |
<div class="mb-3"> |
| 32 |
<div class="form-check form-switch my-4"> |
| 33 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_claude_enabled' ) == 1 ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_claude_enabled"> |
| 34 |
<label class="form-check-label" for="qcld_claude_enabled"> |
| 35 |
<?php esc_html_e( 'Enable Claude AI', 'chatbot' ); ?><span style="color:red"> <?php esc_html_e( '(if you want results from claude only, disable Site Search from Settings->Start Menu)', 'chatbot' ); ?></span> |
| 36 |
</label> |
| 37 |
</div> |
| 38 |
</div> |
| 39 |
</div> |
| 40 |
|
| 41 |
<div class="row gx-0"> |
| 42 |
<div class="mb-3"> |
| 43 |
<div class="form-check form-switch my-4"> |
| 44 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_claude_stream_enabled' ) == 1 ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_claude_stream_enabled"> |
| 45 |
<label class="form-check-label" for="qcld_claude_stream_enabled"> |
| 46 |
<?php esc_html_e( 'Enable Streaming', 'chatbot' ); ?> |
| 47 |
</label> |
| 48 |
</div> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
|
| 52 |
<div class="row gx-0"> |
| 53 |
<div class="mb-3"> |
| 54 |
<div class="form-check form-switch my-4"> |
| 55 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_claude_rag_enabled' ) == 1 ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_claude_rag_enabled"> |
| 56 |
<label class="form-check-label" for="qcld_claude_rag_enabled"> |
| 57 |
<?php esc_html_e( 'Enable Claude RAG', 'chatbot' ); ?> |
| 58 |
</label> |
| 59 |
</div> |
| 60 |
</div> |
| 61 |
</div> |
| 62 |
<div class="row gx-0"> |
| 63 |
<div class="mb-3"> |
| 64 |
<div class="form-check form-switch my-4"> |
| 65 |
<input class="form-check-input" type="checkbox" <?php echo ( get_option( 'qcld_claude_page_suggestion_enabled' ) == '1' ) ? esc_attr( 'checked' ) : ''; ?> role="switch" value="" id="qcld_claude_page_suggestion_enabled"> |
| 66 |
<label class="form-check-label" for="qcld_claude_page_suggestion_enabled"> |
| 67 |
<?php esc_html_e( 'Enable page suggestions with claude Result', 'chatbot' ); ?> |
| 68 |
</label> |
| 69 |
</div> |
| 70 |
<!-- POST TYPE --> |
| 71 |
<div class="form-check form-switch my-4"> |
| 72 |
<label><?php esc_html_e( 'Select POST TYPE(s) to include with search results', 'chatbot' ); ?></label> |
| 73 |
<div id="wp-chatbot-post-converter"> |
| 74 |
<ul class="checkbox-list"> |
| 75 |
<?php |
| 76 |
$get_cpt_args = array( |
| 77 |
'public' => true, |
| 78 |
); |
| 79 |
$post_types = get_post_types( $get_cpt_args, 'object' ); |
| 80 |
foreach ( $post_types as $post_type ) { |
| 81 |
if ( $post_type->name != 'attachment' ) { |
| 82 |
?> |
| 83 |
<div class="form-check form-check-inline"> |
| 84 |
<input |
| 85 |
id="site_claude_search_posttypes_<?php echo esc_attr( $post_type->name ); ?>" |
| 86 |
type="checkbox" |
| 87 |
name="site_claude_search_posttypes[]" |
| 88 |
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' : ''; ?>> |
| 89 |
<label class="form-check-label" for="site_claude_search_posttypes_<?php echo esc_attr( $post_type->name ); ?>"> <?php echo esc_html( $post_type->name ); ?></label> |
| 90 |
</div> |
| 91 |
<?php |
| 92 |
} |
| 93 |
} |
| 94 |
?> |
| 95 |
</ul> |
| 96 |
</div> |
| 97 |
</div> |
| 98 |
<!-- /POST TYPE --> |
| 99 |
</div> |
| 100 |
</div> |
| 101 |
<div class="row gx-0"> |
| 102 |
<div class="form-group mb-3"> |
| 103 |
<label for="qcld_claude_api_key" class="form-label"><?php esc_html_e( 'Claude API Key', 'chatbot' ); ?></label> |
| 104 |
<div class="input-group"> |
| 105 |
<input type="password" class="form-control" id="qcld_claude_api_key" name="qcld_claude_api_key" placeholder="Enter your Claude API Key" value="<?php echo esc_attr( get_option( 'qcld_claude_api_key' ) ); ?>"> |
| 106 |
</div> |
| 107 |
<small class="form-text text-muted"><?php esc_html_e( 'Get your API key from https://console.anthropic.com/', 'chatbot' ); ?> </small> |
| 108 |
</div> |
| 109 |
</div> |
| 110 |
<div class="row gx-0"> |
| 111 |
<div class="form-group mb-3"> |
| 112 |
<label for="qcld_voyage_api_key" class="form-label"><?php esc_html_e( 'Voyage AI API Key (Required for RAG)', 'chatbot' ); ?></label> |
| 113 |
<div class="input-group"> |
| 114 |
<input type="password" class="form-control" id="qcld_voyage_api_key" name="qcld_voyage_api_key" placeholder="Enter your Voyage AI API Key" value="<?php echo esc_attr( get_option( 'qcld_voyage_api_key' ) ); ?>"> |
| 115 |
</div> |
| 116 |
<small class="form-text text-muted"><?php esc_html_e( 'Anthropic uses Voyage AI for embeddings. Get your Voyage API key from https://dash.voyageai.com/api-keys to use RAG with Claude.', 'chatbot' ); ?> </small> |
| 117 |
</div> |
| 118 |
</div> |
| 119 |
<div class="row gx-0"> |
| 120 |
<div class="form-group mb-3"> |
| 121 |
<label for="qcld_claude_model" class="form-label"><?php esc_html_e( 'Select Claude Model', 'chatbot' ); ?></label> |
| 122 |
<select class="form-control" id="qcld_claude_model" name="qcld_claude_model"> |
| 123 |
<?php |
| 124 |
$models = array( |
| 125 |
'claude-fable-5' => 'Claude Fable 5', |
| 126 |
'claude-opus-4-8' => 'Claude Opus 4.8', |
| 127 |
'claude-opus-4-7' => 'Claude Opus 4.7', |
| 128 |
'claude-sonnet-4-6' => 'Claude Sonnet 4.6 (Latest Sonnet)', |
| 129 |
'claude-opus-4-6' => 'Claude Opus 4.6', |
| 130 |
'claude-haiku-4-5-20251001' => 'Claude Haiku 4.5', |
| 131 |
'claude-sonnet-4-5-20250929' => 'Claude Sonnet 4.5', |
| 132 |
); |
| 133 |
$current_model = get_option( 'qcld_claude_model' ); |
| 134 |
if($current_model == 'claude-3-opus-latest') { |
| 135 |
$current_model = 'claude-3-opus-20240229'; |
| 136 |
} |
| 137 |
foreach($models as $key => $val) { |
| 138 |
$selected = ($key == $current_model) ? 'selected' : ''; |
| 139 |
echo '<option value="' . esc_attr( $key ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $val ) . '</option>'; |
| 140 |
} |
| 141 |
?> |
| 142 |
</select> |
| 143 |
</div> |
| 144 |
</div> |
| 145 |
<div class="row g-0"> |
| 146 |
<div class="gx-0"> |
| 147 |
<div class="form-group mb-3"> |
| 148 |
<label for="qcld_claude_system_content" class="form-label"><?php esc_html_e( 'System Content for Claude (Optional)', 'chatbot' ); ?></label> |
| 149 |
<textarea rows="5" class="form-control" id="qcld_claude_system_content" name="qcld_claude_system_content" placeholder="Content for the response"><?php echo esc_textarea( get_option( 'qcld_claude_system_content' ) ); ?></textarea> |
| 150 |
</div> |
| 151 |
</div> |
| 152 |
<div class="gx-0"> |
| 153 |
<div class="form-group mb-3"> |
| 154 |
<label for="qcld_claude_prepend_content" class="form-label"><?php esc_html_e( 'Your Prompt to be Added before the User Query for Customized Results (Optional)', 'chatbot' ); ?></label> |
| 155 |
<textarea rows="5" class="form-control" id="qcld_claude_prepend_content" name="qcld_claude_prepend_content" placeholder="Content for the response"><?php echo esc_textarea( get_option( 'qcld_claude_prepend_content' ) ); ?></textarea> |
| 156 |
|
| 157 |
</div> |
| 158 |
</div> |
| 159 |
<div class="gx-0"> |
| 160 |
<div class="form-group mb-3"> |
| 161 |
<label for="qcld_claude_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> |
| 162 |
<textarea rows="5" class="form-control" id="qcld_claude_append_content" name="qcld_claude_append_content" placeholder="Content for the response"><?php echo esc_textarea( get_option( 'qcld_claude_append_content' ) ); ?></textarea> |
| 163 |
|
| 164 |
</div> |
| 165 |
</div> |
| 166 |
<div class="form-group mb-3"> |
| 167 |
<a class="btn btn-success" id="qcld_save_claude_setting"><?php esc_html_e( 'Save settings', 'chatbot' ); ?></a> |
| 168 |
</div> |
| 169 |
</div> |
| 170 |
</div> |
| 171 |
<div id="wp-chatbot-claude-help" class="tab-pane"> |
| 172 |
<?php |
| 173 |
require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/integration/claude/admin/help.php'; |
| 174 |
?> |
| 175 |
</div> |
| 176 |
<div id="wp-chatbot-claude-rag" class="tab-pane"> |
| 177 |
<?php |
| 178 |
require_once QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/integration/claude/admin/rag-manager.php'; |
| 179 |
?> |
| 180 |
</div> |
| 181 |
</div> |
| 182 |
</div> |
| 183 |
|