new-ai-website-form.php
1 month ago
new-gtrends-website-form.php
1 month ago
new-news-website-form.php
1 month ago
new-own-ai-agent-form.php
1 month ago
new-rss-website-form.php
1 month ago
new-wp-website-form.php
1 month ago
new-own-ai-agent-form.php
1045 lines
| 1 | <?php |
| 2 | |
| 3 | |
| 4 | function autowp_generate_content_prompt($form_data) { |
| 5 | // Genel prompt ayarları |
| 6 | $long_description = isset($form_data['long_description']) ? sanitize_textarea_field($form_data['long_description']) : ''; |
| 7 | $keywordInput = isset($form_data['keywordInput']) ? sanitize_text_field($form_data['keywordInput']) : ''; |
| 8 | $languageSelect = isset($form_data['languageSelect']) ? sanitize_text_field($form_data['languageSelect']) : ''; |
| 9 | $subtitleSelect = isset($form_data['subtitleSelect']) ? intval($form_data['subtitleSelect']) : 1; |
| 10 | $narrationSelect = isset($form_data['narrationSelect']) ? sanitize_text_field($form_data['narrationSelect']) : ''; |
| 11 | $countrySelect = isset($form_data['countrySelect']) ? sanitize_text_field($form_data['countrySelect']) : ''; |
| 12 | |
| 13 | // Toggles for custom tools and knowledge base |
| 14 | $enable_website_tools = isset($form_data['enable_website_tools']) ? '1' : '0'; |
| 15 | $enable_duckduckgo = isset($form_data['enable_duckduckgo']) ? '1' : '0'; |
| 16 | $enable_wikipedia = isset($form_data['enable_wikipedia']) ? '1' : '0'; |
| 17 | $enable_yfinancetools = isset($form_data['enable_yfinancetools']) ? '1' : '0'; |
| 18 | $enable_hackernews = isset($form_data['enable_hackernews']) ? '1' : '0'; |
| 19 | |
| 20 | $enable_pdf_kb = isset($form_data['enable_pdf_kb']) ? '1' : '0'; |
| 21 | $enable_csv_kb = isset($form_data['enable_csv_kb']) ? '1' : '0'; |
| 22 | $enable_text_kb = isset($form_data['enable_text_kb']) ? '1' : '0'; |
| 23 | |
| 24 | // Custom Tools Ayarları |
| 25 | $website_tools_knowledge_base_url = !empty($form_data['website_tools_knowledge_base_url']) |
| 26 | ? sanitize_url($form_data['website_tools_knowledge_base_url']) |
| 27 | : ''; |
| 28 | $duckduckgo_news = isset($form_data['duckduckgo_news']) ? '1' : '0'; |
| 29 | $duckduckgo_fixed_max_results = !empty($form_data['duckduckgo_fixed_max_results']) |
| 30 | ? intval($form_data['duckduckgo_fixed_max_results']) |
| 31 | : null; |
| 32 | $wikipedia_knowledge_base = !empty($form_data['wikipedia_knowledge_base']) |
| 33 | ? sanitize_text_field($form_data['wikipedia_knowledge_base']) |
| 34 | : ''; |
| 35 | |
| 36 | $yfinance_stock_price = isset($form_data['yfinance_stock_price']) ? '1' : '0'; |
| 37 | $yfinance_company_info = isset($form_data['yfinance_company_info']) ? '1' : '0'; |
| 38 | $yfinance_stock_fundamentals = isset($form_data['yfinance_stock_fundamentals']) ? '1' : '0'; |
| 39 | $yfinance_income_statements = isset($form_data['yfinance_income_statements']) ? '1' : '0'; |
| 40 | $yfinance_key_financial_ratios = isset($form_data['yfinance_key_financial_ratios']) ? '1' : '0'; |
| 41 | $yfinance_analyst_recommendations = isset($form_data['yfinance_analyst_recommendations']) ? '1' : '0'; |
| 42 | $yfinance_company_news = isset($form_data['yfinance_company_news']) ? '1' : '0'; |
| 43 | $yfinance_technical_indicators = isset($form_data['yfinance_technical_indicators']) ? '1' : '0'; |
| 44 | $yfinance_historical_prices = isset($form_data['yfinance_historical_prices']) ? '1' : '0'; |
| 45 | |
| 46 | $hackernews_get_top_stories = isset($form_data['hackernews_get_top_stories']) ? '1' : '0'; |
| 47 | $hackernews_get_user_details = isset($form_data['hackernews_get_user_details']) ? '1' : '0'; |
| 48 | |
| 49 | $custom_tools = [ |
| 50 | 'website_tools' => [ |
| 51 | 'knowledge_base_url' => $website_tools_knowledge_base_url, |
| 52 | ], |
| 53 | 'duckduckgo' => [ |
| 54 | 'news' => $duckduckgo_news, |
| 55 | 'fixed_max_results' => $duckduckgo_fixed_max_results, |
| 56 | ], |
| 57 | 'wikipedia' => [ |
| 58 | 'knowledge_base' => $wikipedia_knowledge_base, |
| 59 | ], |
| 60 | 'yfinancetools' => [ |
| 61 | 'stock_price' => $yfinance_stock_price, |
| 62 | 'company_info' => $yfinance_company_info, |
| 63 | 'stock_fundamentals' => $yfinance_stock_fundamentals, |
| 64 | 'income_statements' => $yfinance_income_statements, |
| 65 | 'key_financial_ratios' => $yfinance_key_financial_ratios, |
| 66 | 'analyst_recommendations' => $yfinance_analyst_recommendations, |
| 67 | 'company_news' => $yfinance_company_news, |
| 68 | 'technical_indicators' => $yfinance_technical_indicators, |
| 69 | 'historical_prices' => $yfinance_historical_prices, |
| 70 | ], |
| 71 | 'hackernews' => [ |
| 72 | 'get_top_stories' => $hackernews_get_top_stories, |
| 73 | 'get_user_details' => $hackernews_get_user_details, |
| 74 | ], |
| 75 | ]; |
| 76 | |
| 77 | // Knowledge Base Ayarları |
| 78 | $pdf_url_knowledge_base = !empty($form_data['pdf_url_knowledge_base']) |
| 79 | ? sanitize_url($form_data['pdf_url_knowledge_base']) |
| 80 | : ''; |
| 81 | $csv_url_knowledge_base = !empty($form_data['csv_url_knowledge_base']) |
| 82 | ? sanitize_url($form_data['csv_url_knowledge_base']) |
| 83 | : ''; |
| 84 | $text_knowledge_base = !empty($form_data['text_knowledge_base']) |
| 85 | ? sanitize_textarea_field($form_data['text_knowledge_base']) |
| 86 | : ''; |
| 87 | |
| 88 | $knowledge_base = [ |
| 89 | 'pdf_url' => $pdf_url_knowledge_base, |
| 90 | 'csv_url' => $csv_url_knowledge_base, |
| 91 | 'text' => $text_knowledge_base, |
| 92 | ]; |
| 93 | |
| 94 | // JSON birleşik prompt yapısı |
| 95 | $combined_prompt = [ |
| 96 | 'content' => $long_description, |
| 97 | 'keyword' => $keywordInput, |
| 98 | 'language' => $languageSelect, |
| 99 | 'subheading_count' => $subtitleSelect, |
| 100 | 'writing_style' => $narrationSelect, |
| 101 | 'country' => $countrySelect, |
| 102 | 'custom_tools' => $custom_tools, |
| 103 | 'knowledge_base' => $knowledge_base, |
| 104 | // Toggle değerleri |
| 105 | 'enable_website_tools' => $enable_website_tools, |
| 106 | 'enable_duckduckgo' => $enable_duckduckgo, |
| 107 | 'enable_wikipedia' => $enable_wikipedia, |
| 108 | 'enable_yfinancetools' => $enable_yfinancetools, |
| 109 | 'enable_hackernews' => $enable_hackernews, |
| 110 | 'enable_pdf_kb' => $enable_pdf_kb, |
| 111 | 'enable_csv_kb' => $enable_csv_kb, |
| 112 | 'enable_text_kb' => $enable_text_kb, |
| 113 | ]; |
| 114 | |
| 115 | return json_encode($combined_prompt); |
| 116 | } |
| 117 | |
| 118 | |
| 119 | function autowp_auto_post_agent_form_page_handler() { |
| 120 | global $wpdb; |
| 121 | $table_name = $wpdb->prefix . 'autowp_wordpress_websites'; |
| 122 | |
| 123 | $message = ''; |
| 124 | $notice = ''; |
| 125 | |
| 126 | // Manuel agentic scraper formunda kullanılan alan isimlerine göre varsayılan değerler |
| 127 | $default = array( |
| 128 | 'id' => 0, |
| 129 | 'website_name' => '', |
| 130 | 'website_type' => '', |
| 131 | 'category_id' => '', |
| 132 | 'aigenerated_title' => '', |
| 133 | 'aigenerated_content' => '', |
| 134 | 'aigenerated_tags' => '', |
| 135 | 'aigenerated_image' => '', |
| 136 | 'title_prompt' => '', |
| 137 | 'content_prompt' => '', |
| 138 | 'tags_prompt' => '', |
| 139 | 'image_prompt' => '', |
| 140 | 'image_generating_status' => '', |
| 141 | 'author_selection' => '', |
| 142 | 'active' => '' |
| 143 | |
| 144 | |
| 145 | |
| 146 | ); |
| 147 | |
| 148 | // Dış formdaki nonce değeri kullanılarak kontrol |
| 149 | if ( isset($_REQUEST['nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_REQUEST['nonce'])), basename(__FILE__))) { |
| 150 | |
| 151 | |
| 152 | // Only retrieve the specific values needed |
| 153 | $item = array( |
| 154 | 'id' => isset($_POST['id']) ? intval($_POST['id']) : 0, |
| 155 | 'website_name' => sanitize_text_field($_POST['website_name']), |
| 156 | 'category_id' => isset($_POST['category_id']) ? array_map('intval', $_POST['category_id']) : array(), |
| 157 | 'aigenerated_image' => '1', |
| 158 | 'title_prompt' => sanitize_textarea_field($_POST['title_prompt']), |
| 159 | 'content_prompt' => autowp_generate_content_prompt($_POST), |
| 160 | |
| 161 | 'tags_prompt' => sanitize_textarea_field($_POST['tags_prompt']), |
| 162 | 'image_prompt' => sanitize_textarea_field($_POST['image_prompt']), |
| 163 | 'website_type' => 'agenticscraper', |
| 164 | 'image_generating_status' => sanitize_text_field($_POST['image_generating_status']), |
| 165 | 'author_selection' => sanitize_text_field($_POST['author_selection']), |
| 166 | 'active' => sanitize_text_field(($_POST['active'])) ?? '1' |
| 167 | ); |
| 168 | |
| 169 | |
| 170 | |
| 171 | //Convert category_id array to text |
| 172 | $category_ids = implode(",", $item['category_id']); |
| 173 | $item['category_id'] = $category_ids; |
| 174 | |
| 175 | |
| 176 | $item['aigenerated_title'] = '1'; |
| 177 | $item['aigenerated_content'] = '1'; |
| 178 | $item['aigenerated_tags'] = '1'; |
| 179 | |
| 180 | if($item['aigenerated_image'] !== '1'){ |
| 181 | $item['aigenerated_image'] = '0'; |
| 182 | } |
| 183 | |
| 184 | |
| 185 | $item['website_type'] = 'agenticscraper'; |
| 186 | |
| 187 | // Set WP-CRON |
| 188 | |
| 189 | $settings = unserialize(get_option('autowp_settings')); |
| 190 | |
| 191 | $wpcron_status = $settings['wpcron_status']; |
| 192 | |
| 193 | if(!isset($wpcron_status)){ |
| 194 | autowp_update_wp_cron_status('1'); |
| 195 | } |
| 196 | |
| 197 | $time_value_type = $settings['selected_time_type']; |
| 198 | |
| 199 | $user_wpcron_time = autowp_get_wpcron_time($time_value_type); |
| 200 | |
| 201 | $next_two_minutes = time() + 2 * 60; |
| 202 | |
| 203 | // Schedule WP-Cron |
| 204 | if (!wp_next_scheduled('autowp_cron')) { |
| 205 | wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron'); |
| 206 | |
| 207 | } else { |
| 208 | wp_clear_scheduled_hook('autowp_cron'); |
| 209 | wp_schedule_event($next_two_minutes, $user_wpcron_time, 'autowp_cron'); |
| 210 | } |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | $item_valid = autowp_validate_website($item); |
| 217 | if ($item_valid === true) { |
| 218 | if ($item['id'] == 0) { |
| 219 | $result = $wpdb->insert($table_name, $item); |
| 220 | $item['id'] = $wpdb->insert_id; |
| 221 | if ($result) { |
| 222 | $message = __('New process was successfully saved! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp'); |
| 223 | } else { |
| 224 | $notice = __('There was an error while saving item', 'autowp'); |
| 225 | } |
| 226 | } else { |
| 227 | $result = $wpdb->update($table_name, $item, array('id' => $item['id'])); |
| 228 | if ($result) { |
| 229 | $message = __('New process was successfully updated! Next process execution time : ' . get_next_cron_time('autowp_cron') . ' in your server time. You can change process execution interval in your settings page! ', 'autowp'); |
| 230 | } else { |
| 231 | $notice = __('There was an error while updating item', 'autowp'); |
| 232 | } |
| 233 | } |
| 234 | } else { |
| 235 | |
| 236 | $notice = $item_valid; |
| 237 | } |
| 238 | } |
| 239 | else { |
| 240 | |
| 241 | $item = $default; |
| 242 | $sanitized_id = absint($_REQUEST['id']); |
| 243 | if (isset($_REQUEST['id'])) { |
| 244 | $item = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table_name WHERE id = %d", $sanitized_id), ARRAY_A); |
| 245 | if (!$item) { |
| 246 | $item = $default; |
| 247 | $notice = __('Item not found', 'autowp'); |
| 248 | } |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | // Meta box ekleniyor |
| 253 | add_meta_box('agenticscrape_form_meta_box', __('Post Agent Configuration', 'autowp'), 'autowp_agenticscrape_meta_box_renderer', 'add_new_auto_post_agent', 'normal', 'default'); |
| 254 | ?> |
| 255 | <div class="wrap"> |
| 256 | <div class="icon32 icon32-posts-post" id="icon-edit"><br></div> |
| 257 | <h2> |
| 258 | <?php esc_html_e('New Post Agent', 'autowp'); ?> |
| 259 | <a class="add-new-h2" href="<?php echo esc_url(get_admin_url(get_current_blog_id(), 'admin.php?page=autowp_automaticPost')); ?>"> |
| 260 | <?php esc_html_e('Back to List', 'autowp'); ?> |
| 261 | </a> |
| 262 | </h2> |
| 263 | |
| 264 | <?php if (!empty($notice)): ?> |
| 265 | <div id="notice" class="error"><p><?php echo esc_html($notice); ?></p></div> |
| 266 | <?php endif; ?> |
| 267 | |
| 268 | <?php if (!empty($message)): ?> |
| 269 | <div id="message" class="updated"><p><?php echo esc_html($message); ?></p></div> |
| 270 | <?php endif; ?> |
| 271 | |
| 272 | <form id="form" method="POST"> |
| 273 | <input type="hidden" name="nonce" value="<?php echo esc_attr(wp_create_nonce(basename(__FILE__))); ?>"/> |
| 274 | <input type="hidden" name="id" value="<?php echo esc_attr($item['id']); ?>"/> |
| 275 | |
| 276 | <div class="metabox-holder" id="poststuff"> |
| 277 | <div id="post-body"> |
| 278 | <div id="post-body-content"> |
| 279 | <?php do_meta_boxes('add_new_auto_post_agent', 'normal', $item); ?> |
| 280 | <input type="submit" value="<?php esc_attr_e('Save', 'autowp'); ?>" id="submit" class="button-primary" name="submit"> |
| 281 | </div> |
| 282 | </div> |
| 283 | </div> |
| 284 | </form> |
| 285 | </div> |
| 286 | <?php |
| 287 | } |
| 288 | |
| 289 | function autowp_agenticscrape_meta_box_renderer($item) { |
| 290 | // Eğer mevcut kayıt varsa, content_prompt içerisindeki JSON'u decode edelim. |
| 291 | $decoded_prompt = array(); |
| 292 | if ( isset($item['content_prompt']) && !empty($item['content_prompt']) ) { |
| 293 | $decoded_prompt = json_decode($item['content_prompt'], true); |
| 294 | if (!is_array($decoded_prompt)) { |
| 295 | $decoded_prompt = array(); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | // Dil listesi (manuel formdakiyle aynı) |
| 300 | $languages = [ |
| 301 | "Afrikaans", |
| 302 | "Albanian", |
| 303 | "Arabic", |
| 304 | "Armenian", |
| 305 | "Basque", |
| 306 | "Bengali", |
| 307 | "Bulgarian", |
| 308 | "Catalan", |
| 309 | "Cambodian", |
| 310 | "Chinese (Mandarin)", |
| 311 | "Croatian", |
| 312 | "Czech", |
| 313 | "Danish", |
| 314 | "Dutch", |
| 315 | "English", |
| 316 | "Estonian", |
| 317 | "Fiji", |
| 318 | "Finnish", |
| 319 | "French", |
| 320 | "Georgian", |
| 321 | "German", |
| 322 | "Greek", |
| 323 | "Gujarati", |
| 324 | "Hebrew", |
| 325 | "Hindi", |
| 326 | "Hungarian", |
| 327 | "Icelandic", |
| 328 | "Indonesian", |
| 329 | "Irish", |
| 330 | "Italian", |
| 331 | "Japanese", |
| 332 | "Javanese", |
| 333 | "Korean", |
| 334 | "Latin", |
| 335 | "Latvian", |
| 336 | "Lithuanian", |
| 337 | "Macedonian", |
| 338 | "Malay", |
| 339 | "Malayalam", |
| 340 | "Maltese", |
| 341 | "Maori", |
| 342 | "Marathi", |
| 343 | "Mongolian", |
| 344 | "Nepali", |
| 345 | "Norwegian", |
| 346 | "Persian", |
| 347 | "Polish", |
| 348 | "Portuguese", |
| 349 | "Punjabi", |
| 350 | "Quechua", |
| 351 | "Romanian", |
| 352 | "Russian", |
| 353 | "Samoan", |
| 354 | "Serbian", |
| 355 | "Slovak", |
| 356 | "Slovenian", |
| 357 | "Spanish", |
| 358 | "Swahili", |
| 359 | "Swedish", |
| 360 | "Tamil", |
| 361 | "Tatar", |
| 362 | "Telugu", |
| 363 | "Thai", |
| 364 | "Tibetan", |
| 365 | "Tonga", |
| 366 | "Turkish", |
| 367 | "Ukrainian", |
| 368 | "Urdu", |
| 369 | "Uzbek", |
| 370 | "Vietnamese", |
| 371 | "Welsh", |
| 372 | "Xhosa" |
| 373 | ]; |
| 374 | ?> |
| 375 | <div class="inside"> |
| 376 | <!-- General Settings --> |
| 377 | <h4 style="font-weight: bold;">General Settings</h4> |
| 378 | <div class="mb-3"> |
| 379 | <label for="website_name" class="form-label">Agent Name:</label> |
| 380 | <input type="text" id="website_name" name="website_name" value="<?php echo isset($item['website_name']) ? esc_attr($item['website_name']) : ''; ?>" class="form-control" required> |
| 381 | </div> |
| 382 | <div class="mb-3"> |
| 383 | <label for="category_id" class="form-label">Categories:</label> |
| 384 | <select id="category_id" name="category_id[]" required multiple class="form-select"> |
| 385 | <?php |
| 386 | $categories = get_categories(array( |
| 387 | 'orderby' => 'name', |
| 388 | 'order' => 'ASC', |
| 389 | 'hide_empty' => false |
| 390 | )); |
| 391 | $selected_cats = isset($item['category_id']) && !empty($item['category_id']) ? explode(",", $item['category_id']) : array(); |
| 392 | foreach ($categories as $category) { |
| 393 | $selected = in_array($category->term_id, $selected_cats) ? 'selected' : ''; |
| 394 | echo '<option value="' . esc_attr($category->term_id) . '" ' . $selected . '>' . esc_html($category->name) . '</option>'; |
| 395 | } |
| 396 | ?> |
| 397 | </select> |
| 398 | </div> |
| 399 | |
| 400 | |
| 401 | <class="mb-3"> |
| 402 | <label for="author_selection" class="form-label"><?php esc_html_e('Author Selection', 'autowp'); ?></label> |
| 403 | <select name="author_selection" id="author_selection" class="form-select"> |
| 404 | <?php |
| 405 | $authors = get_users(); |
| 406 | |
| 407 | foreach ($authors as $author) { |
| 408 | $author_id = $author->ID; |
| 409 | $author_name = $author->display_name; |
| 410 | $author_description = get_the_author_meta('description', $author_id); |
| 411 | |
| 412 | if ($item['author_selection'] === strval($author_id)) { |
| 413 | echo '<option value="' . esc_attr($author_id) . '" selected>' . esc_html($author_name) . '</option>'; |
| 414 | continue; |
| 415 | } |
| 416 | |
| 417 | echo '<option value="' . esc_attr($author_id) . '">' . esc_html($author_name) . '</option>'; |
| 418 | } |
| 419 | ?> |
| 420 | </select> |
| 421 | <p class="form-text"><?php esc_html_e('Select an author from the list.', 'autowp'); ?></p> |
| 422 | |
| 423 | |
| 424 | <div class="mb-3"> |
| 425 | <label for="image_generating_status" class="form-label">Image Generating Method</label> |
| 426 | <select name="image_generating_status" class="form-select" id="image_generating_status"> |
| 427 | <option value="0" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '0'); ?>>FLUX Realism LoRA</option> |
| 428 | <option value="1" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '1'); ?>>Stable Diffusion Ultra</option> |
| 429 | <option value="2" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '2'); ?>>Stable Diffusion Core</option> |
| 430 | <option value="3" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '3'); ?>>GPT Image 1 Mini</option> |
| 431 | <option value="4" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '4'); ?>>GPT Image 2</option> |
| 432 | <option value="5" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '5'); ?>>DuckDuckGo Search</option> |
| 433 | |
| 434 | <option value="6" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '6'); ?>>Default Image</option> |
| 435 | <option value="7" <?php selected(isset($item['image_generating_status']) ? $item['image_generating_status'] : '', '7'); ?>>No Image</option> |
| 436 | |
| 437 | </select> |
| 438 | <p class="form-text">By default No Image is selected. Use DuckDuckGo Search to find images in the internet.</p> |
| 439 | </div> |
| 440 | <!-- Long Description Prompt --> |
| 441 | <div class="mb-3"> |
| 442 | <label for="long_description" class="form-label">Long Description Prompt:</label> |
| 443 | <textarea class="form-control" id="long_description" name="long_description" rows="5" placeholder="Enter your detailed prompt here..."><?php echo isset($decoded_prompt['content']) ? esc_textarea($decoded_prompt['content']) : ''; ?></textarea> |
| 444 | <div class="form-text">Provide a detailed prompt for generating content.</div> |
| 445 | </div> |
| 446 | <!-- Post Settings --> |
| 447 | <h4 style="font-weight: bold;">Post Settings</h4> |
| 448 | <div class="mb-3"> |
| 449 | <label for="keywordInput" class="form-label">Keyword:</label> |
| 450 | <input type="text" class="form-control" id="keywordInput" name="keywordInput" placeholder="Enter keyword" value="<?php echo isset($decoded_prompt['keyword']) ? esc_attr($decoded_prompt['keyword']) : ''; ?>" required> |
| 451 | </div> |
| 452 | <div class="mb-3"> |
| 453 | <label for="countrySelect" class="form-label">Country:</label> |
| 454 | <select class="form-select" id="countrySelect" name="countrySelect"> |
| 455 | <?php |
| 456 | $selected_country = isset($decoded_prompt['country']) ? $decoded_prompt['country'] : ''; |
| 457 | |
| 458 | $countries = array( |
| 459 | 'any' => 'Anywhere', |
| 460 | 'AF' => 'Afghanistan', |
| 461 | 'AX' => '� |
| 462 | land Islands', |
| 463 | 'AL' => 'Albania', |
| 464 | 'DZ' => 'Algeria', |
| 465 | 'AS' => 'American Samoa', |
| 466 | 'AD' => 'Andorra', |
| 467 | 'AO' => 'Angola', |
| 468 | 'AI' => 'Anguilla', |
| 469 | 'AQ' => 'Antarctica', |
| 470 | 'AG' => 'Antigua and Barbuda', |
| 471 | 'AR' => 'Argentina', |
| 472 | 'AM' => 'Armenia', |
| 473 | 'AW' => 'Aruba', |
| 474 | 'AU' => 'Australia', |
| 475 | 'AT' => 'Austria', |
| 476 | 'AZ' => 'Azerbaijan', |
| 477 | 'BS' => 'Bahamas', |
| 478 | 'BH' => 'Bahrain', |
| 479 | 'BD' => 'Bangladesh', |
| 480 | 'BB' => 'Barbados', |
| 481 | 'BY' => 'Belarus', |
| 482 | 'BE' => 'Belgium', |
| 483 | 'BZ' => 'Belize', |
| 484 | 'BJ' => 'Benin', |
| 485 | 'BM' => 'Bermuda', |
| 486 | 'BT' => 'Bhutan', |
| 487 | 'BO' => 'Bolivia, Plurinational State of', |
| 488 | 'BQ' => 'Bonaire, Sint Eustatius and Saba', |
| 489 | 'BA' => 'Bosnia and Herzegovina', |
| 490 | 'BW' => 'Botswana', |
| 491 | 'BV' => 'Bouvet Island', |
| 492 | 'BR' => 'Brazil', |
| 493 | 'IO' => 'British Indian Ocean Territory', |
| 494 | 'BN' => 'Brunei Darussalam', |
| 495 | 'BG' => 'Bulgaria', |
| 496 | 'BF' => 'Burkina Faso', |
| 497 | 'BI' => 'Burundi', |
| 498 | 'KH' => 'Cambodia', |
| 499 | 'CM' => 'Cameroon', |
| 500 | 'CA' => 'Canada', |
| 501 | 'CV' => 'Cape Verde', |
| 502 | 'KY' => 'Cayman Islands', |
| 503 | 'CF' => 'Central African Republic', |
| 504 | 'TD' => 'Chad', |
| 505 | 'CL' => 'Chile', |
| 506 | 'CN' => 'China', |
| 507 | 'CX' => 'Christmas Island', |
| 508 | 'CC' => 'Cocos (Keeling) Islands', |
| 509 | 'CO' => 'Colombia', |
| 510 | 'KM' => 'Comoros', |
| 511 | 'CG' => 'Congo', |
| 512 | 'CD' => 'Congo, the Democratic Republic of the', |
| 513 | 'CK' => 'Cook Islands', |
| 514 | 'CR' => 'Costa Rica', |
| 515 | 'CI' => "Côte d'Ivoire", |
| 516 | 'HR' => 'Croatia', |
| 517 | 'CU' => 'Cuba', |
| 518 | 'CW' => 'Curaçao', |
| 519 | 'CY' => 'Cyprus', |
| 520 | 'CZ' => 'Czech Republic', |
| 521 | 'DK' => 'Denmark', |
| 522 | 'DJ' => 'Djibouti', |
| 523 | 'DM' => 'Dominica', |
| 524 | 'DO' => 'Dominican Republic', |
| 525 | 'EC' => 'Ecuador', |
| 526 | 'EG' => 'Egypt', |
| 527 | 'SV' => 'El Salvador', |
| 528 | 'GQ' => 'Equatorial Guinea', |
| 529 | 'ER' => 'Eritrea', |
| 530 | 'EE' => 'Estonia', |
| 531 | 'ET' => 'Ethiopia', |
| 532 | 'FK' => 'Falkland Islands (Malvinas)', |
| 533 | 'FO' => 'Faroe Islands', |
| 534 | 'FJ' => 'Fiji', |
| 535 | 'FI' => 'Finland', |
| 536 | 'FR' => 'France', |
| 537 | 'GF' => 'French Guiana', |
| 538 | 'PF' => 'French Polynesia', |
| 539 | 'TF' => 'French Southern Territories', |
| 540 | 'GA' => 'Gabon', |
| 541 | 'GM' => 'Gambia', |
| 542 | 'GE' => 'Georgia', |
| 543 | 'DE' => 'Germany', |
| 544 | 'GH' => 'Ghana', |
| 545 | 'GI' => 'Gibraltar', |
| 546 | 'GR' => 'Greece', |
| 547 | 'GL' => 'Greenland', |
| 548 | 'GD' => 'Grenada', |
| 549 | 'GP' => 'Guadeloupe', |
| 550 | 'GU' => 'Guam', |
| 551 | 'GT' => 'Guatemala', |
| 552 | 'GG' => 'Guernsey', |
| 553 | 'GN' => 'Guinea', |
| 554 | 'GW' => 'Guinea-Bissau', |
| 555 | 'GY' => 'Guyana', |
| 556 | 'HT' => 'Haiti', |
| 557 | 'HM' => 'Heard Island and McDonald Islands', |
| 558 | 'VA' => 'Holy See (Vatican City State)', |
| 559 | 'HN' => 'Honduras', |
| 560 | 'HK' => 'Hong Kong', |
| 561 | 'HU' => 'Hungary', |
| 562 | 'IS' => 'Iceland', |
| 563 | 'IN' => 'India', |
| 564 | 'ID' => 'Indonesia', |
| 565 | 'IR' => 'Iran, Islamic Republic of', |
| 566 | 'IQ' => 'Iraq', |
| 567 | 'IE' => 'Ireland', |
| 568 | 'IM' => 'Isle of Man', |
| 569 | 'IL' => 'Israel', |
| 570 | 'IT' => 'Italy', |
| 571 | 'JM' => 'Jamaica', |
| 572 | 'JP' => 'Japan', |
| 573 | 'JE' => 'Jersey', |
| 574 | 'JO' => 'Jordan', |
| 575 | 'KZ' => 'Kazakhstan', |
| 576 | 'KE' => 'Kenya', |
| 577 | 'KI' => 'Kiribati', |
| 578 | 'KP' => "Korea, Democratic People's Republic of", |
| 579 | 'KR' => 'Korea, Republic of', |
| 580 | 'KW' => 'Kuwait', |
| 581 | 'KG' => 'Kyrgyzstan', |
| 582 | 'LA' => "Lao People's Democratic Republic", |
| 583 | 'LV' => 'Latvia', |
| 584 | 'LB' => 'Lebanon', |
| 585 | 'LS' => 'Lesotho', |
| 586 | 'LR' => 'Liberia', |
| 587 | 'LY' => 'Libya', |
| 588 | 'LI' => 'Liechtenstein', |
| 589 | 'LT' => 'Lithuania', |
| 590 | 'LU' => 'Luxembourg', |
| 591 | 'MO' => 'Macao', |
| 592 | 'MK' => 'Macedonia, The Former Yugoslav Republic of', |
| 593 | 'MG' => 'Madagascar', |
| 594 | 'MW' => 'Malawi', |
| 595 | 'MY' => 'Malaysia', |
| 596 | 'MV' => 'Maldives', |
| 597 | 'ML' => 'Mali', |
| 598 | 'MT' => 'Malta', |
| 599 | 'MH' => 'Marshall Islands', |
| 600 | 'MQ' => 'Martinique', |
| 601 | 'MR' => 'Mauritania', |
| 602 | 'MU' => 'Mauritius', |
| 603 | 'YT' => 'Mayotte', |
| 604 | 'MX' => 'Mexico', |
| 605 | 'FM' => 'Micronesia, Federated States of', |
| 606 | 'MD' => 'Moldova, Republic of', |
| 607 | 'MC' => 'Monaco', |
| 608 | 'MN' => 'Mongolia', |
| 609 | 'ME' => 'Montenegro', |
| 610 | 'MS' => 'Montserrat', |
| 611 | 'MA' => 'Morocco', |
| 612 | 'MZ' => 'Mozambique', |
| 613 | 'MM' => 'Myanmar', |
| 614 | 'NA' => 'Namibia', |
| 615 | 'NR' => 'Nauru', |
| 616 | 'NP' => 'Nepal', |
| 617 | 'NL' => 'Netherlands', |
| 618 | 'NC' => 'New Caledonia', |
| 619 | 'NZ' => 'New Zealand', |
| 620 | 'NI' => 'Nicaragua', |
| 621 | 'NE' => 'Niger', |
| 622 | 'NG' => 'Nigeria', |
| 623 | 'NU' => 'Niue', |
| 624 | 'NF' => 'Norfolk Island', |
| 625 | 'MP' => 'Northern Mariana Islands', |
| 626 | 'NO' => 'Norway', |
| 627 | 'OM' => 'Oman', |
| 628 | 'PK' => 'Pakistan', |
| 629 | 'PW' => 'Palau', |
| 630 | 'PS' => 'Palestinian Territory, Occupied', |
| 631 | 'PA' => 'Panama', |
| 632 | 'PG' => 'Papua New Guinea', |
| 633 | 'PY' => 'Paraguay', |
| 634 | 'PE' => 'Peru', |
| 635 | 'PH' => 'Philippines', |
| 636 | 'PN' => 'Pitcairn', |
| 637 | 'PL' => 'Poland', |
| 638 | 'PT' => 'Portugal', |
| 639 | 'PR' => 'Puerto Rico', |
| 640 | 'QA' => 'Qatar', |
| 641 | 'RE' => 'Réunion', |
| 642 | 'RO' => 'Romania', |
| 643 | 'RU' => 'Russian Federation', |
| 644 | 'RW' => 'Rwanda', |
| 645 | 'BL' => 'Saint Barthélemy', |
| 646 | 'SH' => 'Saint Helena, Ascension and Tristan da Cunha', |
| 647 | 'KN' => 'Saint Kitts and Nevis', |
| 648 | 'LC' => 'Saint Lucia', |
| 649 | 'MF' => 'Saint Martin (French part)', |
| 650 | 'PM' => 'Saint Pierre and Miquelon', |
| 651 | 'VC' => 'Saint Vincent and the Grenadines', |
| 652 | 'WS' => 'Samoa', |
| 653 | 'SM' => 'San Marino', |
| 654 | 'ST' => 'Sao Tome and Principe', |
| 655 | 'SA' => 'Saudi Arabia', |
| 656 | 'SN' => 'Senegal', |
| 657 | 'RS' => 'Serbia', |
| 658 | 'SC' => 'Seychelles', |
| 659 | 'SL' => 'Sierra Leone', |
| 660 | 'SG' => 'Singapore', |
| 661 | 'SX' => 'Sint Maarten (Dutch part)', |
| 662 | 'SK' => 'Slovakia', |
| 663 | 'SI' => 'Slovenia', |
| 664 | 'SB' => 'Solomon Islands', |
| 665 | 'SO' => 'Somalia', |
| 666 | 'ZA' => 'South Africa', |
| 667 | 'GS' => 'South Georgia and the South Sandwich Islands', |
| 668 | 'SS' => 'South Sudan', |
| 669 | 'ES' => 'Spain', |
| 670 | 'LK' => 'Sri Lanka', |
| 671 | 'SD' => 'Sudan', |
| 672 | 'SR' => 'Suriname', |
| 673 | 'SJ' => 'Svalbard and Jan Mayen', |
| 674 | 'SZ' => 'Swaziland', |
| 675 | 'SE' => 'Sweden', |
| 676 | 'CH' => 'Switzerland', |
| 677 | 'SY' => 'Syrian Arab Republic', |
| 678 | 'TW' => 'Taiwan, Province of China', |
| 679 | 'TJ' => 'Tajikistan', |
| 680 | 'TZ' => 'Tanzania, United Republic of', |
| 681 | 'TH' => 'Thailand', |
| 682 | 'TL' => 'Timor-Leste', |
| 683 | 'TG' => 'Togo', |
| 684 | 'TK' => 'Tokelau', |
| 685 | 'TO' => 'Tonga', |
| 686 | 'TT' => 'Trinidad and Tobago', |
| 687 | 'TN' => 'Tunisia', |
| 688 | 'TR' => 'Turkey', |
| 689 | 'TM' => 'Turkmenistan', |
| 690 | 'TC' => 'Turks and Caicos Islands', |
| 691 | 'TV' => 'Tuvalu', |
| 692 | 'UG' => 'Uganda', |
| 693 | 'UA' => 'Ukraine', |
| 694 | 'AE' => 'United Arab Emirates', |
| 695 | 'GB' => 'United Kingdom', |
| 696 | 'US' => 'United States', |
| 697 | 'UM' => 'United States Minor Outlying Islands', |
| 698 | 'UY' => 'Uruguay', |
| 699 | 'UZ' => 'Uzbekistan', |
| 700 | 'VU' => 'Vanuatu', |
| 701 | 'VE' => 'Venezuela, Bolivarian Republic of', |
| 702 | 'VN' => 'Viet Nam', |
| 703 | 'VG' => 'Virgin Islands, British', |
| 704 | 'VI' => 'Virgin Islands, U.S.', |
| 705 | 'WF' => 'Wallis and Futuna', |
| 706 | 'EH' => 'Western Sahara', |
| 707 | 'YE' => 'Yemen', |
| 708 | 'ZM' => 'Zambia', |
| 709 | 'ZW' => 'Zimbabwe', |
| 710 | ); |
| 711 | |
| 712 | foreach ($countries as $code => $name) { |
| 713 | echo '<option value="' . esc_attr($code) . '" ' . selected($selected_country, $code, false) . '>' . esc_html($name) . '</option>'; |
| 714 | } |
| 715 | ?> |
| 716 | </select> |
| 717 | </div> |
| 718 | <div class="mb-3"> |
| 719 | <label for="languageSelect_generated" class="form-label">Post Language (for Generated Content):</label> |
| 720 | <select class="form-select" id="languageSelect_generated" name="languageSelect"> |
| 721 | <?php foreach ($languages as $language): ?> |
| 722 | <option value="<?php echo esc_attr($language); ?>" <?php selected(isset($decoded_prompt['language']) ? $decoded_prompt['language'] : '', $language); ?>> |
| 723 | <?php echo esc_html($language); ?> |
| 724 | </option> |
| 725 | <?php endforeach; ?> |
| 726 | </select> |
| 727 | </div> |
| 728 | <div class="mb-3"> |
| 729 | <label for="subtitleSelect" class="form-label">Subheading Count:</label> |
| 730 | <select class="form-select" id="subtitleSelect" name="subtitleSelect"> |
| 731 | <?php |
| 732 | $subheading_count = isset($decoded_prompt['subheading_count']) ? intval($decoded_prompt['subheading_count']) : 1; |
| 733 | for ($i = 1; $i <= 10; $i++) { |
| 734 | echo '<option value="' . esc_attr($i) . '" ' . selected($subheading_count, $i, false) . '>' . esc_html($i) . '</option>'; |
| 735 | } |
| 736 | ?> |
| 737 | </select> |
| 738 | </div> |
| 739 | <div class="mb-3"> |
| 740 | <label for="narrationSelect" class="form-label">Writing Style:</label> |
| 741 | <select class="form-select" id="narrationSelect" name="narrationSelect"> |
| 742 | <?php |
| 743 | $is_inactive = (isset($item['active']) && $item['active'] === '0'); |
| 744 | $styles = [ |
| 745 | "Descriptive" => "Descriptive", |
| 746 | "Narrative" => "Narrative", |
| 747 | "Explanatory" => "Explanatory", |
| 748 | "Argumentative" => "Argumentative", |
| 749 | "Comparative" => "Comparative", |
| 750 | "Process Analysis" => "Process Analysis", |
| 751 | "Allegorical" => "Allegorical", |
| 752 | "Chronological" => "Chronological", |
| 753 | "Ironic" => "Ironic", |
| 754 | "ConsistencyAndRepetition" => "Consistency and Repetition", |
| 755 | "LanguagePlayAndPoeticExpression" => "Language Play and Poetic Expression", |
| 756 | "InternalMonologue" => "Internal Monologue", |
| 757 | "Dialogical" => "Dialogical" |
| 758 | ]; |
| 759 | $writing_style = isset($decoded_prompt['writing_style']) ? $decoded_prompt['writing_style'] : ''; |
| 760 | foreach ($styles as $value => $name) { |
| 761 | echo '<option value="' . esc_attr($value) . '" ' . selected($writing_style, $value, false) . '>' . esc_html($name) . '</option>'; |
| 762 | } |
| 763 | ?> |
| 764 | </select> |
| 765 | </div> |
| 766 | |
| 767 | <h4 style="font-weight: bold;">Source Status</h4> |
| 768 | |
| 769 | |
| 770 | <!-- Status Field (Active/Inactive) --> |
| 771 | <div class="mb-3"> |
| 772 | <label for="active" class="form-label">Status:</label> |
| 773 | |
| 774 | |
| 775 | <select id="active" name="active" class="form-select"> |
| 776 | <option value="1" <?php echo (!$is_inactive) ? 'selected' : ''; ?>> |
| 777 | Active |
| 778 | </option> |
| 779 | <option value="0" <?php echo ($is_inactive) ? 'selected' : ''; ?>> |
| 780 | Inactive |
| 781 | </option> |
| 782 | </select> |
| 783 | |
| 784 | <p> |
| 785 | When the cron job is triggered, any task marked as "Active" will be executed. |
| 786 | If you select "Inactive," this task will be skipped, and the cron job will move |
| 787 | on to the remaining active tasks. This makes it easy to enable or disable tasks |
| 788 | without removing them entirely. |
| 789 | </p> |
| 790 | </div> |
| 791 | <!-- Custom Tools Section --> |
| 792 | <h4 style="font-weight: bold;">Custom Tools</h4> |
| 793 | <div class="accordion mb-4" id="accordionCustomTools"> |
| 794 | <!-- Website Tools --> |
| 795 | <div class="accordion-item"> |
| 796 | <h2 class="accordion-header" id="headingWebsiteTools"> |
| 797 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 798 | <button class="accordion-button flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWebsiteTools" aria-expanded="true" aria-controls="collapseWebsiteTools"> |
| 799 | Website Tools |
| 800 | </button> |
| 801 | <div class="form-check form-switch ms-2"> |
| 802 | |
| 803 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_website_tools" name="enable_website_tools" <?php echo isset($decoded_prompt['enable_website_tools']) ? checked($decoded_prompt['enable_website_tools'], '1', false) : 'checked'; ?> onchange="toggleAccordion('collapseWebsiteTools', this.checked);"> |
| 804 | |
| 805 | </div> |
| 806 | </div> |
| 807 | </h2> |
| 808 | <div id="collapseWebsiteTools" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_website_tools']) ? ($decoded_prompt['enable_website_tools'] == '1' ? 'show' : '') : 'show'; ?>" aria-labelledby="headingWebsiteTools"> |
| 809 | |
| 810 | <div class="accordion-body"> |
| 811 | <div class="mb-3"> |
| 812 | <label for="website_tools_knowledge_base_url" class="form-label">Knowledge Base URL</label> |
| 813 | <input type="url" class="form-control" id="website_tools_knowledge_base_url" name="website_tools_knowledge_base_url" placeholder="https://example.com" value="<?php echo isset($decoded_prompt['custom_tools']['website_tools']['knowledge_base_url']) ? esc_url($decoded_prompt['custom_tools']['website_tools']['knowledge_base_url']) : ''; ?>"> |
| 814 | </div> |
| 815 | </div> |
| 816 | </div> |
| 817 | </div> |
| 818 | <!-- DuckDuckGO Search --> |
| 819 | <div class="accordion-item"> |
| 820 | <h2 class="accordion-header" id="headingDuckDuckGO"> |
| 821 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 822 | <button class="accordion-button flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseDuckDuckGO" aria-expanded="true" aria-controls="collapseDuckDuckGO"> |
| 823 | DuckDuckGO Search |
| 824 | </button> |
| 825 | <div class="form-check form-switch ms-2"> |
| 826 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_duckduckgo" name="enable_duckduckgo" <?php echo isset($decoded_prompt['enable_duckduckgo']) ? checked($decoded_prompt['enable_duckduckgo'], '1', false) : 'checked'; ?> onchange="toggleAccordion('collapseDuckDuckGO', this.checked);"> |
| 827 | |
| 828 | </div> |
| 829 | </div> |
| 830 | </h2> |
| 831 | <div id="collapseDuckDuckGO" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_duckduckgo']) ? ($decoded_prompt['enable_duckduckgo'] == '1' ? 'show' : '') : 'show'; ?>" aria-labelledby="headingDuckDuckGO"> |
| 832 | |
| 833 | <div class="accordion-body"> |
| 834 | <div class="form-check form-switch mb-3"> |
| 835 | <input type="checkbox" class="form-check-input" id="duckduckgo_news" name="duckduckgo_news" value="1" <?php checked(isset($decoded_prompt['custom_tools']['duckduckgo']['news']) && $decoded_prompt['custom_tools']['duckduckgo']['news'] == '1'); ?>> |
| 836 | <label class="form-check-label" for="duckduckgo_news">Include News (Default: Enabled)</label> |
| 837 | </div> |
| 838 | <div class="mb-3"> |
| 839 | <label for="duckduckgo_fixed_max_results" class="form-label">Fixed Max Results</label> |
| 840 | <input type="number" class="form-control" id="duckduckgo_fixed_max_results" name="duckduckgo_fixed_max_results" placeholder="Enter a number or leave blank" value="<?php echo isset($decoded_prompt['custom_tools']['duckduckgo']['fixed_max_results']) ? esc_attr($decoded_prompt['custom_tools']['duckduckgo']['fixed_max_results']) : ''; ?>"> |
| 841 | </div> |
| 842 | </div> |
| 843 | </div> |
| 844 | </div> |
| 845 | <!-- Wikipedia --> |
| 846 | <div class="accordion-item"> |
| 847 | <h2 class="accordion-header" id="headingWikipedia"> |
| 848 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 849 | <button class="accordion-button flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseWikipedia" aria-expanded="true" aria-controls="collapseWikipedia"> |
| 850 | Wikipedia |
| 851 | </button> |
| 852 | <div class="form-check form-switch ms-2"> |
| 853 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_wikipedia" name="enable_wikipedia" <?php echo isset($decoded_prompt['enable_wikipedia']) ? checked($decoded_prompt['enable_wikipedia'], '1', false) : 'checked'; ?> onchange="toggleAccordion('collapseWikipedia', this.checked);"> |
| 854 | |
| 855 | </div> |
| 856 | </div> |
| 857 | </h2> |
| 858 | <div id="collapseWikipedia" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_wikipedia']) ? ($decoded_prompt['enable_wikipedia'] == '1' ? 'show' : '') : 'show'; ?>" aria-labelledby="headingWikipedia"> |
| 859 | |
| 860 | <div class="accordion-body"> |
| 861 | <div class="mb-3"> |
| 862 | <label for="wikipedia_knowledge_base" class="form-label">Knowledge Base Topics</label> |
| 863 | <input type="text" class="form-control" id="wikipedia_knowledge_base" name="wikipedia_knowledge_base" placeholder="topic1, topic2, topic3" value="<?php echo isset($decoded_prompt['custom_tools']['wikipedia']['knowledge_base']) ? esc_attr($decoded_prompt['custom_tools']['wikipedia']['knowledge_base']) : ''; ?>"> |
| 864 | </div> |
| 865 | </div> |
| 866 | </div> |
| 867 | </div> |
| 868 | <!-- YFinanceTools --> |
| 869 | <div class="accordion-item"> |
| 870 | <h2 class="accordion-header" id="headingYFinanceTools"> |
| 871 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 872 | <button class="accordion-button flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseYFinanceTools" aria-expanded="true" aria-controls="collapseYFinanceTools"> |
| 873 | YFinanceTools |
| 874 | </button> |
| 875 | <div class="form-check form-switch ms-2"> |
| 876 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_yfinancetools" name="enable_yfinancetools" <?php echo isset($decoded_prompt['enable_yfinancetools']) ? checked($decoded_prompt['enable_yfinancetools'], '1', false) : 'checked'; ?> onchange="toggleAccordion('collapseYFinanceTools', this.checked);"> |
| 877 | |
| 878 | </div> |
| 879 | </div> |
| 880 | </h2> |
| 881 | <div id="collapseYFinanceTools" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_yfinancetools']) ? ($decoded_prompt['enable_yfinancetools'] == '1' ? 'show' : '') : 'show'; ?>" aria-labelledby="headingYFinanceTools"> |
| 882 | |
| 883 | <div class="accordion-body"> |
| 884 | <div class="form-check form-switch mb-2"> |
| 885 | <input type="checkbox" class="form-check-input" id="yfinance_stock_price" name="yfinance_stock_price" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['stock_price']) && $decoded_prompt['custom_tools']['yfinancetools']['stock_price'] == '1'); ?>> |
| 886 | <label class="form-check-label" for="yfinance_stock_price">Stock Price (Default: Enabled)</label> |
| 887 | </div> |
| 888 | <div class="form-check form-switch mb-2"> |
| 889 | <input type="checkbox" class="form-check-input" id="yfinance_company_info" name="yfinance_company_info" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['company_info']) && $decoded_prompt['custom_tools']['yfinancetools']['company_info'] == '1'); ?>> |
| 890 | <label class="form-check-label" for="yfinance_company_info">Company Info</label> |
| 891 | </div> |
| 892 | <div class="form-check form-switch mb-2"> |
| 893 | <input type="checkbox" class="form-check-input" id="yfinance_stock_fundamentals" name="yfinance_stock_fundamentals" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['stock_fundamentals']) && $decoded_prompt['custom_tools']['yfinancetools']['stock_fundamentals'] == '1'); ?>> |
| 894 | <label class="form-check-label" for="yfinance_stock_fundamentals">Stock Fundamentals</label> |
| 895 | </div> |
| 896 | <div class="form-check form-switch mb-2"> |
| 897 | <input type="checkbox" class="form-check-input" id="yfinance_income_statements" name="yfinance_income_statements" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['income_statements']) && $decoded_prompt['custom_tools']['yfinancetools']['income_statements'] == '1'); ?>> |
| 898 | <label class="form-check-label" for="yfinance_income_statements">Income Statements</label> |
| 899 | </div> |
| 900 | <div class="form-check form-switch mb-2"> |
| 901 | <input type="checkbox" class="form-check-input" id="yfinance_key_financial_ratios" name="yfinance_key_financial_ratios" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['key_financial_ratios']) && $decoded_prompt['custom_tools']['yfinancetools']['key_financial_ratios'] == '1'); ?>> |
| 902 | <label class="form-check-label" for="yfinance_key_financial_ratios">Key Financial Ratios</label> |
| 903 | </div> |
| 904 | <div class="form-check form-switch mb-2"> |
| 905 | <input type="checkbox" class="form-check-input" id="yfinance_analyst_recommendations" name="yfinance_analyst_recommendations" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['analyst_recommendations']) && $decoded_prompt['custom_tools']['yfinancetools']['analyst_recommendations'] == '1'); ?>> |
| 906 | <label class="form-check-label" for="yfinance_analyst_recommendations">Analyst Recommendations</label> |
| 907 | </div> |
| 908 | <div class="form-check form-switch mb-2"> |
| 909 | <input type="checkbox" class="form-check-input" id="yfinance_company_news" name="yfinance_company_news" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['company_news']) && $decoded_prompt['custom_tools']['yfinancetools']['company_news'] == '1'); ?>> |
| 910 | <label class="form-check-label" for="yfinance_company_news">Company News</label> |
| 911 | </div> |
| 912 | <div class="form-check form-switch mb-2"> |
| 913 | <input type="checkbox" class="form-check-input" id="yfinance_technical_indicators" name="yfinance_technical_indicators" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['technical_indicators']) && $decoded_prompt['custom_tools']['yfinancetools']['technical_indicators'] == '1'); ?>> |
| 914 | <label class="form-check-label" for="yfinance_technical_indicators">Technical Indicators</label> |
| 915 | </div> |
| 916 | <div class="form-check form-switch mb-2"> |
| 917 | <input type="checkbox" class="form-check-input" id="yfinance_historical_prices" name="yfinance_historical_prices" value="1" <?php checked(isset($decoded_prompt['custom_tools']['yfinancetools']['historical_prices']) && $decoded_prompt['custom_tools']['yfinancetools']['historical_prices'] == '1'); ?>> |
| 918 | <label class="form-check-label" for="yfinance_historical_prices">Historical Prices</label> |
| 919 | </div> |
| 920 | </div> |
| 921 | </div> |
| 922 | </div> |
| 923 | <!-- Hacker News --> |
| 924 | <div class="accordion-item"> |
| 925 | <h2 class="accordion-header" id="headingHackerNews"> |
| 926 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 927 | <button class="accordion-button flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseHackerNews" aria-expanded="true" aria-controls="collapseHackerNews"> |
| 928 | Hacker News |
| 929 | </button> |
| 930 | <div class="form-check form-switch ms-2"> |
| 931 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_hackernews" name="enable_hackernews" <?php echo isset($decoded_prompt['enable_hackernews']) ? checked($decoded_prompt['enable_hackernews'], '1', false) : 'checked'; ?> onchange="toggleAccordion('collapseHackerNews', this.checked);"> |
| 932 | |
| 933 | </div> |
| 934 | </div> |
| 935 | </h2> |
| 936 | <div id="collapseHackerNews" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_hackernews']) ? ($decoded_prompt['enable_hackernews'] == '1' ? 'show' : '') : 'show'; ?>" aria-labelledby="headingHackerNews"> |
| 937 | |
| 938 | <div class="accordion-body"> |
| 939 | <div class="form-check form-switch mb-2"> |
| 940 | <input type="checkbox" class="form-check-input" id="hackernews_get_top_stories" name="hackernews_get_top_stories" value="1" <?php checked(isset($decoded_prompt['custom_tools']['hackernews']['get_top_stories']) && $decoded_prompt['custom_tools']['hackernews']['get_top_stories'] == '1'); ?>> |
| 941 | <label class="form-check-label" for="hackernews_get_top_stories">Get Top Stories (Default: Enabled)</label> |
| 942 | </div> |
| 943 | <div class="form-check form-switch mb-2"> |
| 944 | <input type="checkbox" class="form-check-input" id="hackernews_get_user_details" name="hackernews_get_user_details" value="1" <?php checked(isset($decoded_prompt['custom_tools']['hackernews']['get_user_details']) && $decoded_prompt['custom_tools']['hackernews']['get_user_details'] == '1'); ?>> |
| 945 | <label class="form-check-label" for="hackernews_get_user_details">Get User Details (Default: Enabled)</label> |
| 946 | </div> |
| 947 | </div> |
| 948 | </div> |
| 949 | </div> |
| 950 | </div> <!-- End of Custom Tools --> |
| 951 | <!-- Knowledge Base Section --> |
| 952 | <h4 style="font-weight: bold;">Knowledge Base</h4> |
| 953 | <div class="accordion mb-4" id="accordionKnowledgeBase"> |
| 954 | <!-- PDF Knowledge Base --> |
| 955 | <div class="accordion-item"> |
| 956 | <h2 class="accordion-header" id="headingPDFKB"> |
| 957 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 958 | <button class="accordion-button collapsed flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapsePDFKB" aria-expanded="false" aria-controls="collapsePDFKB"> |
| 959 | PDF Knowledge Base |
| 960 | </button> |
| 961 | <div class="form-check form-switch ms-2"> |
| 962 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_pdf_kb" name="enable_pdf_kb" <?php echo isset($decoded_prompt['enable_pdf_kb']) ? checked($decoded_prompt['enable_pdf_kb'], '1', false) : ''; ?> onchange="toggleAccordion('collapsePDFKB', this.checked);"> |
| 963 | |
| 964 | </div> |
| 965 | </div> |
| 966 | </h2> |
| 967 | <div id="collapsePDFKB" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_pdf_kb']) && $decoded_prompt['enable_pdf_kb'] == '1' ? 'show' : ''; ?>" aria-labelledby="headingPDFKB"> |
| 968 | |
| 969 | <div class="accordion-body"> |
| 970 | <div class="mb-3"> |
| 971 | <label for="pdf_url_knowledge_base" class="form-label">PDF URL Knowledge Base</label> |
| 972 | <input type="url" class="form-control" id="pdf_url_knowledge_base" name="pdf_url_knowledge_base" placeholder="https://example.com/document.pdf" value="<?php echo isset($decoded_prompt['knowledge_base']['pdf_url']) ? esc_url($decoded_prompt['knowledge_base']['pdf_url']) : ''; ?>"> |
| 973 | <div class="form-text">Provide a URL to a PDF document. If filled, it must point to a valid PDF file.</div> |
| 974 | </div> |
| 975 | </div> |
| 976 | </div> |
| 977 | </div> |
| 978 | <!-- CSV Knowledge Base --> |
| 979 | <div class="accordion-item"> |
| 980 | <h2 class="accordion-header" id="headingCSVKB"> |
| 981 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 982 | <button class="accordion-button collapsed flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseCSVKB" aria-expanded="false" aria-controls="collapseCSVKB"> |
| 983 | CSV Knowledge Base |
| 984 | </button> |
| 985 | <div class="form-check form-switch ms-2"> |
| 986 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_csv_kb" name="enable_csv_kb" <?php echo isset($decoded_prompt['enable_csv_kb']) ? checked($decoded_prompt['enable_csv_kb'], '1', false) : ''; ?> onchange="toggleAccordion('collapseCSVKB', this.checked);"> |
| 987 | |
| 988 | </div> |
| 989 | </div> |
| 990 | </h2> |
| 991 | <div id="collapseCSVKB" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_csv_kb']) && $decoded_prompt['enable_csv_kb'] == '1' ? 'show' : ''; ?>" aria-labelledby="headingCSVKB"> |
| 992 | |
| 993 | <div class="accordion-body"> |
| 994 | <div class="mb-3"> |
| 995 | <label for="csv_url_knowledge_base" class="form-label">CSV URL Knowledge Base</label> |
| 996 | <input type="url" class="form-control" id="csv_url_knowledge_base" name="csv_url_knowledge_base" placeholder="https://example.com/data.csv" value="<?php echo isset($decoded_prompt['knowledge_base']['csv_url']) ? esc_url($decoded_prompt['knowledge_base']['csv_url']) : ''; ?>"> |
| 997 | <div class="form-text">Provide a URL to a CSV file. If filled, it must be a valid URL.</div> |
| 998 | </div> |
| 999 | </div> |
| 1000 | </div> |
| 1001 | </div> |
| 1002 | <!-- Text Knowledge Base --> |
| 1003 | <div class="accordion-item"> |
| 1004 | <h2 class="accordion-header" id="headingTextKB"> |
| 1005 | <div class="d-flex justify-content-between align-items-center w-100"> |
| 1006 | <button class="accordion-button collapsed flex-grow-1" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTextKB" aria-expanded="false" aria-controls="collapseTextKB"> |
| 1007 | Text Knowledge Base |
| 1008 | </button> |
| 1009 | <div class="form-check form-switch ms-2"> |
| 1010 | <input class="form-check-input" type="checkbox" role="switch" id="toggle_text_kb" name="enable_text_kb" <?php echo isset($decoded_prompt['enable_text_kb']) ? checked($decoded_prompt['enable_text_kb'], '1', false) : ''; ?> onchange="toggleAccordion('collapseTextKB', this.checked);"> |
| 1011 | |
| 1012 | </div> |
| 1013 | </div> |
| 1014 | </h2> |
| 1015 | <div id="collapseTextKB" class="accordion-collapse collapse <?php echo isset($decoded_prompt['enable_text_kb']) && $decoded_prompt['enable_text_kb'] == '1' ? 'show' : ''; ?>" aria-labelledby="headingTextKB"> |
| 1016 | |
| 1017 | <div class="accordion-body"> |
| 1018 | <div class="mb-3"> |
| 1019 | <label for="text_knowledge_base" class="form-label">Text Knowledge Base</label> |
| 1020 | <textarea class="form-control" id="text_knowledge_base" name="text_knowledge_base" rows="5" placeholder="Enter your knowledge base text here..."><?php echo isset($decoded_prompt['knowledge_base']['text']) ? esc_textarea($decoded_prompt['knowledge_base']['text']) : ''; ?></textarea> |
| 1021 | <div class="form-text">Enter plain text for your knowledge base. This field supports a longer description.</div> |
| 1022 | </div> |
| 1023 | </div> |
| 1024 | </div> |
| 1025 | </div> |
| 1026 | </div> <!-- End of Knowledge Base --> |
| 1027 | </div> |
| 1028 | <script> |
| 1029 | function toggleAccordion(collapseId, isActive) { |
| 1030 | var collapseElement = document.getElementById(collapseId); |
| 1031 | var bsCollapse = new bootstrap.Collapse(collapseElement, { toggle: false }); |
| 1032 | if (isActive) { |
| 1033 | bsCollapse.show(); |
| 1034 | } else { |
| 1035 | bsCollapse.hide(); |
| 1036 | } |
| 1037 | } |
| 1038 | </script> |
| 1039 | |
| 1040 | |
| 1041 | <?php |
| 1042 | } |
| 1043 | |
| 1044 | ?> |
| 1045 |