This project is a React application built with Vite, designed to act as an AI-powered recipe generator named "Chef Gemini". It allows users to input ingredients they have on hand and receive a recommended recipe generated by the Google Generative AI model.
- Ingredient Input: Easily add ingredients you have available.
- AI-Powered Recipe Generation: Utilizes Google Generative AI (Gemini-2.5-flash-lite-preview-06-17) to suggest recipes based on your ingredients.
- Markdown Recipe Display: Recipes are formatted in Markdown for clear and readable presentation.
- Dynamic UI: Responsive user interface built with React, including a loading indicator and automatic scrolling to the recipe.
- Environment Variable Management: Securely manages API keys using
dotenv.
- Frontend: React, Vite
- AI SDK:
@google/generative-ai - Other:
dotenv,react-markdown
To get this project up and running, follow these steps:
-
Clone the repository:
git clone [repository-url] cd webdev/ai -
Install dependencies:
npm install
-
Set up environment variables:
Create a
.envfile in thewebdev/aidirectory and add your Google Generative AI API key:VITE_GOOGLE_API_KEY=your_google_api_keyReplace
your_google_api_keywith your actual Google Generative AI API key.
-
Start the development server:
npm run dev
This will start the Vite development server, and you can access the application in your browser, usually at
http://localhost:5173. -
Add Ingredients: In the application, use the input field to add ingredients you have.
-
Get a Recipe: Once you have added at least 4 ingredients, a "Get a recipe" button will appear. Click it to generate a recipe.
-
View Recipe: The AI-generated recipe will be displayed below your ingredient list.
webdev/ai/
├── public/
├── src/
│ ├── components/
│ │ ├── aii.js # Handles Google Generative AI interaction
│ │ ├── ClaudeRecipe.jsx # Renders the AI-generated recipe
│ │ ├── Content.jsx # Main application logic, ingredient management, and recipe fetching
│ │ ├── header.jsx # Displays the "Chef Gemini" title and logo
│ │ └── IngredientsList.jsx # Displays user's ingredients and "Get Recipe" button
│ ├── App.css
│ ├── App.jsx # Root component, renders Header and Content
│ └── main.jsx # Entry point of the React application
├── .env # Environment variables (e.g., API keys)
├── .gitignore
├── index.html
├── package.json # Project dependencies and scripts
├── README.md # Project documentation
└── vite.config.js # Vite configuration
Contributions are welcome! Please feel free to open issues or submit pull requests.
[Specify your license here, e.g., MIT License]