An open API service indexing awesome lists of open source software.

https://github.com/hddevteam/smart-form-filler

AI-powered form filling and data extraction browser extension
https://github.com/hddevteam/smart-form-filler

ai-powered browser-extension chrome-extension data-extraction demo-site developer-tools form-automation form-filling github-pages gpt-integration javascript local-ai machine-learning nodejs ollama privacy-focused productivity-tools web-automation

Last synced: 24 days ago
JSON representation

AI-powered form filling and data extraction browser extension

Awesome Lists containing this project

README

          

# Smart Form Filler - AI-Powered Browser Extension

A standalone browser extension for intelligent data extraction and form filling using AI technology. Now with **Ollama local model support**!

[![Version](https://img.shields.io/badge/version-2.0.0-blue.svg)](https://github.com/hddevteam/smart-form-filler/releases)
[![License](https://img.shields.io/badge/license-ISC-green.svg)](LICENSE)
[![Chrome Extension](https://img.shields.io/badge/Chrome-Extension-orange.svg)](https://github.com/hddevteam/smart-form-filler)
[![AI Powered](https://img.shields.io/badge/AI-Powered-purple.svg)](https://github.com/hddevteam/smart-form-filler)

🌐 **[Live Demo & Documentation](https://hddevteam.github.io/smart-form-filler/)** | πŸ“¦ **[Download Latest Release](https://github.com/hddevteam/smart-form-filler/releases/latest)** | πŸ“– **[View Documentation](https://github.com/hddevteam/smart-form-filler/wiki)** | πŸŽ₯ **[Watch Demo Video](https://demoforgithub.blob.core.windows.net/videos/smart-form-filler-demo.mp4)**

## 🌍 Language Versions

- [πŸ‡ΊπŸ‡Έ English](README.md) | [πŸ‡¨πŸ‡³ δΈ­ζ–‡](README_zh.md)

## πŸ“Έ Screenshots

![Smart Form Filler in Action](screenshots/screenshot_formfiller.png)

*Smart Form Filler analyzing and auto-filling a complex web form*

> **πŸ’‘ Tip**: The demo showcases all major features including AI-powered form filling, data extraction

## πŸš€ Features

- **Data Extraction**: Extract structured data from web pages
- **Smart Form Filling**: AI-powered automatic form completion with intelligent field mapping
- **Multi-format Output**: Raw HTML, cleaned HTML, and Markdown formats
- **Chat with Data**: Interactive Q&A with extracted content
- **Local AI Models**: Full Ollama integration for privacy-focused AI
- **Cloud AI Models**: Support for GPT-4o, o series, DeepSeek, and other cloud providers
- **Backend Configuration**: Built-in settings interface for configuring backend connections
- **Service Status Monitoring**: Real-time backend connection status and error handling
- **Intelligent Field Analysis**: Enhanced field descriptions including available options for dropdowns, radio buttons, and checkboxes
- **Browser Integration**: Works seamlessly with Chrome and other Chromium-based browsers

## πŸ“ Project Structure

```
smart-form-filler/
β”œβ”€β”€ backend/ # Backend API server
β”‚ β”œβ”€β”€ controllers/ # API controllers
β”‚ β”œβ”€β”€ services/ # Business logic services
β”‚ β”œβ”€β”€ routes/ # API routes
β”‚ β”œβ”€β”€ config/ # Configuration files
β”‚ └── server.js # Main server file
β”œβ”€β”€ extension/ # Browser extension
β”‚ β”œβ”€β”€ src/ # Extension source code
β”‚ β”œβ”€β”€ manifest.json # Extension manifest
β”‚ └── popup.html # Extension popup UI
└── package.json # Root package configuration
```

## πŸ“ Architecture & Code Organization

### Modular Structure

The Smart Form Filler extension has been refactored into a clean, modular architecture to improve maintainability and code organization. **All files are properly sized** for optimal maintainability.

#### Core Modules

**🎯 Main Entry Point:**
- `popup-main.js` - Lightweight entry point that initializes the modular system

**πŸ“¦ Core Manager Modules:**
- `popupManager.js` - Main coordinator orchestrating all popup functionality
- `popupInitializer.js` - Handles DOM element initialization and validation
- `popupEventHandlers.js` - Manages all user interactions and UI events
- `popupModelManager.js` - AI model loading, selection, and management
- `popupSettingsManager.js` - Backend configuration and settings persistence

**πŸ”§ Feature Modules:**
- `formFillerHandler.js` - Form detection and filling functionality
- `formAnalysisService.js` - Form content analysis and mapping
- `uiController.js` - UI state management and visual feedback
- `resultsHandler.js` - Results display and data management
- `chatHandler.js` - Chat interface and AI interactions
- `dataExtractor.js` - Page content extraction from web pages
- `apiClient.js` - Backend API communication
- `authManager.js` - User authentication handling

#### Key Benefits of Modular Structure

βœ… **Maintainability**: Each module has a single responsibility
βœ… **Modular Design**: Proper file sizes for easy navigation and maintenance
βœ… **Testability**: Modules can be tested independently
βœ… **Extensibility**: New features can be added as separate modules
βœ… **Debugging**: Clear separation of concerns makes troubleshooting easier

#### Module Dependencies

```
popup-main.js
└── PopupManager
β”œβ”€β”€ PopupInitializer (DOM setup)
β”œβ”€β”€ PopupSettingsManager (backend config)
β”œβ”€β”€ PopupModelManager (AI models)
β”œβ”€β”€ PopupEventHandlers (user interactions)
└── Feature Modules
β”œβ”€β”€ FormFillerHandler
β”œβ”€β”€ UIController
β”œβ”€β”€ ResultsHandler
β”œβ”€β”€ ChatHandler
└── DataExtractor
```

## πŸ› οΈ Installation & Setup

### Prerequisites
- Node.js (v14 or higher)
- npm or yarn

### Backend Setup
```bash
# Install dependencies
npm run install:all

# Start development server
npm run dev
```

### Extension Setup
1. Open Chrome and navigate to `chrome://extensions/` (`edge://extensions/` for Edge browsers)
2. Enable "Developer mode"
3. Click "Load unpacked" and select the `extension` folder
4. The extension should now appear in your browser toolbar

### 🎯 Interactive Demo
Experience all extension features with our **live interactive demo** at:

**🌐 [https://hddevteam.github.io/smart-form-filler/](https://hddevteam.github.io/smart-form-filler/)**

The demo includes:
- **🍽️ Restaurant Feedback Form**: Complete with realistic scenarios
- **πŸ“Š Data Extraction**: Interactive profile extraction demo
- **πŸ’¬ AI Chat**: Chat with extracted data functionality
- **🎯 Prompt Examples**: Specific scenarios like birthday celebrations, business dinners, family meals

#### Demo Features & Prompt Examples
```
🍽️ Satisfied Customer:
"Fill this restaurant feedback form as John Smith (john.smith@techcorp.com) who just had dinner at Mario's Italian Restaurant. Give a 5-star rating and positive detailed comments about the seafood pasta and excellent service."

πŸŽ‚ Birthday Celebration:
"Fill this feedback as someone who celebrated their birthday here. Mention the surprise dessert, decorations, and how the staff made the evening special."

πŸ’Ό Business Lunch:
"Complete this form as a business professional who brought clients here. Focus on the quiet atmosphere, prompt service, and quality food that impressed the clients."
```

## πŸ”§ Development

### Backend Development
```bash
cd backend
npm run dev
```

The backend server will start on `http://localhost:3001`

### API Endpoints
- `GET /api/extension/health` - Health check
- `GET /api/extension/models` - Available AI models
- `POST /api/extension/extract-data-sources` - Extract page data
- `POST /api/extension/chat-with-data` - Chat with extracted data
- `POST /api/form-filler/analyze-form-relevance` - Analyze form relevance
- `POST /api/form-filler/analyze-field-mapping` - Generate field mappings

## βš™οΈ Configuration

### Backend Configuration

The extension includes a built-in settings interface for configuring the backend connection:

#### Using the Settings Interface
1. **Open Settings**: Click the βš™οΈ settings button in the extension header
2. **Configure Backend URL**: Enter your backend server URL (default: `http://localhost:3001`)
3. **Test Connection**: Click "Test" to verify the connection
4. **Save Settings**: Click "Save" to apply the new configuration

#### Features
- **Persistent Storage**: Settings are saved across browser sessions
- **Connection Testing**: Real-time validation of backend connectivity
- **Error Handling**: Clear feedback for connection issues
- **Auto-reload**: Models automatically refresh when backend changes

#### Default Configuration
```
Backend URL: http://localhost:3001
```

### Environment Variables

Copy `.env.example` to `.env` and configure your environment variables:

```bash
cd backend
cp .env.example .env
```

### Ollama Configuration (Optional)
For local AI model support, add to your `.env` file:
```env
OLLAMA_URL=http://localhost:11434
```

## πŸ€– Ollama Integration

This extension supports **Ollama local models** for privacy-focused AI! Use your own locally-hosted models alongside cloud providers.

### πŸš€ Quick Setup

#### 1. Install Ollama
Visit [https://ollama.ai/](https://ollama.ai/) and install Ollama for your platform.

#### 2. Start Ollama Service
```bash
ollama serve
```

#### 3. Download Models
```bash
# Recommended models for form filling and data extraction
ollama pull llama2
ollama pull mistral
ollama pull codellama
ollama pull qwen2.5:7b
ollama pull deepseek-r1
```

#### 4. Use in Extension
1. Open the extension popup
2. Click the πŸ”„ refresh button next to "AI Model"
3. Select from **Local Models (Ollama)** or **Cloud Models**
4. Enjoy private, local AI processing!

### πŸ”§ Features

- **Auto-Discovery**: Automatically detects running Ollama servers
- **Model Hot-Loading**: Refresh model list without restarting
- **Unified Interface**: Seamless switching between local and cloud models
- **Privacy-First**: Data never leaves your machine with local models

### πŸ“‹ Recommended Models

| Model | Use Case | Command |
|-------|----------|---------|
| `llama2` | General tasks | `ollama pull llama2` |
| `mistral` | High performance | `ollama pull mistral` |
| `codellama` | Code understanding | `ollama pull codellama` |
| `qwen2.5:7b` | Multilingual | `ollama pull qwen2.5:7b` |
| `deepseek-r1` | Reasoning tasks | `ollama pull deepseek-r1` |

### πŸ› οΈ Troubleshooting

#### Backend Connection Issues

**Service Unavailable Message**
If you see "⚠️ Service unavailable - Check backend connection":
1. **Check Backend Server**: Ensure the backend is running on the configured URL
2. **Verify URL**: Click βš™οΈ settings and verify the backend URL is correct
3. **Test Connection**: Use the "Test" button in settings to verify connectivity
4. **Check Network**: Ensure no firewall or network issues blocking the connection

**Models Not Loading**
1. **Backend Status**: Verify backend server is running (`npm run dev`)
2. **URL Configuration**: Check settings for correct backend URL
3. **Refresh Models**: Click the πŸ”„ refresh button
4. **Check Logs**: Look at browser console for specific error messages

#### Ollama Integration Issues

**Models Not Showing?**
1. **Check Ollama Status**: `curl http://localhost:11434/api/tags`
2. **List Models**: `ollama list`
3. **Restart Ollama**: `ollama serve`
4. **Refresh Extension**: Click πŸ”„ button

**Connection Issues?**
- Ensure Ollama runs on `http://localhost:11434`
- Check firewall settings
- Update `OLLAMA_URL` if using custom port

## πŸ§ͺ Testing

```bash
# Run tests
npm test
```

## πŸ“¦ Building for Production

```bash
# Build extension for production
npm run build:extension
```

## 🀝 Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## πŸ“„ License

This project is licensed under the ISC License.

## πŸ”— Related Links

- [Chrome Extension Developer Guide](https://developer.chrome.com/docs/extensions/)
- [Node.js Documentation](https://nodejs.org/docs/)
- [Express.js Documentation](https://expressjs.com/)