Changeset 3423014
- Timestamp:
- 12/18/2025 02:56:01 PM (3 months ago)
- Location:
- talkgenai/trunk
- Files:
-
- 2 edited
-
admin/js/admin.js (modified) (3 diffs)
-
talkgenai.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
talkgenai/trunk/admin/js/admin.js
r3413653 r3423014 135 135 bindPreviewActions(); // Ensure Save App button works on edit page 136 136 bindAdditionalActions(); // Bind new Generate Articles and Get App Ideas buttons 137 bindErrorOverlayDismiss(); // Make "Keep Calculator" always dismissable (preview sanitizer strips onclick) 137 138 138 139 // If edit page preloaded app into window.currentAppData, adopt it here … … 237 238 console.log('TalkGenAI Admin initialized'); 238 239 } 240 241 /** 242 * Dismiss the preserved-calculator error overlay. 243 * 244 * IMPORTANT: showPreview() runs sanitizeHtml(), which removes ALL "on*" attributes (onclick, etc). 245 * So overlay dismissal must be implemented in admin.js via event delegation. 246 */ 247 function bindErrorOverlayDismiss() { 248 try { 249 if (window.__talkgenai_overlay_dismiss_bound) return; 250 window.__talkgenai_overlay_dismiss_bound = true; 251 252 // Button click: dismiss overlay 253 $(document).on('click', '#talkgenai-dismiss-btn', function(e) { 254 try { 255 e.preventDefault(); 256 e.stopPropagation(); 257 } catch (_) {} 258 $('#talkgenai-error-overlay').remove(); 259 return false; 260 }); 261 262 // Click backdrop (outside modal): dismiss overlay 263 $(document).on('click', '#talkgenai-error-overlay', function(e) { 264 if (e && e.target === this) { 265 $('#talkgenai-error-overlay').remove(); 266 } 267 }); 268 269 // Prevent clicks inside the modal from bubbling to the overlay 270 $(document).on('click', '#talkgenai-error-modal', function(e) { 271 try { 272 e.stopPropagation(); 273 } catch (_) {} 274 }); 275 } catch (e) { 276 console.error('TalkGenAI: Failed to bind overlay dismiss handlers:', e); 277 } 278 } 239 279 240 280 /** … … 391 431 $input.val(''); 392 432 393 // Use existing generate/modify flow with compact prompt 394 const compactPrompt = (tgaiChat.messages || []).map(m => (m.role === 'user' ? 'User: ' : 'AI: ') + m.content).join('\n').slice(0, tgaiChat.maxChars || 2000); 433 // Use existing generate/modify flow with SAFE prompt 434 // IMPORTANT: Never send the full chat transcript to the backend. 435 // The transcript can include AI HTML (upgrade prompts, overlays) which pollutes the AI request. 436 const cleanText = String(text) 437 // Strip HTML tags if user pasted HTML 438 .replace(/<\/?[a-z][^>]*>/gi, ' ') 439 // Collapse whitespace 440 .replace(/\s+/g, ' ') 441 .trim(); 442 const compactPrompt = ('User: ' + cleanText).slice(0, tgaiChat.maxChars || 2000); 395 443 396 444 // DEBUG: Check what we have -
talkgenai/trunk/talkgenai.php
r3416221 r3423014 1 1 <?php 2 2 /** 3 * Plugin Name: TalkGenAI : AI Calculator Builder, Countdown Timer & To-Do List3 * Plugin Name: TalkGenAI – AI App Builder: Calculator, Timer, Todo List, ROI Tool & Custom Widgets 4 4 * Plugin URI: https://app.talkgen.ai 5 5 * Description: Generate complete web applications using AI. Connect to TalkGenAI server for intelligent app generation with WordPress integration.
Note: See TracChangeset
for help on using the changeset viewer.