Skip to content

Conversation

yangm2
Copy link
Contributor

@yangm2 yangm2 commented Aug 15, 2025

This PR adds the ability for users to upload pictures of documents (like eviction notices) and uses Google Gemini's Vision API to analyze them.

Features

  • Users can upload images (png, jpg, jpeg) or PDF documents
  • Google Gemini Vision API analyzes the documents for eviction notice details
  • Analysis focuses on identifying deficiencies and issues with notices
  • Results are seamlessly integrated into the chat history
  • Files are securely stored temporarily and cleaned up after analysis

Implementation

  • Added frontend file upload component in DocumentUpload.tsx
  • Created backend upload.py module for handling file uploads
  • Added API route for file upload endpoint in app.py
  • Added auto-creation of uploads directory in persistent storage
  • Integrated with existing Google Gemini infrastructure

Closes #39

🤖 Generated with Claude Code

This PR adds the ability for users to upload pictures of documents (like eviction notices) and uses Google Gemini's Vision API to analyze them.

## Features
- Users can upload images (png, jpg, jpeg) or PDF documents
- Google Gemini Vision API analyzes the documents for eviction notice details
- Analysis focuses on identifying deficiencies and issues with notices
- Results are seamlessly integrated into the chat history
- Files are securely stored temporarily and cleaned up after analysis

## Implementation
- Added frontend file upload component in DocumentUpload.tsx
- Created backend upload.py module for handling file uploads
- Added API route for file upload endpoint in app.py
- Added auto-creation of uploads directory in persistent storage
- Integrated with existing Google Gemini infrastructure

Closes #39

Co-authored-by: yangm2 <[email protected]>
@yangm2 yangm2 added enhancement New feature or request backend Bot implementation and other backend concerns frontend Frontend implementation (follows UX design) Not ready labels Aug 15, 2025
@yangm2
Copy link
Contributor Author

yangm2 commented Aug 15, 2025

@claude add python tests for upload.py

Copy link
Contributor

claude bot commented Aug 15, 2025

Claude finished @yangm2's task —— View job


Adding Python tests for upload.py ✅

Todo List:

  • Read repository guidelines (CLAUDE.md)
  • Examine existing test structure
  • Analyze upload.py functionality
  • Create comprehensive test suite
  • Run tests to verify functionality
  • Commit and push changes

Comprehensive test suite created for upload.py 🎯

Test Coverage:

  • File Validation (TestAllowedFile): Extension checking, case handling, edge cases
  • DocumentAnalyzer (TestDocumentAnalyzer): Initialization, analysis, streaming, MIME type mapping
  • UploadView (TestUploadView): Authentication, file upload, validation, streaming responses, error handling
  • Module Level (TestUploadModule): Constants, folder creation, prompt validation

Key Features Tested:

  • ✅ File type validation (png, jpg, jpeg, pdf)
  • ✅ File size limits (10MB max)
  • ✅ Session authentication and management
  • ✅ Google Gemini Vision API integration (mocked)
  • ✅ Streaming response handling
  • ✅ File cleanup and security measures
  • ✅ Error handling for various failure scenarios

Files Created:

  • backend/tests/test_upload.py - 387 lines of comprehensive tests

The test suite follows the existing project patterns and includes proper mocking for external dependencies like Google Cloud services. All tests are designed to run in isolation without requiring actual API keys or external services.
| Branch: claude/issue-39-20250815-2200

claude bot and others added 4 commits August 15, 2025 22:15
- Test file validation and allowed extensions
- Test DocumentAnalyzer initialization and document analysis
- Test UploadView request handling, validation, and streaming responses
- Test session management and error handling scenarios
- Test file cleanup and security measures
- Mock Google Cloud dependencies for isolated testing

Co-authored-by: yangm2 <[email protected]>
@yangm2 yangm2 added this to the V1 milestone Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Bot implementation and other backend concerns enhancement New feature or request frontend Frontend implementation (follows UX design) Not ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Idea: allow user to upload pictures of documents (i.e. eviction notices) and use openai to parse them
1 participant