| @@ -1,108 +1,124 @@ | ||
| 1 | - | |
| 2 | -<div class="qcl-openai"> | |
| 3 | - <div class="row gx-0"> | |
| 4 | - <div class="col-xs-12"> | |
| 5 | - <div class="card admin-maxwith qcld-openai-main-box"> | |
| 6 | - <div class="card-header bg-dark text-white py-sm-4 border-0">> | |
| 7 | - | |
| 8 | - <div class="row"> | |
| 9 | - <div class="col-auto me-auto"> | |
| 10 | - <h4><?php | |
| 11 | -if (!defined('ABSPATH')) exit; // Exit if accessed directly | |
| 12 | -esc_html_e( 'OpenAI Settings','chatbot');?></h4> | |
| 13 | - </div> | |
| 14 | - </div> | |
| 15 | - </div> | |
| 16 | - <div class="card-body p-sm-0"> | |
| 17 | - <!-- <div class="alert alert-danger" role="alert"> | |
| 18 | - <?php // echo esc_html__('OpenAI has disabled some of the older models. Please use GPT 3.5 or 4 to Fine tune. You need to update the dataset and Fine tune again. Please check the Help section for details.', 'chatbot'); ?> | |
| 19 | - </div> --> | |
| 20 | - <ul class="nav nav-tabs"> | |
| 21 | - <li class="active"><a data-toggle="tab" href="#wp-chatbot-openai-settings"><i class="dashicons dashicons-admin-generic"></i><?php echo esc_html__('OpenAI settings', 'chatbot'); ?></a></li> | |
| 22 | - <li><a data-toggle="tab" href="#wp-chatbot-openai-training-model"><i class="dashicons dashicons-plugins-checked"></i> <?php echo esc_html__('Training Model', 'chatbot'); ?></a></li> | |
| 23 | - <li><a data-toggle="tab" href="#wp-chatbot-openai-assistants"> <i class="dashicons dashicons-admin-home"></i><?php echo esc_html__('GPT Assistant', 'chatbot'); ?></a></li> | |
| 24 | - <li><a data-toggle="tab" href="#wp-chatbot-data_post_converter"><i class="dashicons dashicons-database-add"></i><?php echo esc_html__('Fine Tune with Website Data', 'chatbot'); ?></a></li> | |
| 25 | - <li><a data-toggle="tab" href="#wp-chatbot-img_generator"><i class="dashicons dashicons-format-gallery"></i><?php echo esc_html__('AI Image Generator', 'chatbot'); ?></a></li> | |
| 26 | - <li><a data-toggle="tab" href="#wp-chatbot-content_writer"><i class="dashicons dashicons-format-status"></i><?php echo esc_html__('AI Article Generator', 'chatbot'); ?></a></li> | |
| 27 | - <li><a data-toggle="tab" href="#wp-chatbot-openai-help"><i class="dashicons dashicons-editor-help"></i> <?php echo esc_html__('Help', 'chatbot'); ?></a></li> | |
| 28 | - </ul> | |
| 29 | - <div class="tab-content"> | |
| 30 | - <div id="wp-chatbot-openai-settings" class="tab-pane in active"> | |
| 31 | - <?php require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/settings.php'); ?> | |
| 32 | - </div> | |
| 33 | - <div id="wp-chatbot-openai-training-model" class="tab-pane"> | |
| 34 | - <?php | |
| 35 | - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/files.php'); | |
| 36 | - ?> | |
| 37 | - </div> | |
| 38 | - <div id="wp-chatbot-openai-assistants" class="tab-pane"> | |
| 39 | - <?php | |
| 40 | - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/assistant.php'); | |
| 41 | - ?> | |
| 42 | - </div> | |
| 43 | - <div id="wp-chatbot-data_post_converter" class="tab-pane"> | |
| 44 | - <?php | |
| 45 | - require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/data_post_converter.php'); | |
| 46 | - ?> | |
| 47 | - </div> | |
| 48 | - <div id="wp-chatbot-img_generator" class="tab-pane"> | |
| 49 | - <div class="row"> | |
| 50 | - <div class="col-xs-12"> | |
| 51 | - <?php require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/img_generator.php' ); ?> | |
| 52 | - </div> | |
| 53 | - </div> | |
| 54 | - </div> | |
| 55 | - <div id="wp-chatbot-content_writer" class="tab-pane"> | |
| 56 | - <div class="row"> | |
| 57 | - <div class="col-xs-12"> | |
| 58 | - <?php require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/content_writer.php' ); ?> | |
| 59 | - </div> | |
| 60 | - </div> | |
| 61 | - </div> | |
| 62 | - <div id="wp-chatbot-openai-help" class="tab-pane"> | |
| 63 | - <?php require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/help.php' ); ?> | |
| 64 | - </div> | |
| 65 | - </div> | |
| 66 | - </div> | |
| 67 | - <div class="card-footer bg-dark text-white py-sm-4 border-0"></div> | |
| 68 | - </div> | |
| 69 | - </div> | |
| 70 | - </div> | |
| 71 | -</div> | |
| 72 | - | |
| 73 | - | |
| 74 | -<style> | |
| 75 | - | |
| 76 | -div#promotion-wpchatbot { | |
| 77 | - margin: 0; | |
| 78 | - padding: 0; | |
| 79 | - border: none; | |
| 80 | - max-width: initial !important; | |
| 81 | - padding: 0 !important; | |
| 82 | - margin: 20px 20px 20px 0 !important; | |
| 83 | - padding: 15px 15px 15px 0 !important; | |
| 84 | - border: none !important; | |
| 85 | - border-radius: 6px !important; | |
| 86 | - box-shadow: 0px 4px 6px 1px #ebebeb !important; | |
| 87 | -} | |
| 88 | - | |
| 89 | - | |
| 90 | -.qc-review-notice{ | |
| 91 | - max-width: initial !important; | |
| 92 | - padding: 0 !important; | |
| 93 | - margin: 20px 20px 20px 0 !important; | |
| 94 | - padding: 15px 15px 15px 0 !important; | |
| 95 | - border: none !important; | |
| 96 | - border-radius: 6px !important; | |
| 97 | - box-shadow: 0px 4px 6px 1px #ebebeb !important; | |
| 98 | - background: #fff; | |
| 99 | - color: #000; | |
| 100 | -} | |
| 101 | - | |
| 102 | -.qc-review-text h3 { | |
| 103 | - color: #000000; | |
| 104 | -} | |
| 105 | -.qc-review-text p { | |
| 106 | - color: #000000; | |
| 107 | -} | |
| 108 | -</style> | |
| 1 | +<div class="qcl-openai"> | |
| 2 | + <div class="row gx-0"> | |
| 3 | + <div class="col-xs-12"> | |
| 4 | + | |
| 5 | + <div class="card admin-maxwith"> | |
| 6 | + <div class="card-header bg-dark text-white py-sm-4 border-0"> | |
| 7 | + <div class="row"> | |
| 8 | + <div class="col-auto me-auto"> | |
| 9 | + <h4><?php esc_html_e( 'Open AI Settings','openai_addon');?></h4> | |
| 10 | + </div> | |
| 11 | + <div class="col-auto"> | |
| 12 | + <!-- <img class="img-fluid" src="<?php //echo esc_url(QCLD_openai_addon_PLUGIN_URL.'image/logo.jpg'); ?>"/> --> | |
| 13 | + </div> | |
| 14 | + </div> | |
| 15 | + </div> | |
| 16 | + <div class="card-body p-sm-0"> | |
| 17 | + <ul class="nav nav-tabs"> | |
| 18 | + <li class="active"><a data-toggle="tab" href="#wp-chatbot-openai-settings"><?php echo esc_html__('Open AI settings', 'wpchatbot'); ?></a></li> | |
| 19 | + <li><a data-toggle="tab" href="#wp-chatbot-openai-training-model"><?php echo esc_html__('Training Model', 'wpchatbot'); ?></a></li> | |
| 20 | + <li><a data-toggle="tab" href="#wp-chatbot-openai-help"><?php echo esc_html__('Open AI Help', 'wpchatbot'); ?></a></li> | |
| 21 | + </ul> | |
| 22 | + <div class="tab-content"> | |
| 23 | + <div id="wp-chatbot-openai-settings" class="tab-pane fade in active"> | |
| 24 | + <div class="row g-0"> | |
| 25 | + <div class="col-sm-10"> | |
| 26 | + <div class="form-check form-switch my-4"> | |
| 27 | + <input class="form-check-input" type="checkbox" <?php echo (get_option( 'ai_enabled') == 1) ? 'checked' :'';?> role="switch" value="" id="is_ai_enabled"> | |
| 28 | + <label class="form-check-label" for="is_ai_enabled"> | |
| 29 | + <?php esc_html_e( 'Enable Open AI','openai_addon');?> | |
| 30 | + </label> | |
| 31 | + </div> | |
| 32 | + <div class="form-check form-switch my-4"> | |
| 33 | + <input class="form-check-input" type="checkbox" <?php echo (get_option( 'ai_only_mode') == 1) ? 'checked' :'';?> role="switch" value="" id="is_ai_only_mode"> | |
| 34 | + <label class="form-check-label" for="is_ai_only_mode"> | |
| 35 | + <?php esc_html_e( 'Enable OpenAI only mode and hide other chatBot features','openai_addon');?> | |
| 36 | + </label> | |
| 37 | + </div> | |
| 38 | + <div class="mb-3"> | |
| 39 | + <label for="api_key" class="form-label"><?php esc_html_e( 'Api key','openai_addon');?></label> | |
| 40 | + <input type="text" class="form-control" id="api_key" name="api_key" placeholder="Api key" value="<?php echo get_option( 'open_ai_api_key'); ?>"> | |
| 41 | + </div> | |
| 42 | + <div class="mb-3"> | |
| 43 | + <label for="max_tokens" class="form-label"><?php esc_html_e( 'Max tokens (0-4000) Depending on the model','openai_addon');?></label> | |
| 44 | + <input id="max_tokens" class="form-control" type="text" name="max_tokens" value="<?php echo get_option( 'openai_max_tokens'); ?>"> | |
| 45 | + </div> | |
| 46 | + <div class="mb-3"> | |
| 47 | + <div class="row gx-0"><div class="col-8"><label for="temperature" class="form-label"><?php esc_html_e( 'Temperature','openai_addon');?></label></div><div class="col-4 me-auto text-end"><span name="temperatureout" id="temperatureout" ><?php echo get_option( 'openai_temperature'); ?></span></div></div> | |
| 48 | + <input id="temperature" type="range" class="form-range" min="0" max="1" step="0.01" name="temperature" value="<?php echo get_option( 'openai_temperature'); ?>" onchange="updateTemp(this.value);" /> | |
| 49 | + <label class="mb-3"><small><?php esc_html_e( 'Temperature is a value between 0 and 1 that essentially lets you control how confident the model should be when making these predictions','openai_addon');?></small></label> | |
| 50 | + <span name="temperatureout" id="temperatureout" ><?php // echo get_option( 'openai_temperature'); ?></span> | |
| 51 | + </div> | |
| 52 | + <div class="mb-3"> | |
| 53 | + <div class="row gx-0"><div class="col-8"><label for="presence_penalty" class="form-label"><?php esc_html_e( 'Presence Penalty','openai_addon');?></label></div><div class="col-4 me-auto text-end"><span id="presence_penalty_out" ><?php echo get_option( 'presence_penalty'); ?></span></div></div> | |
| 54 | + <input id="presence_penalty" type="range" class="form-range" min="-2" max="2" step="0.1" name="presence_penalty" value="<?php echo get_option( 'presence_penalty'); ?>"> | |
| 55 | + <p class="mb-3"><small><?php esc_html_e( 'Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model’s likelihood to talk about new topics.','openai_addon');?></small></p> | |
| 56 | + </div> | |
| 57 | + <div class="mb-3"> | |
| 58 | + <div class="row gx-0"><div class="col-8"><label for="frequency_penalty" class="form-label"><?php esc_html_e( 'Frequency penalty','openai_addon');?></label></div><div class="col-4 me-auto text-end"><span id="frequency_penalty_out" ><?php echo get_option( 'frequency_penalty'); ?></span></div></div> | |
| 59 | + <input id="frequency_penalty" type="range" class="form-range" min="-2" max="2" step="0.1" name="frequency_penalty" value="<?php echo get_option( 'frequency_penalty'); ?>"> | |
| 60 | + <label><small><?php esc_html_e( 'Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model’s likelihood to repeat the same line verbatim.','openai_addon','openai_addon');?></small></label> | |
| 61 | + </div> | |
| 62 | + | |
| 63 | + <div class="mb-3"> | |
| 64 | + <label for="max_tokens" id="openai_engines" class="form-label"><?php esc_html_e( 'Open AI model','openai_addon');?></label> | |
| 65 | + <select class="form-select" aria-label="Default select example" name="openai_engines" id="openai_engines"> | |
| 66 | + <option <?php echo ((get_option( 'openai_engines') == '') ? 'selected' : '') ; ?>><?php esc_html_e( 'Please select Engines','openai_addon');?></option> | |
| 67 | + <option value="text-davinci-003" <?php echo ((get_option( 'openai_engines') == 'text-davinci-003') ? 'selected' : '') ; ?>><?php esc_html_e( 'Davinci (GPT-3 model)','openai_addon');?></option> | |
| 68 | + <option value="text-davinci-001" <?php echo ((get_option( 'openai_engines') == 'text-davinci-001') ? 'selected' : '') ; ?>><?php esc_html_e( 'Davinci','openai_addon');?></option> | |
| 69 | + <option value="text-ada-001" <?php echo ((get_option( 'openai_engines') == 'text-ada-001') ? 'selected' : '') ; ?>><?php esc_html_e( 'Ada','openai_addon');?></option> | |
| 70 | + <option value="text-curie-001" <?php echo ((get_option( 'openai_engines') == 'text-curie-001') ? 'selected' : '') ; ?>><?php esc_html_e( 'Curie','openai_addon');?></option> | |
| 71 | + <option value="text-babbage-001" <?php echo ((get_option( 'openai_engines') == 'text-babbage-001') ? 'selected' : '' ); ?>><?php esc_html_e( 'Babbag','openai_addon');?></option> | |
| 72 | + </select> | |
| 73 | + </div> | |
| 74 | + <div class="mb-3"> | |
| 75 | + <label for="qcld_openai_custom_model" class="form-label"><?php esc_html_e( 'Custom Fine Tuned Model','openai_addon');?></label> | |
| 76 | + <input id="qcld_openai_custom_model" class="form-control" type="text" name="qcld_openai_custom_model" value="<?php echo get_option( 'qcld_openai_custom_model'); ?>"> | |
| 77 | + <label><small><?php esc_html_e( 'Pick your custom model from fine tune list','openai_addon','openai_addon');?></small></label> | |
| 78 | + </div> | |
| 79 | + <div class="mb-3"> | |
| 80 | + <label for="qcld_openai_suffix" class="form-label"><?php esc_html_e( 'Suffix for custom model','openai_addon');?></label> | |
| 81 | + <input id="qcld_openai_suffix" class="form-control" type="text" name="qcld_openai_suffix" value="<?php echo get_option( 'qcld_openai_suffix'); ?>"> | |
| 82 | + </div> | |
| 83 | + <div class="mb-3"> | |
| 84 | + | |
| 85 | + <label for="qcld_openai_prompt" class="form-label"><?php esc_html_e( 'Select Prompt','openai_addon');?></label> | |
| 86 | + <select class="form-select" aria-label="Default select example" name="qcld_openai_prompt" id="qcld_openai_prompt"> | |
| 87 | + <option <?php echo ((get_option( 'qcld_openai_prompt') == '') ? 'selected' : '') ; ?>><?php esc_html_e( 'Please select prompt','openai_addon');?></option> | |
| 88 | + <option value="q_and_a" <?php echo ((get_option( 'qcld_openai_prompt') == 'q_and_a') ? 'selected' : '') ; ?>><?php esc_html_e( 'Q & A','openai_addon');?></option> | |
| 89 | + <option value="chat" <?php echo ((get_option( 'qcld_openai_prompt') == 'chat') ? 'selected' : '') ; ?>><?php esc_html_e( 'Chat','openai_addon');?></option> | |
| 90 | + <option value="friend_chat" <?php echo ((get_option( 'qcld_openai_prompt') == 'friend_chat') ? 'selected' : '') ; ?>><?php esc_html_e( 'Friend Chat','openai_addon');?></option> | |
| 91 | + <option value="grammar_correction" <?php echo ((get_option( 'qcld_openai_prompt') == 'grammar_correction') ? 'selected' : '') ; ?>><?php esc_html_e( 'Grammar correction','openai_addon');?></option> | |
| 92 | + <option value="marv_sarcastic_chatbot" <?php echo ((get_option( 'qcld_openai_prompt') == 'marv_sarcastic_chatbot') ? 'selected' : '') ; ?>><?php esc_html_e( 'Marv the sarcastic chat bot','openai_addon');?></option> | |
| 93 | + <option value="micro_horror" <?php echo ((get_option( 'qcld_openai_prompt') == 'micro_horror') ? 'selected' : '') ; ?>><?php esc_html_e( 'Two-Sentence Horror Story:','openai_addon');?></option> | |
| 94 | + <option value="write_poem" <?php echo ((get_option( 'qcld_openai_prompt') == 'write_poem') ? 'selected' : '') ; ?>><?php esc_html_e( 'Write a poem (in English)','openai_addon');?></option> | |
| 95 | + <option value="translated_qa" <?php echo ((get_option( 'qcld_openai_prompt') == 'translated_qa') ? 'selected' : '') ; ?>><?php esc_html_e( 'Translated Question Answer on your site language','openai_addon');?></option> | |
| 96 | + <option value="any_command" <?php echo ((get_option( 'qcld_openai_prompt') == 'any_command') ? 'selected' : '') ; ?>><?php esc_html_e( 'Any command','openai_addon');?></option> | |
| 97 | + <option value="custom_prompt" <?php echo ((get_option( 'qcld_openai_prompt') == 'custom_prompt') ? 'selected' : '') ; ?>><?php esc_html_e( 'Custom prompt will be appended before the user`s queries','openai_addon');?></option> | |
| 98 | + </select> | |
| 99 | + <div id="custom_prompt_wrapper"> | |
| 100 | + <input type="hidden" id="custom_promt_value" value="<?php echo get_option('qcld_openai_prompt_custom'); ?>"/> | |
| 101 | + </div> | |
| 102 | + <p class="mb-3"><small><?php esc_html_e( 'Please Select a prompt. The default value of the prompt is Q&A','openai_addon');?></small></p> | |
| 103 | + </div> | |
| 104 | + | |
| 105 | + <a class="btn btn-success" id="save_setting"><?php esc_html_e( 'Save settings','openai_addon');?></a> | |
| 106 | + </div> | |
| 107 | + </div> | |
| 108 | + </div> | |
| 109 | + <div id="wp-chatbot-openai-training-model" class="tab-pane fade"> | |
| 110 | + <?php | |
| 111 | + | |
| 112 | + require_once(QCLD_wpCHATBOT_PLUGIN_DIR_PATH . 'includes/openai/admin/files.php'); | |
| 113 | + ?> | |
| 114 | + </div> | |
| 115 | + <div id="wp-chatbot-openai-help" class="tab-pane fade"> | |
| 116 | + <?php require_once( 'help.php' ); ?> | |
| 117 | + </div> | |
| 118 | + </div> | |
| 119 | + <div class="card-footer bg-dark text-white py-sm-4 border-0"></div> | |
| 120 | + </div> | |
| 121 | + </div> | |
| 122 | + </div> | |
| 123 | +</div> | |
| 124 | + | |