You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"MD Affan Asghar is a passionate Full Stack Web Developer and Computer Science Engineering student, dedicated to building beautiful, responsive, and user-friendly websites. 💻🚀",
129
129
},
130
130
{
131
-
keywords: ["your name","creator","made you","built you","build","who created you"],
131
+
keywords: [
132
+
"your name",
133
+
"creator",
134
+
"made you",
135
+
"built you",
136
+
"build",
137
+
"who created you",
138
+
],
132
139
response: "I'm a chatbot created by MD Affan Asghar. 😊",
133
140
},
134
141
{
135
142
keywords: ["developer name","who made you","who is your developer"],
136
143
response: "My developer is MD Affan Asghar. 🚀",
137
144
},
138
145
{
139
-
keywords: ["phone number","contact","mobile","phone","how to contact","reach affan"],
146
+
keywords: [
147
+
"phone number",
148
+
"contact",
149
+
"mobile",
150
+
"phone",
151
+
"how to contact",
152
+
"reach affan",
153
+
],
140
154
response: "You can contact MD Affan Asghar at 📞 9339828230.",
141
155
},
142
156
{
@@ -148,28 +162,70 @@ const responses = [
148
162
response: "He lives at 🏠 Kankinara, Kolkata, West Bengal.",
149
163
},
150
164
{
151
-
keywords: ["skills","expertise","technologies","tech stack","what can affan do"],
165
+
keywords: [
166
+
"skills",
167
+
"expertise",
168
+
"technologies",
169
+
"tech stack",
170
+
"what can affan do",
171
+
],
152
172
response:
153
173
"He is skilled in 🔥 Full-Stack Web Development, Node.js, React, Php, MySQL MongoDB, Express.js, JavaScript, HTML, CSS, and more!",
154
174
},
155
175
{
156
-
keywords: ["projects","work","portfolio","project","what has affan built"],
176
+
keywords: [
177
+
"projects",
178
+
"work",
179
+
"portfolio",
180
+
"project",
181
+
"what has affan built",
182
+
],
183
+
response:
184
+
"His Full Stack projects include 🎯 WanderLust Holidays-Rental-Homes, NoHate website, and a Weather App using React,etc. 🚀",
185
+
},
186
+
{
187
+
keywords: [
188
+
"wanderlust",
189
+
"wanderlust project",
190
+
"holiday project",
191
+
"rental homes",
192
+
"holiday rental",
193
+
],
157
194
response:
158
-
"His projects include 🎯 WanderLust-Holidays-Rental-Homes, Full Stack NoHate website, and a Weather App using React,etc. 🚀",
195
+
"WanderLust Holidays-Rental-Homes is a full-stack web application inspired by Airbnb. It allows users to explore, book, and host rental properties with secure authentication, image uploads, filtering, and responsive design. Built using Node.js, Express.js, MongoDB, and EJS for dynamic rendering. 🌍",
196
+
},
197
+
{
198
+
keywords: [
199
+
"nohate",
200
+
"no hate",
201
+
"hate speech",
202
+
"nohate website",
203
+
"hate detection project",
204
+
"anti hate project",
205
+
],
206
+
response:
207
+
"🛡️ The NoHate website is a full-stack platform built to detect and filter hate speech in user posts. It uses machine learning for content moderation, with a modern frontend in React and backend in Node.js, Express, and MongoDB. It promotes respectful online communication. 💬🚫",
"He worked as a Web Developer Intern at 💼 Simtrak Solution Pvt Ltd.",
228
+
"He is currently working at 🏢 Ecomservices as a Full Stack Web Developer, focusing on scalable and full stack web applications. Previously, he worked as a Web Developer Intern at 💼 Simtrak Solution Pvt Ltd. 🚀",
173
229
},
174
230
{
175
231
keywords: ["final year project","academic project","college project"],
@@ -206,33 +262,37 @@ const responses = [
206
262
},
207
263
{
208
264
keywords: ["thank","thanks","appreciate"],
209
-
response: "You're welcome! Let me know if you need anything else about Affan. 😊",
265
+
response:
266
+
"You're welcome! Let me know if you need anything else about Affan. 😊",
210
267
},
211
268
];
212
269
213
270
functionfindBestResponse(userMessage){
214
271
userMessage=userMessage.toLowerCase();
215
-
272
+
216
273
// First check for exact matches
217
274
for(letentryofresponses){
218
-
if(entry.keywords.some(keyword=>
219
-
userMessage===keyword||
220
-
userMessage.includes(keyword)||
221
-
newRegExp(`\\b${keyword}\\b`).test(userMessage)
222
-
)){
275
+
if(
276
+
entry.keywords.some(
277
+
(keyword)=>
278
+
userMessage===keyword||
279
+
userMessage.includes(keyword)||
280
+
newRegExp(`\\b${keyword}\\b`).test(userMessage)
281
+
)
282
+
){
223
283
returnentry.response;
224
284
}
225
285
}
226
-
286
+
227
287
// Then check for partial matches
228
288
letbestMatch=null;
229
289
lethighestMatchCount=0;
230
290
231
291
for(letentryofresponses){
232
-
letmatchCount=entry.keywords.filter(keyword=>
292
+
letmatchCount=entry.keywords.filter((keyword)=>
233
293
userMessage.includes(keyword)
234
294
).length;
235
-
295
+
236
296
if(matchCount>highestMatchCount){
237
297
highestMatchCount=matchCount;
238
298
bestMatch=entry.response;
@@ -246,41 +306,46 @@ function findBestResponse(userMessage) {
246
306
asyncfunctioncallDeepSeekAPI(userMessage){
247
307
// Don't call API for simple greetings or common questions
content: "You are an assistant that answers questions specifically about MD Affan Asghar, a Full Stack Developer. Keep responses brief (1-2 sentences max) and relevant to Affan's skills, projects, education, or contact info. If the question isn't about Affan, politely decline to answer."
266
-
},
267
-
{
268
-
role: "user",
269
-
content: userMessage
270
-
}
271
-
],
272
-
temperature: 0.3,// Lower temperature for more focused answers
"You are an assistant that answers questions specifically about MD Affan Asghar, a Full Stack Developer. Keep responses brief (1-2 sentences max) and relevant to Affan's skills, projects, education, or contact info. If the question isn't about Affan, politely decline to answer.",
330
+
},
331
+
{
332
+
role: "user",
333
+
content: userMessage,
334
+
},
335
+
],
336
+
temperature: 0.3,// Lower temperature for more focused answers
337
+
max_tokens: 100,
338
+
}),
339
+
timeout: 5000,// Add timeout
340
+
}
341
+
);
277
342
278
343
if(!response.ok){
279
344
thrownewError(`API request failed with status ${response.status}`);
280
345
}
281
346
282
347
constdata=awaitresponse.json();
283
-
348
+
284
349
if(!data.choices?.[0]?.message?.content){
285
350
thrownewError("Invalid API response structure");
286
351
}
@@ -321,14 +386,18 @@ function sendMessage() {
321
386
// If no local match found, try API
322
387
if(!botResponse){
323
388
constapiResponse=awaitcallDeepSeekAPI(message);
324
-
botResponse=apiResponse||
389
+
botResponse=
390
+
apiResponse||
325
391
"I'm designed to answer questions about MD Affan Asghar. Could you ask something specific about his skills, projects, or contact information?";
0 commit comments