A comprehensive LINE Bot application that helps users manage their refrigerator contents with AI-powered food recognition and expiration tracking.
- Rich Menu Navigation: Easy-to-use interface with visual buttons
- Interactive Messaging: Natural language processing for user commands
- Flexible Message Types: Support for text, images, carousels, and LIFF web apps
- Azure Custom Vision: Automatic food classification from uploaded images
- Smart Categorization: Recognizes 12+ food categories (蔬果, 海鮮, 肉類, etc.)
- Image Processing: Handles multiple formats (PNG, JPG, JPEG, WebP)
- Add Items: Manual entry or AI-assisted recognition
- Edit Items: Update food details, quantities, and expiration dates
- Delete Items: Safe removal with confirmation prompts
- Smart Search: Find items by keywords, categories, or locations
- Expiration Alerts: Daily reminders for expired and soon-to-expire items
- Status Filtering: View items by expiration status (expired, fresh)
- Time-based Queries: Filter by specific dates and time ranges
- Category Management: 12 food categories with visual icons
- Storage Location: Track items in 冷藏 (refrigerator), 冷凍 (freezer), or 室溫 (room temperature)
- Quantity Tracking: Monitor item quantities and usage
- Flask: Web framework for API endpoints and LIFF integration
- AWS DynamoDB: NoSQL database for food item storage
- Azure Blob Storage: Cloud storage for food images
- Azure Custom Vision: AI service for food classification
- LIFF (LINE Front-end Framework): Mobile-optimized web interface
- Bootstrap: Responsive UI components
- jQuery: Interactive form handling and date pickers
- LINE Bot SDK: Official SDK for bot functionality
- Rich Menu API: Visual menu interface
- Webhook Handling: Real-time message processing
- LIFF Integration: Seamless web app experience within LINE
fridge_linebot/
├── application.py # Main Flask application
├── line_chatbot_api.py # LINE Bot API configuration
├── awsdb.py # DynamoDB database operations
├── requirements.txt # Python dependencies
├── line_service/
│ ├── service.py # LINE Bot message handlers
│ └── rich_menu.py # Rich menu management
├── templates/ # HTML templates for LIFF
│ ├── addItem.html # Add item form
│ ├── editItem.html # Edit item form
│ ├── all_item_info.html # Item listing
│ └── recItem.html # Recognition interface
└── static/
├── addItem.css # Custom styling
└── images/ # Static assets
- Python 3.7+
- LINE Developer Account
- AWS Account with DynamoDB access
- Azure Account with Custom Vision and Blob Storage
-
Clone the repository
git clone https://github.com/yourusername/fridge_linebot.git cd fridge_linebot -
Install dependencies
pip install -r requirements.txt
-
Configure environment variables
# LINE Bot Configuration export LINE_CHANNEL_ACCESS_TOKEN="your_access_token" export LINE_CHANNEL_SECRET="your_channel_secret" # AWS Configuration export AWS_ACCESS_KEY_ID="your_aws_key" export AWS_SECRET_ACCESS_KEY="your_aws_secret" # Azure Configuration export AZURE_CUSTOM_VISION_KEY="your_custom_vision_key" export AZURE_STORAGE_CONNECTION_STRING="your_blob_connection"
-
Set up database
- Create DynamoDB table named
MyFridge - Configure partition key:
userid(String) - Configure sort key:
id(String)
- Create DynamoDB table named
-
Configure Azure services
- Set up Custom Vision project for food classification
- Create Blob Storage container for images
- Update project IDs and endpoints in code
-
Run the application
python application.py
新增商品- Add new food item顯示商品- View food items with filtering options全部商品- Show all items in carousel or LIFF interface依據時效- Filter by expiration status依據類別- Filter by food category依據位置- Filter by storage location到期提醒- Get expiration alerts
- 🥕 蔬果 (Vegetables & Fruits)
- 🐟 海鮮 (Seafood)
- 🥩 肉類 (Meat)
- 🍜 麵類 (Noodles & Pasta)
- 🍚 飯類 (Rice)
- 🥛 乳製品 (Dairy Products)
- 🍳 蛋類 (Eggs)
- 🍞 麵包 (Bread)
- 🍰 甜點 (Desserts)
- 🍗 炸物 (Fried Foods)
- 🥣 湯類 (Soups)
- ℹ️ 其他 (Other)
- 🧊 冷藏 (Refrigerator)
- ❄️ 冷凍 (Freezer)
- 🌡️ 室溫 (Room Temperature)
- Create a new LINE Bot channel
- Configure webhook URL:
https://yourdomain.com/callback - Enable LIFF for web interface integration
- Upload rich menu image and configure menu areas
{
"userid": "LINE user ID",
"id": "Unique item UUID",
"itemName": "Food item name",
"itemDate": "Expiration date (YYYY-MM-DD)",
"itemNum": "Quantity",
"itemPlace": "Storage location",
"itemType": "Food category",
"itemImage": "Azure Blob Storage URL",
"exp": "Timestamp for expiration tracking"
}- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- LINE Corporation for the LINE Bot SDK and platform
- Microsoft Azure for Custom Vision and Blob Storage services
- Amazon Web Services for DynamoDB infrastructure
- Central Taiwan University (NCU) for academic support
For support and questions, please open an issue on GitHub or contact the development team.
Built with ❤️ for smarter food management