Untitled
8 hours ago in Plain Text
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>NETA - AI Electrical Assistant</title>
<!-- Tailwind CSS -->
<script src="https://cdn.tailwindcss.com"></script>
<!-- React Libraries -->
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<!-- Babel for JSX transpilation -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<!-- Lucide Icons -->
<script src="https://unpkg.com/lucide-react@latest/dist/umd/lucide-react.js"></script>
<!-- Custom CSS for animation and font -->
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
body {
font-family: 'Inter', sans-serif;
}
html {
scroll-behavior: smooth;
}
@keyframes pulse-glow {
0%, 100% { box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.4); }
50% { box-shadow: 0 0 10px 8px rgba(56, 189, 248, 0); }
}
.animate-pulse-glow {
animation: pulse-glow 2.5s infinite;
}
</style>
</head>
<body class="bg-gray-50 dark:bg-gray-900">
<div id="root"></div>
<script type="text/babel">
// --- Setup for Lucide Icons ---
const { Bot, User, Zap, ShieldCheck, UploadCloud, HardHat, ArrowRight, LoaderCircle, CheckCircle, AlertTriangle, Gift } = lucide;
// --- Helper Components ---
const IconWrapper = ({ children }) => (
<div className="bg-sky-100 dark:bg-sky-900 text-sky-600 dark:text-sky-400 p-3 rounded-full">
{children}
</div>
);
const FeatureCard = ({ icon, title, children }) => (
<div className="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-lg hover:shadow-xl transition-shadow duration-300 transform hover:-translate-y-1 border border-gray-200 dark:border-gray-700">
<div className="flex items-center space-x-4 mb-4">
<IconWrapper>{icon}</IconWrapper>
<h3 className="text-xl font-bold text-gray-800 dark:text-white">{title}</h3>
</div>
<p className="text-gray-600 dark:text-gray-300">{children}</p>
</div>
);
const MessageBox = ({ message, role }) => {
const isUser = role === 'user';
return (
<div className={`flex items-start gap-4 my-4 ${isUser ? 'justify-end' : ''}`}>
{!isUser && <div className="flex-shrink-0 w-10 h-10 bg-sky-500 text-white rounded-full flex items-center justify-center"><Bot /></div>}
<div className={`max-w-xl p-4 rounded-2xl ${isUser ? 'bg-sky-600 text-white rounded-br-none' : 'bg-gray-200 dark:bg-gray-700 text-gray-800 dark:text-gray-100 rounded-bl-none'}`}>
<p style={{ whiteSpace: 'pre-wrap' }}>{message}</p>
</div>
{isUser && <div className="flex-shrink-0 w-10 h-10 bg-gray-300 dark:bg-gray-600 text-gray-800 dark:text-white rounded-full flex items-center justify-center"><User /></div>}
</div>
);
};
const ImageAnalysisResult = ({ analysis, error }) => {
if (error) {
return (
<div className="mt-6 p-4 bg-red-100 dark:bg-red-900 border border-red-300 dark:border-red-700 rounded-lg">
<div className="flex items-center">
<AlertTriangle className="h-6 w-6 text-red-600 dark:text-red-400 mr-3" />
<p className="text-red-800 dark:text-red-200 font-semibold">{error}</p>
</div>
</div>
);
}
if (!analysis) return null;
return (
<div className="mt-6 p-6 bg-white dark:bg-gray-800 rounded-2xl shadow-lg border border-gray-200 dark:border-gray-700">
<h4 className="text-xl font-bold text-gray-800 dark:text-white mb-4">NETA Analysis Results</h4>
<div className="prose prose-blue dark:prose-invert max-w-none">
<p style={{ whiteSpace: 'pre-wrap' }}>{analysis}</p>
</div>
</div>
);
};
// --- Main App Component ---
function App() {
const [chatHistory, setChatHistory] = React.useState([
{ role: 'model', parts: [{ text: "Hello! I'm NETA, your AI electrical expert. I'm completely free to use. Ask me anything about NEC codes, troubleshooting, or general electrical questions." }] }
]);
const [userInput, setUserInput] = React.useState('');
const [isGenerating, setIsGenerating] = React.useState(false);
const [imageFile, setImageFile] = React.useState(null);
const [imagePreview, setImagePreview] = React.useState(null);
const [imageAnalysis, setImageAnalysis] = React.useState('');
const [isAnalyzing, setIsAnalyzing] = React.useState(false);
const [analysisError, setAnalysisError] = React.useState('');
const fileInputRef = React.useRef(null);
const chatEndRef = React.useRef(null);
React.useEffect(() => {
chatEndRef.current?.scrollIntoView({ behavior: "smooth" });
}, [chatHistory]);
const handleSendMessage = async () => {
if (!userInput.trim() || isGenerating) return;
const newUserMessage = { role: 'user', parts: [{ text: userInput }] };
setChatHistory(prev => [...prev, newUserMessage]);
setUserInput('');
setIsGenerating(true);
try {
const prompt = `You are NETA, an expert AI assistant for electricians. Your knowledge is based on the National Electrical Code (NEC) and extensive electrical work experience. Answer the following user question accurately and concisely. If it involves code, try to cite the specific NEC article if possible. User question: "${userInput}"`;
const payload = { contents: [{ role: "user", parts: [{text: prompt}]}] };
const apiKey = "";
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`;
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`API call failed with status: ${response.status}`);
}
const result = await response.json();
let text = "Sorry, I couldn't generate a response. Please try again.";
if (result.candidates && result.candidates[0]?.content?.parts[0]?.text) {
text = result.candidates[0].content.parts[0].text;
}
setChatHistory(prev => [...prev, { role: 'model', parts: [{ text }] }]);
} catch (error) {
console.error("Error generating response:", error);
setChatHistory(prev => [...prev, { role: 'model', parts: [{ text: "I'm having trouble connecting right now. Please check your connection and try again later." }] }]);
} finally {
setIsGenerating(false);
}
};
const handleImageChange = (e) => {
const file = e.target.files[0];
if (file) {
setImageFile(file);
setImageAnalysis('');
setAnalysisError('');
const reader = new FileReader();
reader.onloadend = () => {
setImagePreview(reader.result);
};
reader.readAsDataURL(file);
}
};
const fileToGenerativePart = (file) => {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const base64Data = reader.result.split(',')[1];
resolve({
inlineData: {
mimeType: file.type,
data: base64Data
}
});
};
reader.onerror = (error) => reject(error);
reader.readAsDataURL(file);
});
};
const handleImageAnalysis = async () => {
if (!imageFile || isAnalyzing) return;
setIsAnalyzing(true);
setImageAnalysis('');
setAnalysisError('');
try {
const imagePart = await fileToGenerativePart(imageFile);
const prompt = "You are NETA, an AI electrical safety inspector. Analyze this image of electrical work. Identify any potential NEC code violations, safety issues, or areas for improvement. Provide a clear, concise report. State if the work looks compliant or if there are issues to address.";
const payload = {
contents: [{
parts: [ { text: prompt }, imagePart ]
}],
};
const apiKey = "";
const apiUrl = `https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`;
const response = await fetch(apiUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload)
});
if (!response.ok) {
throw new Error(`API call failed with status: ${response.status}`);
}
const result = await response.json();
let text = "Sorry, I couldn't analyze the image. The content may be unsupported.";
if (result.candidates && result.candidates[0]?.content?.parts[0]?.text) {
text = result.candidates[0].content.parts[0].text;
} else if (result.candidates && result.candidates[0]?.finishReason === "SAFETY") {
text = "Analysis could not be completed due to safety policies. The image may contain sensitive content.";
}
setImageAnalysis(text);
} catch (error) {
console.error("Error analyzing image:", error);
setAnalysisError("Failed to analyze the image. Please try a different image or check your connection.");
} finally {
setIsAnalyzing(false);
}
};
return (
<div className="text-gray-900 dark:text-gray-100">
{/* Header */}
<header className="sticky top-0 z-50 bg-white/80 dark:bg-gray-900/80 backdrop-blur-lg shadow-sm">
<nav className="container mx-auto px-6 py-4 flex justify-between items-center">
<div className="flex items-center space-x-2">
<Zap className="w-8 h-8 text-sky-500" />
<span className="text-2xl font-bold text-gray-800 dark:text-white">NETA</span>
</div>
<div className="hidden md:flex items-center space-x-6">
<a href="#features" className="text-gray-600 dark:text-gray-300 hover:text-sky-600 dark:hover:text-sky-400 transition">Features</a>
<a href="#free" className="text-gray-600 dark:text-gray-300 hover:text-sky-600 dark:hover:text-sky-400 transition">Free for Life</a>
<a href="#contact" className="text-gray-600 dark:text-gray-300 hover:text-sky-600 dark:hover:text-sky-400 transition">Contact</a>
</div>
<button className="bg-sky-600 text-white px-5 py-2.5 rounded-lg font-semibold hover:bg-sky-700 transition-colors shadow">Get Started Free</button>
</nav>
</header>
<main>
{/* Hero Section with Interactive Demo */}
<section className="py-20 md:py-24 text-center bg-white dark:bg-gray-800/50">
<div className="container mx-auto px-6">
<h1 className="text-4xl md:text-6xl font-extrabold text-gray-900 dark:text-white leading-tight mb-4">
Your AI Partner in the <span className="text-sky-500">Electrical</span> Field
</h1>
<p className="text-lg md:text-xl text-gray-600 dark:text-gray-300 max-w-3xl mx-auto mb-12">
Get instant NEC code answers, troubleshoot complex issues, and pass inspections the first time. NETA is the ultimate tool for modern electricians—<strong className="text-sky-500">and it's free for life.</strong>
</p>
<div id="interactive-demo" className="text-left">
<div className="text-center mb-12">
<h2 className="text-3xl md:text-4xl font-bold text-gray-800 dark:text-white">Experience NETA Now</h2>
<p className="text-lg text-gray-600 dark:text-gray-400 mt-4 max-w-2xl mx-auto">Ask a question or upload an image to see NETA in action.</p>
</div>
<div className="grid lg:grid-cols-2 gap-12 items-start max-w-6xl mx-auto">
<div className="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-xl border border-gray-200 dark:border-gray-700 animate-pulse-glow">
<h3 className="text-2xl font-bold mb-4 text-center text-gray-800 dark:text-white">Chat with NETA</h3>
<div className="h-96 overflow-y-auto p-4 bg-gray-100 dark:bg-gray-900 rounded-lg mb-4">
{chatHistory.map((msg, index) => (
<MessageBox key={index} message={msg.parts[0].text} role={msg.role} />
))}
{isGenerating && (
<div className="flex items-start gap-4 my-4">
<div className="flex-shrink-0 w-10 h-10 bg-sky-500 text-white rounded-full flex items-center justify-center"><Bot /></div>
<div className="max-w-xl p-4 rounded-2xl bg-gray-200 dark:bg-gray-700">
<LoaderCircle className="w-6 h-6 animate-spin text-sky-500" />
</div>
</div>
)}
<div ref={chatEndRef} />
</div>
<div className="flex items-center space-x-2">
<input
type="text"
value={userInput}
onChange={(e) => setUserInput(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && handleSendMessage()}
placeholder="e.g., 'What is the NEC code for outlet spacing?'"
className="w-full p-3 border border-gray-300 dark:border-gray-600 rounded-lg bg-gray-50 dark:bg-gray-700 focus:ring-2 focus:ring-sky-500 focus:outline-none transition"
disabled={isGenerating}
/>
<button onClick={handleSendMessage} disabled={isGenerating || !userInput.trim()} className="bg-sky-600 text-white p-3 rounded-lg font-semibold hover:bg-sky-700 disabled:bg-sky-300 disabled:cursor-not-allowed transition-colors">
<ArrowRight className="w-6 h-6"/>
</button>
</div>
</div>
<div className="bg-white dark:bg-gray-800 p-6 rounded-2xl shadow-xl border border-gray-200 dark:border-gray-700">
<h3 className="text-2xl font-bold mb-4 text-center text-gray-800 dark:text-white">Pre-Inspection Check</h3>
<div className="relative border-2 border-dashed border-gray-300 dark:border-gray-600 rounded-lg p-8 text-center cursor-pointer hover:border-sky-500 dark:hover:border-sky-400 transition" onClick={() => fileInputRef.current.click()}>
<input type="file" ref={fileInputRef} onChange={handleImageChange} accept="image/*" className="hidden" />
{imagePreview ? (
<img src={imagePreview} alt="Upload preview" className="mx-auto max-h-64 rounded-lg object-contain" />
) : (
<div className="flex flex-col items-center text-gray-500 dark:text-gray-400">
<UploadCloud className="w-12 h-12 mb-4" />
<p className="font-semibold">Click to upload an image</p>
<p className="text-sm">PNG, JPG, or WEBP</p>
</div>
)}
</div>
{imageFile && (
<button onClick={handleImageAnalysis} disabled={isAnalyzing} className="w-full mt-4 py-3 rounded-lg bg-sky-600 text-white font-semibold hover:bg-sky-700 disabled:bg-sky-300 flex items-center justify-center space-x-2 transition-colors">
{isAnalyzing ? <LoaderCircle className="w-6 h-6 animate-spin" /> : <ShieldCheck className="w-6 h-6" />}
<span>{isAnalyzing ? 'Analyzing...' : 'Analyze My Work'}</span>
</button>
)}
{(imageAnalysis || analysisError) && <ImageAnalysisResult analysis={imageAnalysis} error={analysisError} />}
</div>
</div>
</div>
</div>
</section>
<section id="features" className="py-20 bg-gray-50 dark:bg-gray-900">
<div className="container mx-auto px-6">
<div className="text-center mb-12">
<h2 className="text-3xl md:text-4xl font-bold text-gray-800 dark:text-white">Core Features Included for Free</h2>
<p className="text-lg text-gray-600 dark:text-gray-400 mt-4 max-w-2xl mx-auto">From apprentices to masters, NETA empowers you to work smarter, faster, and safer.</p>
</div>
<div className="grid md:grid-cols-2 lg:grid-cols-3 gap-8">
<FeatureCard icon={<Zap className="w-8 h-8" />} title="Instant NEC Code Lookup">
Stop flipping through pages. Get the exact NEC cod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623