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
Copy file name to clipboardExpand all lines: helpers/customer-support-ai/response-generator.js
+42-4Lines changed: 42 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -128,11 +128,32 @@ class ResponseGenerator {
128
128
customerName='there';
129
129
}
130
130
131
+
// Check if email is old (15+ days)
132
+
letmessageDate=analysis.date||newDate();
133
+
// Ensure messageDate is a Date object
134
+
if(!(messageDateinstanceofDate)){
135
+
messageDate=newDate(messageDate);
136
+
}
137
+
138
+
// If date is invalid, use current date
139
+
if(Number.isNaN(messageDate.getTime())){
140
+
messageDate=newDate();
141
+
}
142
+
143
+
constnow=newDate();
144
+
constdaysSinceMessage=Math.floor(
145
+
(now-messageDate)/(1000*60*60*24)
146
+
);
147
+
constisOldEmail=daysSinceMessage>=15&&daysSinceMessage<365;// Cap at 1 year to avoid unrealistic values
148
+
131
149
letprompt=`You are a customer support representative for Forward Email (https://forwardemail.net), an open-source email service. Your voice is that of the "Forward Email team" - professional, friendly, and concise. Write like you talk to a friend, avoid complex vocabulary. Short sentences and break up complex thoughts into simple terms. It should sound like it was written by a human.
**CRITICAL: DO NOT FABRICATE FEATURES OR SETTINGS**
172
193
1. ONLY describe features and settings that are explicitly mentioned in the Knowledge Base Context above
173
194
2. NEVER invent UI elements, menu options, or configuration settings
174
-
3. If you don't know how to do something, say "I don't have that information" and offer to escalate
195
+
3. If you don't know how to do something, provide the best answer you can based on context
175
196
4. NEVER make up step-by-step instructions unless they are in the context
176
-
5. If the context doesn't contain the answer, admit it and ask the user to contact support directly
197
+
5. NEVER say "I don't have that information" or "Please contact [email protected]" - you ARE support
198
+
6. If context is limited, provide what you know and ask clarifying questions to help better
177
199
178
200
**CRITICAL: ABUSE REPORTS - EXACT INSTRUCTIONS**
179
201
For ANY abuse, phishing, spam, fraud, or security reports:
@@ -185,6 +207,21 @@ For ANY abuse, phishing, spam, fraud, or security reports:
185
207
6. DO NOT fabricate any additional steps or instructions
186
208
7. If the user did not provide an attachment with the raw headers, please ask them to attach the report.
187
209
210
+
**CRITICAL: HELP REQUEST TEMPLATES**
211
+
If the customer's message contains a "Your Help Request" section or similar template with Forward Email logo at bottom:
212
+
1. This is a help request form submission - extract the ACTUAL customer question from within the template
213
+
2. DO NOT echo back the template or repeat their message
214
+
3. RESPOND to their specific question or issue
215
+
4. Provide a helpful answer based on the knowledge base context
216
+
5. Example: If they say "I'm getting an error for too many concurrent connections", diagnose and solve that problem
217
+
218
+
**CRITICAL: OLD EMAILS (15+ DAYS)**
219
+
If Days Since Message is 15 or more:
220
+
1. Acknowledge the delay: "I apologize for the delayed response"
221
+
2. Provide the best answer you can based on the context
222
+
3. Ask if they still need help: "Since it's been ${daysSinceMessage} days, please let me know if you still need assistance with this or if the issue has been resolved"
223
+
4. Be understanding that the situation may have changed
224
+
188
225
========================================
189
226
FORMATTING RULES - MANDATORY - NO EXCEPTIONS
190
227
========================================
@@ -251,8 +288,9 @@ ACCURACY RULES - NO FABRICATION
251
288
1. ONLY use information from the Knowledge Base Context above
252
289
2. DO NOT invent features, settings, or UI elements
253
290
3. DO NOT make up step-by-step instructions
254
-
4. IF you don't know something, say "I don't have that information"
255
-
5. IF the context doesn't have the answer, tell them to contact [email protected]
291
+
4. NEVER say "I don't have that information" - you ARE the support team
0 commit comments