Spaces:
Sleeping
Sleeping
Commit History
13 days ago
-
Update dependencies and fix runtime bugs found in audit
Dependencies - Pin Streamlit 1.67.0 and Python 3.12 via README sdk_version/python_version - Update all packages to current releases (pandas 3.1, numpy 2.5, plotly 7.1, PyMuPDF 2.1, Pillow 13, OpenCV 5, reportlab 5.1, google-genai 3.1, firebase-admin 7.7, Document AI 3.17) - Remove unused packages: langchain, langchain-core, langchain-community, langchain-google-genai, langsmith, google-generativeai (deprecated), fpdf2, imageio, python-docx, python-dotenv, pyyaml - Add beautifulsoup4 (used for HTML table parsing) and packages.txt with tesseract-ocr so the Tesseract OCR fallback works on Spaces Streamlit API - Replace deprecated use_container_width=True with width="stretch" (136 calls) - Replace deprecated st.components.v1.html with st.iframe via embed_html helper Bug fixes - CropDrive parent-window listener script had a JS syntax error (doubled braces in a non f-string), so language/config messages were never handled - OCR: missing `io` import broke PDF-to-image conversion…3f62288
-
feat: add Indonesian (Bahasa Indonesia) language support
Mark Cuizon- Add full 'id' translation dictionary to translations.py with ~300+ keys - Update get_language(), set_language(), toggle_language() to support 'id' - Toggle now cycles en -> ms -> id -> en - Add Indonesian LLM language instruction in analysis_engine.py - Update all language validations in cropdrive_integration.py to include 'id' - Update app.py fallback language checks to include 'id' - AI assistant, analysis results and PDF reports all translate to Indonesian when lang=idb63bb45
-
Fix Step 6 errors and analysis limit enforcement - Fix 'str' object has no attribute 'get' error in forecast graph - Fix interpretations and key_findings display formatting issues - Fix analysis limit check order to use updated session state - Add proper type validation for forecast data
197ef6c
-
Update send_analysis_complete to match AI Assistant Integration Guide format - Remove userId from message (website uses authenticated user ID) - Update message format to match exact guide specification - Update error handling to send ANALYSIS_ERROR messages - Add documentation references to integration guide
307f1c9
-
feat: Add SCRIPT_RUN_STATE_CHANGED communication functions
- Add send_script_run_state_changed() for analysis progress updates - Add send_error_message() for error status notifications - Add send_progress_update() for step-by-step progress tracking - Complete implementation of all message types from communication guide - Fix type annotations for new functionseaa5dc3
-
feat: Implement AI Assistant Integration Guide
- Update CONFIG message handling to store user config in window.userConfig - Enhance ANALYSIS_COMPLETE message sending with proper format and sessionStorage backup - Add REQUEST_CONFIG_UPDATE functionality for config synchronization - Implement comprehensive error handling with safePostMessage function - Add automatic config update requests after analysis completion - Improve bidirectional communication between AI assistant and CropDrive website99cf00c -
Fix: Add REQUEST_CONFIG_UPDATE after ANALYSIS_COMPLETE and enhanced logging
- Added REQUEST_CONFIG_UPDATE message requests after sending ANALYSIS_COMPLETE - Increased delay to 2 seconds to allow parent time to process ANALYSIS_COMPLETE - Added backup request after 5 seconds - Enhanced logging for upload count updates - Added warnings about parent website needing to increment upload count - Improved CONFIG message handling to update URL params NOTE: Parent website MUST increment upload count when it receives ANALYSIS_COMPLETE. If parent sends CONFIG with old count, it will overwrite optimistic update.7a7eafd -
Fix: Add optimistic upload count update after ANALYSIS_COMPLETE
- Added optimistic upload count increment in Python session state before sending ANALYSIS_COMPLETE - Added optimistic update in JavaScript sessionStorage and URL params - Updated upload.py to always read from URL params (most up-to-date source) - Enhanced CONFIG message handling with logging - Added CONFIG_UPDATE handler for non-reload updates - Ensures upload count (e.g., 0/2 used) updates immediately after analysis completes - Multiple update mechanisms ensure count stays in syncddd3171 -
Fix: Add ANALYSIS_COMPLETE message sending and Firestore save with user ID
- Added send_analysis_complete() function to send ANALYSIS_COMPLETE message to parent website - Enhanced store_analysis_to_firestore() to reliably save with user_id for website queries - Added logger import to cropdrive_integration.py (was missing, causing silent failures) - Called send_analysis_complete() immediately after analysis completes in process_new_analysis() - Improved error handling and logging throughout - Ensures analysis results are saved to Firestore with user_id so website can fetch them - Message format matches exact specification required by parent website43e20d5 -
Fix analysis completion: ensure user_id is included and message sent correctly
- Add extensive logging to debug user_id retrieval issues - Ensure ANALYSIS_COMPLETE message includes user_id from multiple sources - Add fallback to get user_id from URL params if session state missing - Improve error handling and logging in send_analysis_complete() - Ensure Firestore save includes user_id before sending message - Add userId to analysis_data for redundancy - Add detailed console logging in JavaScript for debuggingaf79a1f -
Fix postMessage origin mismatch: use '*' as target origin
- Update send_analysis_complete() to use '*' instead of specific origins - Update send_feature_restricted() to use '*' instead of specific origins - Update send_language_change() to use '*' instead of specific origins - Parent page will verify message origin on its side - This fixes the 'target origin does not match recipient window origin' error0da4769 -
Fix upload limit calculation logic
- Calculate uploads_remaining as uploads_limit - uploads_used instead of trusting parent value - Fix can_start_analysis() to recalculate remaining for accuracy - Fix display to show correct remaining count (e.g., 0/2 used = 2 remaining, not 0) - Ensure limit is only reached when uploads_used >= uploads_limit82b42ca -
Add CropDrive integration: upload limits enforcement and analysis completion messaging
- Update cropdrive_integration.py to handle CONFIG messages with upload limits - Add can_start_analysis() function to check upload limits before analysis - Add get_upload_limit_info() helper function - Update send_analysis_complete() to include ISO timestamp - Update upload.py to enforce upload limits before allowing analysis - Display upload usage information on upload page - Update results.py to ensure ANALYSIS_COMPLETE message includes timestamp - Handle unlimited plans (infinity/-1) properly9d3b8a9
-
Add Malaysian language support for PDF reports and improve user tracking - Add PDF translations for English and Malaysian - Update PDF download buttons to use translations - Update generate_results_pdf to pass language to generator - Improve CropDrive integration to send user ID with analysis results - Send messages to all allowed origins for better website integration
ad3ced0
-
Add user ID tracking and language handling for CropDrive integration - Save analysis results with user ID from CropDrive website - Enhanced language handling with URL params and postMessage support - Improved bidirectional communication between Streamlit and parent website
0930564
-
clean repo
fb5dc87