Dhom1 commited on
Commit
dc2890b
·
verified ·
1 Parent(s): a3f3e99

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +25 -13
streamlit_app.py CHANGED
@@ -75,19 +75,20 @@ def generate_temporary_solution(incident_type):
75
 
76
  # ✅ توليد الرد النهائي
77
  def generate_response(subject, body, incident_type):
78
- base_response = f"Thank you for reaching out. We have received your request regarding '{subject}'. "
 
 
 
79
  solution = generate_temporary_solution(incident_type)
80
- additional_info = (
81
- "Could you provide more details regarding the specific problem you are experiencing?"
82
- )
83
 
84
  # إذا كان الحادث مصنفًا بوضوح، يتم عرض الحل مباشرة
85
  if incident_type != "Uncategorized":
86
- response = base_response + "\n\nTemporary Solution: " + solution
87
  else:
88
- response = base_response + "\n\n" + additional_info
89
 
90
- return response
91
 
92
  # ✅ زر الإرسال
93
  if st.button("Submit"):
@@ -97,20 +98,31 @@ if st.button("Submit"):
97
  incident_type = categorize_email(incident_description)
98
 
99
  # توليد الردود والحلول
100
- response = generate_response(subject, incident_description, incident_type)
101
 
102
  # عرض رسالة التأكيد
103
  st.success("Thank you for your submission. We are currently processing your request.")
104
  st.write("---")
105
 
106
- # عرض الرسالة المؤقتة
107
- st.subheader("📧 Simulated Email ---")
108
  st.write(f"To: customer@example.com")
109
  st.write(f"Subject: {subject}")
110
- st.write(f"Body: {response}")
 
 
 
 
 
111
  st.write("---")
112
 
113
- # تعبئة الحقول في CRM
 
 
 
 
 
 
114
  st.subheader("🛠️ CRM Fields")
115
  st.write("**Title:**", incident_type)
116
  st.write("**Affect Service:**", "CRM" if "crm" in incident_description.lower() else "General")
@@ -118,7 +130,7 @@ if st.button("Submit"):
118
  st.write("**Incident Area:**", "Login" if "login" in incident_description.lower() else "General")
119
  st.write("**Submitted On:**", datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
120
  st.write("**Incident Description:**", incident_description)
121
- st.write("**Solution:**", generate_temporary_solution(incident_type))
122
 
123
  else:
124
  st.warning("Please enter both subject and body to proceed.")
 
75
 
76
  # ✅ توليد الرد النهائي
77
  def generate_response(subject, body, incident_type):
78
+ # Acknowledgement Email
79
+ acknowledgement = f"Thank you for reaching out. We have received your request regarding '{subject}'. Our support team is currently reviewing it."
80
+
81
+ # Temporary Solution
82
  solution = generate_temporary_solution(incident_type)
83
+ additional_info = "Could you provide more details regarding the specific problem you are experiencing?"
 
 
84
 
85
  # إذا كان الحادث مصنفًا بوضوح، يتم عرض الحل مباشرة
86
  if incident_type != "Uncategorized":
87
+ response = f"{acknowledgement}\n\n**Temporary Solution:**\n{solution}"
88
  else:
89
+ response = f"{acknowledgement}\n\n**Temporary Solution:**\n{solution}\n\n**Request for More Information:**\n{additional_info}"
90
 
91
+ return acknowledgement, solution, response
92
 
93
  # ✅ زر الإرسال
94
  if st.button("Submit"):
 
98
  incident_type = categorize_email(incident_description)
99
 
100
  # توليد الردود والحلول
101
+ acknowledgement, solution, response = generate_response(subject, incident_description, incident_type)
102
 
103
  # عرض رسالة التأكيد
104
  st.success("Thank you for your submission. We are currently processing your request.")
105
  st.write("---")
106
 
107
+ # Acknowledgement Email
108
+ st.subheader("📧 Acknowledgement Email")
109
  st.write(f"To: customer@example.com")
110
  st.write(f"Subject: {subject}")
111
+ st.write(f"Body:\n{acknowledgement}")
112
+ st.write("---")
113
+
114
+ # ✅ Temporary Solution
115
+ st.subheader("🚀 Temporary Solution")
116
+ st.write(solution)
117
  st.write("---")
118
 
119
+ # ✅ طلب المزيد من التفاصيل إذا كان التصنيف غير واضح
120
+ if incident_type == "Uncategorized":
121
+ st.subheader("❓ Request for More Information")
122
+ st.write("Could you provide more details regarding the specific problem you are experiencing?")
123
+ st.write("---")
124
+
125
+ # ✅ تعبئة الحقول في CRM
126
  st.subheader("🛠️ CRM Fields")
127
  st.write("**Title:**", incident_type)
128
  st.write("**Affect Service:**", "CRM" if "crm" in incident_description.lower() else "General")
 
130
  st.write("**Incident Area:**", "Login" if "login" in incident_description.lower() else "General")
131
  st.write("**Submitted On:**", datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
132
  st.write("**Incident Description:**", incident_description)
133
+ st.write("**Solution:**", solution)
134
 
135
  else:
136
  st.warning("Please enter both subject and body to proceed.")