| 1 |
<?php |
| 2 |
return apply_filters( |
| 3 |
'lp/settings/open-ai', |
| 4 |
array_merge( |
| 5 |
apply_filters( |
| 6 |
'learn-press/course-settings-fields/single', |
| 7 |
[ |
| 8 |
[ |
| 9 |
'title' => esc_html__( 'OpenAI', 'learnpress' ), |
| 10 |
'type' => 'title', |
| 11 |
], |
| 12 |
[ |
| 13 |
'title' => esc_html__( 'Enable OpenAI', 'learnpress' ), |
| 14 |
'id' => 'enable_open_ai', |
| 15 |
'default' => 'no', |
| 16 |
'type' => 'checkbox', |
| 17 |
'desc' => esc_html__( 'Enable this option and enter your OpenAI secret key below to activate this feature.', 'learnpress' ), |
| 18 |
], |
| 19 |
[ |
| 20 |
'title' => __( 'Secret Key', 'learnpress' ), |
| 21 |
'id' => 'open_ai_secret_key', |
| 22 |
'default' => '', |
| 23 |
'type' => 'textarea', |
| 24 |
'desc' => sprintf( |
| 25 |
/* translators: 1. profile url */ |
| 26 |
__( |
| 27 |
'Get your OpenAI secret key <a href="%1$s" target="_blank" rel="noopener noreferrer">here</a>. Read the quickstart guide <a href="%2$s" target="_blank" rel="noopener noreferrer">here</a>.', |
| 28 |
'learnpress' |
| 29 |
), |
| 30 |
'https://platform.openai.com/account/api-keys', |
| 31 |
'https://platform.openai.com/docs/quickstart' |
| 32 |
), |
| 33 |
], |
| 34 |
[ |
| 35 |
'title' => __( 'Text Model', 'learnpress' ), |
| 36 |
'id' => 'open_ai_text_model_type', |
| 37 |
'default' => 'gpt-4.1', |
| 38 |
'type' => 'select', |
| 39 |
'options' => array( |
| 40 |
'gpt-5.6' => esc_html__( 'GPT-5.6', 'learnpress' ), |
| 41 |
'gpt-5.5' => esc_html__( 'GPT-5.5', 'learnpress' ), |
| 42 |
'gpt-5.4' => esc_html__( 'GPT-5.4', 'learnpress' ), |
| 43 |
'gpt-5.3' => esc_html__( 'GPT-5.3', 'learnpress' ), |
| 44 |
'gpt-5.2' => esc_html__( 'GPT-5.2', 'learnpress' ), |
| 45 |
'gpt-5.1' => esc_html__( 'GPT-5.1', 'learnpress' ), |
| 46 |
'gpt-5' => esc_html__( 'GPT-5', 'learnpress' ), |
| 47 |
'gpt-5-mini' => esc_html__( 'GPT-5 Mini', 'learnpress' ), |
| 48 |
'gpt-5-nano' => esc_html__( 'GPT-5 Nano', 'learnpress' ), |
| 49 |
'gpt-4.1' => esc_html__( 'GPT-4.1', 'learnpress' ), |
| 50 |
), |
| 51 |
], |
| 52 |
[ |
| 53 |
'title' => __( 'Image Model', 'learnpress' ), |
| 54 |
'id' => 'open_ai_image_model_type', |
| 55 |
'default' => 'gpt-image-1', |
| 56 |
'type' => 'select', |
| 57 |
'options' => array( |
| 58 |
'gpt-image-1' => esc_html__( 'GPT Image 1', 'learnpress' ), |
| 59 |
'gpt-image-2' => esc_html__( 'GPT Image 2', 'learnpress' ), |
| 60 |
), |
| 61 |
], |
| 62 |
[ |
| 63 |
'title' => __( 'Frequency Penalty', 'learnpress' ), |
| 64 |
'id' => 'open_ai_frequency_penalty_level', |
| 65 |
'default' => '0.0', |
| 66 |
'type' => 'select', |
| 67 |
'options' => array( |
| 68 |
'-2.0' => esc_html__( 'Very High Repetition (-2.0)', 'learnpress' ), |
| 69 |
'-1.5' => esc_html__( 'High Repetition (-1.5)', 'learnpress' ), |
| 70 |
'-1.0' => esc_html__( 'Moderate Repetition (-1.0)', 'learnpress' ), |
| 71 |
'-0.5' => esc_html__( 'Low Repetition (-0.5)', 'learnpress' ), |
| 72 |
'0.0' => esc_html__( 'No Penalty (0.0)', 'learnpress' ), |
| 73 |
'0.5' => esc_html__( 'Low Penalty (0.5)', 'learnpress' ), |
| 74 |
'1.0' => esc_html__( 'Moderate Penalty (1.0)', 'learnpress' ), |
| 75 |
'1.5' => esc_html__( 'High Penalty (1.5)', 'learnpress' ), |
| 76 |
'2.0' => esc_html__( 'Very High Penalty (2.0)', 'learnpress' ), |
| 77 |
), |
| 78 |
], |
| 79 |
[ |
| 80 |
'title' => __( 'Presence Penalty', 'learnpress' ), |
| 81 |
'id' => 'open_ai_presence_penalty_level', |
| 82 |
'default' => '0.0', |
| 83 |
'type' => 'select', |
| 84 |
'options' => array( |
| 85 |
'-2.0' => esc_html__( 'Very High Repetition Allowed (-2.0)', 'learnpress' ), |
| 86 |
'-1.5' => esc_html__( 'High Repetition Allowed (-1.5)', 'learnpress' ), |
| 87 |
'-1.0' => esc_html__( 'Moderate Repetition Allowed (-1.0)', 'learnpress' ), |
| 88 |
'-0.5' => esc_html__( 'Low Repetition Allowed (-0.5)', 'learnpress' ), |
| 89 |
'0.0' => esc_html__( 'No Penalty (0.0)', 'learnpress' ), |
| 90 |
'0.5' => esc_html__( 'Low Penalty (0.5)', 'learnpress' ), |
| 91 |
'1.0' => esc_html__( 'Moderate Penalty (1.0)', 'learnpress' ), |
| 92 |
'1.5' => esc_html__( 'High Penalty (1.5)', 'learnpress' ), |
| 93 |
'2.0' => esc_html__( 'Very High Penalty (2.0)', 'learnpress' ), |
| 94 |
), |
| 95 |
], |
| 96 |
[ |
| 97 |
'title' => __( 'Creativity Level', 'learnpress' ), |
| 98 |
'id' => 'open_ai_creativity_level', |
| 99 |
'default' => '1.0', |
| 100 |
'type' => 'select', |
| 101 |
'options' => array( |
| 102 |
'0.0' => esc_html__( 'Very Low Creativity (0.0)', 'learnpress' ), |
| 103 |
'0.2' => esc_html__( 'Low Creativity (0.2)', 'learnpress' ), |
| 104 |
'0.3' => esc_html__( 'Low Creativity (0.3)', 'learnpress' ), |
| 105 |
'0.5' => esc_html__( 'Moderate Creativity (0.5)', 'learnpress' ), |
| 106 |
'0.7' => esc_html__( 'High Creativity (0.7)', 'learnpress' ), |
| 107 |
'0.8' => esc_html__( 'High Creativity (0.8)', 'learnpress' ), |
| 108 |
'1.0' => esc_html__( 'Very High Creativity (1.0)', 'learnpress' ), |
| 109 |
'1.1' => esc_html__( 'Extreme Creativity (1.1)', 'learnpress' ), |
| 110 |
'1.5' => esc_html__( 'Extreme Creativity (1.5)', 'learnpress' ), |
| 111 |
'2.0' => esc_html__( 'Maximum Creativity (2.0)', 'learnpress' ), |
| 112 |
), |
| 113 |
], |
| 114 |
[ |
| 115 |
'title' => __( 'Max Tokens', 'learnpress' ), |
| 116 |
'id' => 'open_ai_max_token', |
| 117 |
'default' => 4000, |
| 118 |
'type' => 'number', |
| 119 |
'desc' => esc_html__( 'Set to 0 for no limit.', 'learnpress' ), |
| 120 |
'custom_attributes' => array( |
| 121 |
'min' => 0, |
| 122 |
'step' => 1, |
| 123 |
), |
| 124 |
], |
| 125 |
[ |
| 126 |
'type' => 'sectionend', |
| 127 |
], |
| 128 |
[ |
| 129 |
'title' => esc_html__( 'AI Assistant', 'learnpress' ), |
| 130 |
'type' => 'title', |
| 131 |
], |
| 132 |
[ |
| 133 |
'title' => esc_html__( 'Enable AI Assistant', 'learnpress' ), |
| 134 |
'id' => 'ai_assistant_enabled', |
| 135 |
'default' => 'no', |
| 136 |
'type' => 'checkbox', |
| 137 |
'desc' => esc_html__( 'Enable the AI Assistant for learners on lesson pages. Requires OpenAI to be enabled and a valid secret key.', 'learnpress' ), |
| 138 |
], |
| 139 |
[ |
| 140 |
'title' => esc_html__( 'Enable Free Chat', 'learnpress' ), |
| 141 |
'id' => 'ai_assistant_free_chat', |
| 142 |
'default' => 'no', |
| 143 |
'type' => 'checkbox', |
| 144 |
'desc' => esc_html__( 'Allow learners to type free-form questions. When disabled, only quick action buttons are shown.', 'learnpress' ), |
| 145 |
], |
| 146 |
[ |
| 147 |
'title' => esc_html__( 'Enable Summarize Lesson', 'learnpress' ), |
| 148 |
'id' => 'ai_assistant_summarize_enabled', |
| 149 |
'default' => 'yes', |
| 150 |
'type' => 'checkbox', |
| 151 |
'desc' => esc_html__( 'Allow learners to use the Summarize Lesson action.', 'learnpress' ), |
| 152 |
], |
| 153 |
[ |
| 154 |
'title' => esc_html__( 'Enable Explain Concept', 'learnpress' ), |
| 155 |
'id' => 'ai_assistant_explain_enabled', |
| 156 |
'default' => 'yes', |
| 157 |
'type' => 'checkbox', |
| 158 |
'desc' => esc_html__( 'Allow learners to use the Explain Concept action.', 'learnpress' ), |
| 159 |
], |
| 160 |
[ |
| 161 |
'title' => esc_html__( 'Enable Quick Quiz', 'learnpress' ), |
| 162 |
'id' => 'ai_assistant_quick_quiz_enabled', |
| 163 |
'default' => 'yes', |
| 164 |
'type' => 'checkbox', |
| 165 |
'desc' => esc_html__( 'Allow learners to start and continue quick quizzes.', 'learnpress' ), |
| 166 |
], |
| 167 |
[ |
| 168 |
'title' => esc_html__( 'Enable Smart Review', 'learnpress' ), |
| 169 |
'id' => 'ai_assistant_smart_review_enabled', |
| 170 |
'default' => 'yes', |
| 171 |
'type' => 'checkbox', |
| 172 |
'desc' => esc_html__( 'Allow learners to use the Smart Review action.', 'learnpress' ), |
| 173 |
], |
| 174 |
[ |
| 175 |
'title' => esc_html__( 'Max Usage Tokens Per Day', 'learnpress' ), |
| 176 |
'id' => 'ai_assistant_max_usage_tokens_per_day', |
| 177 |
'default' => 0, |
| 178 |
'type' => 'number', |
| 179 |
'desc' => esc_html__( 'Maximum total AI tokens each learner can use per day. Set to 0 for no limit.', 'learnpress' ), |
| 180 |
'custom_attributes' => [ |
| 181 |
'min' => 0, |
| 182 |
'step' => 1, |
| 183 |
], |
| 184 |
], |
| 185 |
[ |
| 186 |
'type' => 'sectionend', |
| 187 |
], |
| 188 |
] |
| 189 |
), |
| 190 |
) |
| 191 |
); |
| 192 |
|