| @@ -81,9 +81,18 @@ | ||
| 81 | 81 | </div> |
| 82 | 82 | </div> |
| 83 | 83 | |
| 84 | 84 | </div> |
| 85 | - <!-- =========================== | |
| 85 | + <div class="wrap"> | |
| 86 | + <h3>Sync Settings</h3> | |
| 87 | + | |
| 88 | + <div class="mb-3"> | |
| 89 | + <input type="checkbox" id="rag_auto_sync_enabled" class="rag_auto_sync_enabled" <?php checked(get_option('rag_auto_sync_enabled'), '1'); ?>> | |
| 90 | + <label for="rag_auto_sync_enabled"><strong>Enable Auto Sync (on Save)</strong></label> | |
| 91 | + <p class="description">Automatically update embeddings when a post or product is saved/updated.</p> | |
| 92 | + </div> | |
| 93 | + </div> | |
| 94 | + <!-- =========================== | |
| 86 | 95 | EXECUTION BUTTON |
| 87 | 96 | ============================ --> |
| 88 | 97 | <div class="wrap my-4"> |
| 89 | 98 | <p style="color: red"> <b><?php esc_html_e('Please connect to an AI service like OpenAI or Gemini before embedding. ', 'chatbot'); ?></b><b><a target="_blank" href="https://wpbot.pro/docs/knowledgebase/how-to-use-an-embedded-vector-database-and-rag-to-get-customized-responses-from-ai/"><?php esc_html_e('Check this Tutorial for more details.', 'chatbot'); ?></a></b></p> |
| @@ -177,10 +186,33 @@ | ||
| 177 | 186 | </tbody> |
| 178 | 187 | </table> |
| 179 | 188 | <button type="button" class="button button-primary" id="rag_sql_add_table">Add New Table</button> |
| 180 | 189 | <button type="button" class="button button-secondary" id="sql_instruction" style="margin-left: 5px;">View Available SQL Tables & Fields</button> |
| 181 | - <p class="description">Add multiple tables and fields. Separate multiple fields in the same table with commas.</p> | |
| 190 | + <p class="description">Add multiple tables and fields. Separate multiple fields in the same table with commas. Click "Create Missing Tables" to generate empty tables in the database if they don't exist.</p> | |
| 182 | 191 | </div> |
| 192 | + <!-- New Section for Google Sheets to SQL Sync --> | |
| 193 | + <div id="rag_sql_sheets_section" style="display:block; margin-top: 20px; margin-left: 20px; padding: 15px; border: 1px solid #ccc; background: #f9f9f9;"> | |
| 194 | + <h4>Google Sheets & CSV Database Sync</h4> | |
| 195 | + <p class="description">Directly import Google Sheets or upload CSV data into SQL tables for Text-to-SQL querying.</p> | |
| 196 | + | |
| 197 | + <div style="margin-bottom: 15px;"> | |
| 198 | + <label style="display:block; font-weight:bold; margin-bottom:5px;">Import via Google Sheet URL:</label> | |
| 199 | + <input type="text" id="rag_sql_sheet_url_input" placeholder="Enter Google Sheet or CSV URL" class="regular-text" style="width: 60%; margin-right: 5px;"> | |
| 200 | + <button type="button" class="button button-primary" id="rag_sql_import_sheet">Import URL to SQL</button> | |
| 201 | + </div> | |
| 202 | + | |
| 203 | + <div style="margin-bottom: 15px;"> | |
| 204 | + <label style="display:block; font-weight:bold; margin-bottom:5px;">Upload a Local CSV File:</label> | |
| 205 | + <input type="file" id="rag_sql_csv_file_input" accept=".csv" style="margin-right: 5px;"> | |
| 206 | + <button type="button" class="button button-primary" id="rag_sql_upload_csv">Upload CSV to SQL</button> | |
| 207 | + </div> | |
| 208 | + | |
| 209 | + <hr style="margin: 15px 0;"> | |
| 210 | + <p>Sync all your previously uploaded sheets into SQL tables:</p> | |
| 211 | + <button type="button" class="button button-secondary" id="rag_sql_sync_existing_sheets">Sync Existing Sheets to SQL</button> | |
| 212 | + | |
| 213 | + <div id="rag_sql_sync_status" style="margin-top: 10px; font-weight: bold;"></div> | |
| 214 | + </div> | |
| 183 | 215 | </div> |
| 184 | 216 | <br><br> |
| 185 | 217 | <div class="mb-3" style="<?php if ( $wpchatbot_license_valid != 'master' && $wpchatbot_license_valid != 'professional'){ echo 'opacity:0.5; pointer-events:none;'; } ?> "> |
| 186 | 218 | <input type="checkbox" id="rag_sql_auto_sync_enabled" <?php checked(get_option('rag_sql_auto_sync_enabled'), '1'); ?>> |
| @@ -258,10 +290,10 @@ | ||
| 258 | 290 | <div class="wrap"> |
| 259 | 291 | <h3>Sync Settings</h3> |
| 260 | 292 | |
| 261 | 293 | <div class="mb-3"> |
| 262 | - <input type="checkbox" id="rag_auto_sync_enabled" <?php checked(get_option('rag_auto_sync_enabled'), '1'); ?>> | |
| 263 | - <label for="rag_auto_sync_enabled"><strong>Enable Auto Sync (on Save)</strong></label> | |
| 294 | + <input type="checkbox" id="rag_auto_sync_enabled_tab" class="rag_auto_sync_enabled" <?php checked(get_option('rag_auto_sync_enabled'), '1'); ?>> | |
| 295 | + <label for="rag_auto_sync_enabled_tab"><strong>Enable Auto Sync (on Save)</strong></label> | |
| 264 | 296 | <p class="description">Automatically update embeddings when a post or product is saved/updated.</p> |
| 265 | 297 | </div> |
| 266 | 298 | <hr> |
| 267 | 299 | <?php |
| @@ -963,5 +995,5 @@ | ||
| 963 | 995 | // Default to first tab if no sub-tab specified |
| 964 | 996 | $('.nav-tab-wrapper a').first().trigger('click'); |
| 965 | 997 | } |
| 966 | 998 | }); |
| 967 | -</script> | |
| 999 | +</script> | |