Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions VOICE_AGENT_INTEGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Farm Vaidya Voice Agent - Integration Complete! ✅

## What's Been Added

### 1. Files Copied
- ✅ `src/components/VoiceAgent.tsx` - Main voice agent component
- ✅ `src/components/ui/*` - UI components (button, card, tooltip, toaster)
- ✅ `src/hooks/use-toast.ts` - Toast notification hook
- ✅ `src/app/voice-agent.css` - CSS animations
- ✅ `public/Farm-vaidya-icon.png` - Voice agent icon

### 2. Dependencies Installed
- ✅ @daily-co/daily-js (voice infrastructure)
- ✅ sonner (toast notifications)
- ✅ lucide-react (icons)
- ✅ clsx & tailwind-merge (styling utilities)

### 3. Environment Variables Added
Check your `.env.local` - these were added:
```
NEXT_PUBLIC_PIPECAT_TOKEN=pk_aff3af37-4821-4efc-9776-1f2d300a52d0
NEXT_PUBLIC_PIPECAT_ENDPOINT=https://api.pipecat.daily.co/v1/public/techsprint/start
```

## How to Enable the Voice Agent

### Option 1: Add to All Pages (Recommended)

Edit `src/app/layout.tsx`:

```tsx
import VoiceAgent from '@/components/VoiceAgent';
import { Toaster } from 'sonner';
import './voice-agent.css'; // Add this import

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={`text-neutral-600 bg-(--background)`}>
<Navbar />
<AuthContextProvider>
<>
<Script ... />
<div className="h-[64px] md:hidden bg-(--background)" />
<main>
{children}
<Suspense>
<SignOutDialog />
</Suspense>
</main>

{/* Add Farm Vaidya Voice Agent */}
<VoiceAgent />
<Toaster />
</>
</AuthContextProvider>
</body>
</html>
);
}
```

### Option 2: Add to Specific Pages Only

In any page file (e.g., `src/app/page.tsx`):

```tsx
import VoiceAgent from '@/components/VoiceAgent';
import { Toaster } from 'sonner';
import './voice-agent.css';

export default function HomePage() {
return (
<div>
{/* Your existing content */}

{/* Add voice agent */}
<VoiceAgent />
<Toaster />
</div>
);
}
```

## How to Test

1. **Start the dev server:**
```bash
cd ~/techsprint
npm run dev
```

2. **Open in browser:**
- Go to http://localhost:3000
- You'll see a floating button with "Talk to Farm Vaidya" at bottom-left

3. **Click the button:**
- Grant microphone permission when prompted
- The agent will connect automatically
- Start speaking!

## Features

- ✅ Real-time voice conversations with AI farming expert
- ✅ Visual feedback when speaking
- ✅ Mute/unmute controls
- ✅ Call timer
- ✅ Floating widget (doesn't interfere with your site)
- ✅ Responsive design

## Customization

### Change Position
Edit `VoiceAgent.tsx` line ~256:
```tsx
// Change from bottom-left to bottom-right
<div className="fixed bottom-4 right-4 z-50 ...">
```

### Change Bot Name/Icon
- Replace `/public/Farm-vaidya-icon.png` with your icon
- Edit text in VoiceAgent.tsx

### Disable on Certain Pages
Wrap with conditional:
```tsx
{!pathname.includes('/admin') && <VoiceAgent />}
```

## Next Steps

1. Add the voice agent to your layout (see Option 1 above)
2. Test it out
3. Customize as needed

Need help? The voice agent is fully functional and ready to use!
151 changes: 150 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,23 @@
"lint": "eslint"
},
"dependencies": {
"@daily-co/daily-js": "^0.85.0",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.1",
"@mui/icons-material": "^7.3.6",
"@mui/material": "^7.3.6",
"clsx": "^2.1.1",
"firebase": "^12.7.0",
"lodash": "^4.17.21",
"lottie-web": "^5.12.2",
"lucide-react": "^0.562.0",
"next": "16.1.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-fast-marquee": "^1.6.5",
"react-qr-code": "^2.0.18"
"react-qr-code": "^2.0.18",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0"
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
Expand All @@ -33,4 +38,4 @@
"tailwindcss": "^4",
"typescript": "^5"
}
}
}
Binary file added public/Farm-vaidya-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading