Nuggt is an LLM-powered agent that helps optimize user experiences by analyzing event data captured in React components. This project integrates with Firebase to store event data, utilizes analytics to track user interactions, and generates decision cards to suggest improvements based on user behavior. The LLM agent can assist in making decisions and generating code based on the insights derived from these decision cards.
nuggt-demo.mp4
# Clone the repository
git clone <your-repo-url>
# Navigate to the project directory
cd <your-repo-directory>
# Install the required dependencies
pip install -r requirements.txt
# Run streamlit
streamlit run app.py
This project is broken down into three key steps:
- Setup: Configure your environment and dependencies, such as the OpenAI API key, Firebase service account, and integrating your Next.js project.
- Connecting Analytics to React Code: Set up analytics to track user interactions and capture events in your React components.
- Generating Decision Cards and Visualizations: Use the dashboard to generate decision cards and visualizations to gain insights and take action on improving the UI/UX.
To get started, follow these steps to set up your environment:
-
Set up OpenAI API Key:
- Add your OpenAI API key to the
app.py
file.
- Add your OpenAI API key to the
-
Update Firebase Service Account Key:
- Replace the Firebase
serviceAccountKey.json
file with your Firebase credentials.
- Replace the Firebase
-
Add Your Next.js Project:
- Place your Next.js project in the
uploaded_projects
folder. - The
SessionWrapper.tsx
andSessionContext.tsx
files are already available in the repo. Instructions on how to set this up is on the instructions page (app.py)
- Place your Next.js project in the
-
Set up Firebase:
- Create a
firebase.js
file under thelib
folder to configure Firebase and Firestore.
- Create a
-
Run the App:
- Make sure your project can run at:
npm run dev
- Navigate to the Launchpad page and select the React component you want to track.
- Generate tracking suggestions by clicking Generate Tracking Suggestions in the Events to Capture tab.
- Integrate analytics by clicking Integrate Analytics and verifying the event logs in the browser console.
- Connect to Firestore and set up Firebase to store captured events by providing a unique ID for your component.
Before proceeding, ensure you have generated some session data.
- Fetch data by selecting your Firebase-connected component and clicking Fetch Data.
- Generate decision cards to gain insights and suggestions based on your data metrics.
- Activate cards to apply the insights, and refresh the page to see active cards.
- Use the LLM agent to interact with any active decision card, discuss insights, or generate code.