-
Notifications
You must be signed in to change notification settings - Fork 245
Expand file tree
/
Copy pathchat.html.bak
More file actions
321 lines (305 loc) · 10.2 KB
/
chat.html.bak
File metadata and controls
321 lines (305 loc) · 10.2 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/png" href="images/logo.png">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy"
content="
default-src 'self';
script-src 'self' 'unsafe-inline' https://generativelanguage.googleapis.com;
style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com;
font-src https://cdnjs.cloudflare.com;
img-src 'self' data: https:;
connect-src 'self' http://localhost:3000;
">
<title>AgriTech Assistant - Smart Farming Solutions</title>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"
/>
<link rel="icon" type="image/png" href="images/logo.png" />
<link rel="stylesheet" href="chat.css" />
<link rel="stylesheet" href="theme.css" />
<style>
/* Added styles for light green color on specified text */
.chat-header h2 {
color: #22c55e !important; /* Force AgriTech Green */
text-shadow: 0 1px 2px rgba(0,0,0,0.3); /* Adds depth for better readability */
}
.logo h1 {
color: var(--light-green); /* Light green for AgriBot */
}
/* --- NEW STYLES FOR IMAGE UPLOAD --- */
#image-preview-container {
display: none;
padding: 10px;
background: rgba(34, 197, 94, 0.1);
border-radius: 8px;
margin: 0 20px 10px 20px;
align-items: center;
gap: 15px;
border: 1px dashed #22c55e;
}
.preview-wrapper { position: relative; display: inline-block; }
.preview-wrapper img { max-height: 60px; border-radius: 5px; border: 2px solid #22c55e; }
.remove-img {
position: absolute; top: -8px; right: -8px;
background: #ef4444; color: white; border: none;
border-radius: 50%; width: 20px; height: 20px;
cursor: pointer; font-size: 12px; display: flex;
align-items: center; justify-content: center;
}
.camera-btn {
background: none; border: none; color: #22c55e;
cursor: pointer; font-size: 1.3rem; margin-right: 10px;
transition: transform 0.2s;
}
.camera-btn:hover { transform: scale(1.1); }
</style>
</head>
<body>
<header>
<div class="header-content">
<div class="nav-left" style="display: flex; align-items: center; gap: 1.5rem;">
<a href="index.html" class="nav-back">
<i class="fas fa-arrow-left"></i> Back to Home
</a>
<div class="logo">
<i class="fas fa-seedling"></i>
<h1>AgriBot</h1>
</div>
</div>
<div class="nav-right" style="display: flex; align-items: center;">
<button class="theme-toggle" aria-label="Toggle dark/light mode">
<i class="fas fa-sun sun-icon"></i>
<i class="fas fa-moon moon-icon"></i>
<span class="theme-text">Light</span>
</button>
</div>
</div>
</header>
<main>
<div id="chat-container">
<div class="chat-header">
<i class="fas fa-robot"></i>
<h2>Ask me anything about agriculture, crops, or farming techniques</h2>
</div>
<div id="chat-window">
<div class="welcome-message">
<h3><i class="fas fa-leaf"></i> Welcome to AgriTech Assistant!</h3>
<p>
I'm powered by Google Gemini AI to help with all your farming
questions.
</p>
<div class="suggestions">
<div class="suggestion">Best crops for this season?</div>
<div class="suggestion">Organic pest control methods</div>
<div class="suggestion">Water conservation techniques</div>
<div class="suggestion">Soil health improvement</div>
</div>
</div>
</div>
<div id="image-preview-container">
<div class="preview-wrapper">
<img id="image-preview" src="">
<button type="button" class="remove-img" onclick="clearImage()">×</button>
</div>
<span style="font-size: 0.85rem; color: #22c55e;">Image attached for AI analysis</span>
</div>
<form id="chat-form">
<div class="input-container" style="display: flex; align-items: center;">
<input type="file" id="image-input" accept="image/*" style="display: none;" onchange="handleImagePreview(event)">
<button type="button" class="camera-btn" onclick="document.getElementById('image-input').click()" title="Upload image for diagnosis">
<i class="fas fa-camera"></i>
</button>
<input
type="text"
id="chat-input"
placeholder="Ask about crops or upload a photo..."
aria-label="Chat input"
autofocus
required
/>
</div>
<button type="submit" id="send-button">
<i class="fas fa-paper-plane"></i> Send
</button>
</form>
</div>
</main>
<script>
let selectedImageBase64 = null;
function handleImagePreview(event) {
const file = event.target.files[0];
if (file) {
const reader = new FileReader();
reader.onload = function(e) {
document.getElementById('image-preview').src = e.target.result;
document.getElementById('image-preview-container').style.display = 'flex';
// Store base64 data for Python backend
window.selectedImageBase64 = e.target.result.split(',')[1];
};
reader.readAsDataURL(file);
}
}
function clearImage() {
selectedImageBase64 = null;
document.getElementById('image-input').value = '';
document.getElementById('image-preview-container').style.display = 'none';
}
</script>
<script src="json-chatbot.js"></script>
<script src="chat.js"></script>
<script src="theme.js"></script>
<style>
.site-footer {
background: linear-gradient(135deg, #2e7d32, #66bb6a);
color: #fff;
margin-top: auto;
padding: 2rem 1.25rem;
}
.site-footer .footer-inner {
max-width: 1200px;
margin: 0 auto;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 1.5rem;
align-items: flex-start;
}
.footer-brand {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.footer-logo {
width: 48px;
height: 48px;
border-radius: 8px;
object-fit: cover;
background: #fff;
padding: 4px;
}
.site-footer h3,
.site-footer h4 {
margin: 0 0 0.5rem 0;
}
.site-footer p {
margin: 0;
opacity: 0.9;
}
.site-footer ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 0.4rem;
}
.site-footer a {
color: #fff;
text-decoration: none;
opacity: 0.9;
transition: opacity 0.2s;
}
.site-footer a:hover {
opacity: 1;
text-decoration: underline;
}
.footer-bottom {
max-width: 1200px;
margin: 1rem auto 0;
padding-top: 1rem;
border-top: 1px solid rgba(255, 255, 255, 0.25);
text-align: center;
font-size: 0.9rem;
opacity: 0.9;
}
.social-media {
display: flex;
gap: 1rem;
margin-top: 0.5rem;
}
.social-media a {
display: flex;
align-items: center;
justify-content: center;
width: 40px;
height: 40px;
background: rgba(255, 255, 255, 0.1);
border-radius: 50%;
transition: all 0.3s ease;
font-size: 1.2rem;
}
.social-media a:hover {
background: rgba(255, 255, 255, 0.2);
transform: translateY(-2px);
}
</style>
<footer class="site-footer">
<div class="footer-inner">
<div class="footer-brand">
<img src="images/logo.png" alt="AgriTech logo" class="footer-logo" />
<h3>AgriTech</h3>
<p>Empowering India's Farming Future</p>
<div class="social-media">
<a
href="https://instagram.com"
target="_blank"
rel="noopener noreferrer"
aria-label="Follow us on Instagram"
><i class="fab fa-instagram"></i
></a>
<a
href="https://github.com/omroy07"
target="_blank"
rel="noopener noreferrer"
aria-label="View our GitHub repositories"
><i class="fab fa-github"></i
></a>
<a
href="https://www.linkedin.com/in/om-roy-3b809628a/"
target="_blank"
rel="noopener noreferrer"
aria-label="Connect with us on LinkedIn"
><i class="fab fa-linkedin"></i
></a>
</div>
</div>
<div class="footer-links">
<h4>Quick Links</h4>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="main.html">Dashboard</a></li>
<li><a href="feed-back.html">Feedback</a></li>
<li><a href="chat.html">AI Assistant</a></li>
</ul>
</div>
<div class="footer-links">
<h4>Tools</h4>
<ul>
<li>
<a href="Crop Recommendation/templates/index.html"
>Crop Recommendation</a
>
</li>
<li>
<a href="Crop Yield Prediction/crop_yield_app/templates/index.html"
>Yield Prediction</a
>
</li>
<li>
<a href="Disease prediction/template/index.html"
>Disease Detector</a
>
</li>
<li>
<a href="Crop_Planning/templates/cropplan.html">Crop Planner</a>
</li>
</ul>
</div>
</div>
<div class="footer-bottom">© <span id="current-year">2026</span> AgriTech • Made for farmers</div>
</footer>
</body>
</html>