abohamood commited on
Commit
74381fc
·
verified ·
1 Parent(s): cc7345e

Promote version bc12709 to main

Browse files

Promoted commit bc12709ec71a8b44fadb33440f673f6ce6541083 to main branch

Files changed (3) hide show
  1. components/chat-widget.js +86 -402
  2. components/quick-actions.js +8 -8
  3. index.html +29 -65
components/chat-widget.js CHANGED
@@ -140,12 +140,6 @@ sendMessage() {
140
  typingIndicator.parentElement.remove();
141
  }
142
 
143
- // Check if user wants to attach a file
144
- if (userMessage.includes('رفع ملف') || userMessage.includes('مرفق') || userMessage.includes('ملف نصي')) {
145
- this.addMessage('assistant', 'أقترح عليك استخدام أداة "إدارة الملفات" الجديدة في الأسفل 👇. اضغط على زر 📎 لرفع ملف نصي، ثم يمكنني مساعدتك في تلخيصه، مراجعته أو تحديثه.');
146
- return;
147
- }
148
-
149
  // Enhanced system prompt for comprehensive question answering
150
  const systemPrompt = `أنت "مساعد العلو" الذكي المتطور، مدعوم بأحدث نماذج الذكاء الاصطناعي. مهمتك الأساسية هي الإجابة على أي سؤال يطرح عليك مهما كان نوعه أو مجاله، مع تقديم إجابات شاملة ومفيدة وصحيحة قدر الإمكان.
151
 
@@ -158,7 +152,7 @@ sendMessage() {
158
  6. **اللغة العربية**: ركز على استخدام اللغة العربية الفصحى أو العامية المفهومة، مع مراعاة السياق.
159
  7. **التهذيب والاحترام**: حافظ على المهنية والاحترام في جميع الإجابات.
160
 
161
- أمثلة على أنواع الأسئلة التي ستجاب عنها:
162
  - أسئلة علمية: "كيف تعمل الخلايا الشمسية؟"
163
  - أسئلة تاريخية: "ما هي أسباب الحرب العالمية الأولى؟"
164
  - أسئلة تقنية: "ما الفرق بين الذكاء الاصطناعي والتعلم الآلي؟"
@@ -170,10 +164,10 @@ sendMessage() {
170
  - أسئلة رياضية: "ما هو قانون فيثاغورس؟"
171
  - أسئلة طبية: "ما هي أعراض الإنفلونزا؟"
172
  - أسئلة دينية: "ما هي أركان الإسلام؟"
173
- - **ملاحظة جديدة**: إذا طلب المستخدم مساعدة في ملف نصي (تلقين، مراجعة، تحديث)، فاشرح له كيفية استخدام أداة إدارة الملفات في المحادثة.
174
 
175
  تذكر: أنت هنا لمساعدة المستخدم، فقدم أفضل ما لديك في كل مرة.`;
176
- // Updated API configuration with multiple fallbacks for maximum reliability
 
177
  const requestBody = {
178
  model: 'openai/gpt-4-turbo-preview',
179
  messages: [
@@ -659,8 +653,8 @@ handleQuickQuestion(question) {
659
  flex: 1;
660
  }
661
  .chat-avatar {
662
- width: 36px;
663
- height: 36px;
664
  border-radius: 50%;
665
  background: white;
666
  display: flex;
@@ -668,38 +662,38 @@ handleQuickQuestion(question) {
668
  justify-content: center;
669
  color: #6366f1;
670
  font-weight: bold;
671
- font-size: 18px;
672
  }
673
- .chat-header-text {
674
  flex: 1;
675
  }
676
  .chat-header-text h3 {
677
- font-size: 16px;
678
  margin: 0 0 4px 0;
679
  font-weight: 700;
680
  }
681
  .chat-header-text p {
682
- font-size: 12px;
683
  opacity: 0.9;
684
  margin: 0;
685
  }
686
  .chat-header-text p .tag {
687
  background: rgba(255,255,255,0.3);
688
- padding: 1px 6px;
689
- border-radius: 8px;
690
- font-size: 10px;
691
- margin-right: 4px;
692
  }
693
  .connection-status {
694
  display: flex;
695
  align-items: center;
696
- gap: 5px;
697
- font-size: 11px;
698
  background: rgba(255, 255, 255, 0.2);
699
- padding: 3px 8px;
700
  border-radius: 20px;
701
  }
702
- .status-dot {
703
  width: 8px;
704
  height: 8px;
705
  background: #10b981;
@@ -712,14 +706,14 @@ handleQuickQuestion(question) {
712
  }
713
  .chat-actions {
714
  display: flex;
715
- gap: 6px;
716
  }
717
  .chat-actions button {
718
  background: rgba(255, 255, 255, 0.2);
719
  border: none;
720
  color: white;
721
- width: 32px;
722
- height: 32px;
723
  border-radius: 50%;
724
  cursor: pointer;
725
  display: flex;
@@ -727,11 +721,7 @@ handleQuickQuestion(question) {
727
  justify-content: center;
728
  transition: background 0.2s;
729
  }
730
- .chat-actions button svg {
731
- width: 16px;
732
- height: 16px;
733
- }
734
- .chat-actions button:hover {
735
  background: rgba(255, 255, 255, 0.3);
736
  }
737
  .chat-body {
@@ -755,12 +745,12 @@ handleQuickQuestion(question) {
755
  align-self: flex-start;
756
  }
757
  .message-bubble {
758
- padding: 12px 16px;
759
- border-radius: 18px;
760
- font-size: 14px;
761
  line-height: 1.5;
762
  }
763
- .message.user .message-bubble {
764
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
765
  color: white;
766
  border-radius: 20px 20px 4px 20px;
@@ -772,11 +762,11 @@ handleQuickQuestion(question) {
772
  border-radius: 20px 20px 20px 4px;
773
  }
774
  .message-time {
775
- font-size: 11px;
776
  color: #9ca3af;
777
- margin-top: 4px;
778
  }
779
- .quick-questions {
780
  display: flex;
781
  flex-wrap: wrap;
782
  gap: 10px;
@@ -785,15 +775,15 @@ handleQuickQuestion(question) {
785
  .quick-question {
786
  background: #f3f4f6;
787
  border: 1px solid #e5e7eb;
788
- border-radius: 18px;
789
- padding: 8px 14px;
790
- font-size: 13px;
791
  color: #4b5563;
792
  cursor: pointer;
793
  transition: background 0.2s;
794
  border: none;
795
  }
796
- .quick-question:hover {
797
  background: #e5e7eb;
798
  }
799
  .chat-footer {
@@ -812,21 +802,17 @@ handleQuickQuestion(question) {
812
  .quick-action {
813
  background: #f1f5f9;
814
  border: 1px solid #e2e8f0;
815
- border-radius: 18px;
816
- padding: 6px 12px;
817
- font-size: 12px;
818
  color: #4b5563;
819
  cursor: pointer;
820
  display: flex;
821
  align-items: center;
822
- gap: 5px;
823
  transition: all 0.2s;
824
  }
825
- .quick-action svg {
826
- width: 14px;
827
- height: 14px;
828
- }
829
- .quick-action:hover {
830
  background: #e5e7eb;
831
  transform: translateY(-2px);
832
  }
@@ -838,13 +824,13 @@ handleQuickQuestion(question) {
838
  flex: 1;
839
  border: 1px solid #d1d5db;
840
  border-radius: 50px;
841
- padding: 12px 18px;
842
- font-size: 14px;
843
  outline: none;
844
  transition: border 0.3s;
845
  direction: rtl;
846
  }
847
- .chat-input:focus {
848
  border-color: #6366f1;
849
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
850
  }
@@ -852,8 +838,8 @@ handleQuickQuestion(question) {
852
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
853
  border: none;
854
  color: white;
855
- width: 46px;
856
- height: 46px;
857
  border-radius: 50%;
858
  cursor: pointer;
859
  display: flex;
@@ -861,28 +847,20 @@ handleQuickQuestion(question) {
861
  justify-content: center;
862
  transition: all 0.3s;
863
  }
864
- .send-button svg {
865
- width: 18px;
866
- height: 18px;
867
- }
868
- .send-button:hover {
869
  transform: scale(1.05);
870
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
871
  }
872
  .chat-footer-note {
873
- font-size: 10px;
874
  color: #6b7280;
875
  display: flex;
876
  align-items: center;
877
- gap: 5px;
878
  justify-content: center;
879
- margin-top: 6px;
880
- }
881
- .chat-footer-note svg {
882
- width: 12px;
883
- height: 12px;
884
  }
885
- .typing-indicator {
886
  display: flex;
887
  align-items: center;
888
  gap: 5px;
@@ -895,79 +873,19 @@ handleQuickQuestion(question) {
895
  .typing-indicator.ai-typing {
896
  align-self: flex-start;
897
  }
898
- .typing-dot {
899
- width: 6px;
900
- height: 6px;
901
  background: #9ca3af;
902
  border-radius: 50%;
903
  animation: typing 1.4s infinite;
904
  }
905
- .typing-dot:nth-child(2) { animation-delay: 0.2s; }
906
  .typing-dot:nth-child(3) { animation-delay: 0.4s; }
907
  @keyframes typing {
908
  0%, 60%, 100% { transform: translateY(0); }
909
  30% { transform: translateY(-6px); }
910
  }
911
- /* File Manager Styles */
912
- .file-manager {
913
- margin-bottom: 12px;
914
- border: 1px dashed #d1d5db;
915
- border-radius: 12px;
916
- padding: 10px;
917
- background: #f9fafb;
918
- }
919
- .file-upload-area {
920
- display: flex;
921
- gap: 8px;
922
- flex-wrap: wrap;
923
- justify-content: center;
924
- }
925
- .file-action-btn {
926
- background: white;
927
- border: 1px solid #d1d5db;
928
- border-radius: 20px;
929
- padding: 8px 14px;
930
- font-size: 12px;
931
- color: #4b5563;
932
- cursor: pointer;
933
- display: flex;
934
- align-items: center;
935
- gap: 6px;
936
- transition: all 0.2s;
937
- }
938
- .file-action-btn:hover {
939
- background: #f3f4f6;
940
- border-color: #9ca3af;
941
- }
942
- .file-info {
943
- margin-top: 8px;
944
- display: flex;
945
- align-items: center;
946
- justify-content: space-between;
947
- font-size: 12px;
948
- color: #6b7280;
949
- padding: 6px 10px;
950
- background: white;
951
- border-radius: 8px;
952
- border: 1px solid #e5e7eb;
953
- }
954
- .clear-btn {
955
- background: #f3f4f6;
956
- border: none;
957
- border-radius: 50%;
958
- width: 20px;
959
- height: 20px;
960
- cursor: pointer;
961
- color: #6b7280;
962
- font-size: 14px;
963
- display: flex;
964
- align-items: center;
965
- justify-content: center;
966
- line-height: 1;
967
- }
968
- .clear-btn:hover {
969
- background: #e5e7eb;
970
- }
971
  @media (max-width: 640px) {
972
  #alolo-chat-widget {
973
  bottom: 20px;
@@ -985,14 +903,6 @@ handleQuickQuestion(question) {
985
  .quick-actions {
986
  flex-wrap: wrap;
987
  }
988
- .file-upload-area {
989
- flex-direction: column;
990
- align-items: center;
991
- }
992
- .file-action-btn {
993
- width: 100%;
994
- justify-content: center;
995
- }
996
  .chat-header-text h3 {
997
  font-size: 16px;
998
  }
@@ -1032,64 +942,38 @@ handleQuickQuestion(question) {
1032
  <div class="chat-body" id="chatBody">
1033
  <!-- Messages will be inserted here -->
1034
  </div>
1035
- <div class="chat-footer">
1036
- <div class="quick-actions">
1037
- <button class="quick-action" data-question="اكتب مقالاً عن التعليم الإلكتروني">
1038
- <i class="feather-icon" data-icon="edit"></i>
1039
- كتابة
1040
- </button>
1041
- <button class="quick-action" data-question="اشرح مفهوم الذكاء الاصطناعي">
1042
- <i class="feather-icon" data-icon="book-open"></i>
1043
- شرح
1044
- </button>
1045
- <button class="quick-action" data-question="أنشئ قصة تعليمية قصيرة">
1046
- <i class="feather-icon" data-icon="feather"></i>
1047
- إبداع
1048
- </button>
1049
- <button class="quick-action" data-question="ما هي أحدث اتجاهات التعليم؟">
1050
- <i class="feather-icon" data-icon="trending-up"></i>
1051
- اتجاهات
1052
- </button>
1053
- </div>
1054
-
1055
- <!-- File Upload Section -->
1056
- <div class="file-manager">
1057
- <div class="file-upload-area" id="fileUploadArea">
1058
- <input type="file" id="fileInput" accept=".txt,.pdf,.doc,.docx,.md" style="display: none;">
1059
- <button class="file-action-btn" id="attachFileBtn" title="إرفاق ملف">
1060
- <i class="feather-icon" data-icon="paperclip"></i>
1061
- رفع ملف نصي
1062
- </button>
1063
- <button class="file-action-btn" id="summarizeBtn" title="تلخيص">
1064
- <i class="feather-icon" data-icon="file-text"></i>
1065
- تلخيص
1066
- </button>
1067
- <button class="file-action-btn" id="reviewBtn" title="مراجعة">
1068
- <i class="feather-icon" data-icon="check-circle"></i>
1069
- مراجعة
1070
- </button>
1071
- <button class="file-action-btn" id="updateBtn" title="تحديث">
1072
- <i class="feather-icon" data-icon="refresh-cw"></i>
1073
- تحديث
1074
- </button>
1075
- </div>
1076
- <div class="file-info" id="fileInfo">
1077
- <span id="fileName">لا يوجد ملف مرفوع</span>
1078
- <button id="clearFile" class="clear-btn">×</button>
1079
  </div>
 
1080
  </div>
1081
-
1082
- <div class="chat-input-container">
1083
- <input type="text" class="chat-input" id="messageInput" placeholder="اكتب سؤالك هنا... (اضغط Enter لإرسال)" autocomplete="off">
1084
- <button class="send-button" id="sendMessage" title="إرسال">
1085
- <i class="feather-icon" data-icon="send"></i>
1086
- </button>
1087
- </div>
1088
- <div class="chat-footer-note">
1089
- <svg class="feather feather-cpu" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2" ry="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></svg>
1090
- <span>مساعد ذكي متطور - يجيب على أي سؤال ويدير الملفات النصية</span>
1091
- </div>
1092
- </div>
1093
  </div>
1094
  `;
1095
  // Attach event listeners
@@ -1099,6 +983,7 @@ handleQuickQuestion(question) {
1099
  this.shadowRoot.getElementById('messageInput').addEventListener('keypress', (e) => {
1100
  if (e.key === 'Enter') this.sendMessage();
1101
  });
 
1102
  // Attach quick action buttons
1103
  this.shadowRoot.querySelectorAll('.quick-action').forEach(btn => {
1104
  btn.addEventListener('click', () => {
@@ -1109,211 +994,13 @@ handleQuickQuestion(question) {
1109
  });
1110
  });
1111
 
1112
- // Attach file management buttons
1113
- this.attachFileListeners();
1114
  // Render initial messages
1115
  this.renderMessages();
1116
  // Initialize icons
1117
  this.initializeIcons();
1118
  }
1119
 
1120
- attachFileListeners() {
1121
- const fileInput = this.shadowRoot.getElementById('fileInput');
1122
- const attachBtn = this.shadowRoot.getElementById('attachFileBtn');
1123
- const summarizeBtn = this.shadowRoot.getElementById('summarizeBtn');
1124
- const reviewBtn = this.shadowRoot.getElementById('reviewBtn');
1125
- const updateBtn = this.shadowRoot.getElementById('updateBtn');
1126
- const clearBtn = this.shadowRoot.getElementById('clearFile');
1127
- const fileNameSpan = this.shadowRoot.getElementById('fileName');
1128
-
1129
- // Current file data
1130
- this.currentFile = null;
1131
-
1132
- // Attach file button
1133
- attachBtn.addEventListener('click', () => {
1134
- fileInput.click();
1135
- });
1136
-
1137
- // File input change
1138
- fileInput.addEventListener('change', (e) => {
1139
- const file = e.target.files[0];
1140
- if (file) {
1141
- this.readFile(file);
1142
- }
1143
- });
1144
-
1145
- // Summarize button
1146
- summarizeBtn.addEventListener('click', () => {
1147
- if (!this.currentFile) {
1148
- this.addMessage('assistant', '⚠️ لم تقم برفع أي ملف بعد. يرجى استخدام زر "رفع ملف نصي" أولاً.');
1149
- return;
1150
- }
1151
- this.processFile('summarize');
1152
- });
1153
-
1154
- // Review button
1155
- reviewBtn.addEventListener('click', () => {
1156
- if (!this.currentFile) {
1157
- this.addMessage('assistant', '⚠️ لم تقم برفع أي ملف بعد. يرجى استخدام زر "رفع ملف نصي" أولاً.');
1158
- return;
1159
- }
1160
- this.processFile('review');
1161
- });
1162
-
1163
- // Update button
1164
- updateBtn.addEventListener('click', () => {
1165
- if (!this.currentFile) {
1166
- this.addMessage('assistant', '⚠️ لم تقم برفع أي ملف بعد. يرجى استخدام زر "رفع ملف نصي" أولاً.');
1167
- return;
1168
- }
1169
- this.processFile('update');
1170
- });
1171
-
1172
- // Clear button
1173
- clearBtn.addEventListener('click', () => {
1174
- this.currentFile = null;
1175
- fileInput.value = '';
1176
- fileNameSpan.textContent = 'لا يوجد ملف مرفوع';
1177
- this.addMessage('assistant', '🗑️ تم إزالة الملف المرفوع.');
1178
- });
1179
- }
1180
-
1181
- readFile(file) {
1182
- const reader = new FileReader();
1183
- reader.onload = (e) => {
1184
- const content = e.target.result;
1185
- this.currentFile = {
1186
- name: file.name,
1187
- type: file.type,
1188
- size: file.size,
1189
- content: content.substring(0, 10000) // Limit to 10k chars
1190
- };
1191
- this.shadowRoot.getElementById('fileName').textContent = `${file.name} (${Math.round(file.size/1024)} KB)`;
1192
- this.addMessage('assistant', `✅ تم رفع الملف "${file.name}" بنجاح. يمكنك الآن استخدام أزرار "تلخيص"، "مراجعة"، أو "تحديث".`);
1193
- };
1194
- reader.readAsText(file);
1195
- }
1196
-
1197
- processFile(action) {
1198
- if (!this.currentFile) return;
1199
-
1200
- const content = this.currentFile.content;
1201
- let prompt = '';
1202
-
1203
- switch(action) {
1204
- case 'summarize':
1205
- prompt = `الملف: ${this.currentFile.name}\n\nالمحتوى:\n${content}\n\nقم بتلخيص هذا الملف بطريقة منظمة مع إبراز النقاط الرئيسية. استخدم عناوين فرعية إذا لزم الأمر.`;
1206
- break;
1207
- case 'review':
1208
- prompt = `الملف: ${this.currentFile.name}\n\nالمحتوى:\n${content}\n\nقم بمراجعة هذا الملف من حيث:\n1. الأخطاء الإملائية والنحوية\n2. التنسيق والوضوح\n3. اقتراحات للتحسين\n4. تقييم عام للمحتوى`;
1209
- break;
1210
- case 'update':
1211
- prompt = `الملف: ${this.currentFile.name}\n\nالمحتوى:\n${content}\n\nقم بتحديث وتحسين هذا الملف:\n1. أضف معلومات جديدة إذا كان الموضوع يحتاج لذلك\n2. حسن الصياغة\n3. أعد تنظيم المحتوى لوضوح أفضل\n4. أضف عناوين فرعية إذا لزم الأمر`;
1212
- break;
1213
- }
1214
-
1215
- this.addMessage('user', `أريد ${action} الملف "${this.currentFile.name}"`);
1216
- this.showTyping();
1217
- setTimeout(() => {
1218
- this.generateFileAIResponse(prompt, action);
1219
- }, 1000);
1220
- }
1221
-
1222
- generateFileAIResponse(prompt, action) {
1223
- const chatBody = this.shadowRoot.getElementById('chatBody');
1224
- const typingIndicator = chatBody.querySelector('.typing-indicator');
1225
- if (typingIndicator) {
1226
- typingIndicator.parentElement.remove();
1227
- }
1228
-
1229
- // Use the same API as before but with file-specific prompt
1230
- const apiEndpoints = [
1231
- {
1232
- url: 'https://openrouter.ai/api/v1/chat/completions',
1233
- headers: {
1234
- 'Authorization': 'Bearer sk-or-v1-59ecc8f59ac8d43763e1e1e8698e2f3e3c62bb1e6a8c6b6c',
1235
- 'Content-Type': 'application/json',
1236
- 'HTTP-Referer': 'https://alolo.sa',
1237
- 'X-Title': 'Alolo AI Assistant'
1238
- }
1239
- }
1240
- ];
1241
-
1242
- const requestBody = {
1243
- model: 'openai/gpt-4-turbo-preview',
1244
- messages: [
1245
- {
1246
- role: 'system',
1247
- content: `أنت مساعد العلو المتخصص في معالجة الملفات النصية. مهمتك هي مساعدة المستخدم في تلخيص، مراجعة، وتحديث الملفات النصية التي يرفعها. قدم إجابات مفصلة ومنظمة مع عناوين واضحة.`
1248
- },
1249
- {
1250
- role: 'user',
1251
- content: prompt
1252
- }
1253
- ],
1254
- max_tokens: 2000,
1255
- temperature: 0.7,
1256
- stream: false
1257
- };
1258
-
1259
- const tryApiCall = (endpoint) => {
1260
- return fetch(endpoint.url, {
1261
- method: 'POST',
1262
- headers: endpoint.headers,
1263
- body: JSON.stringify(endpoint.body || requestBody)
1264
- }).then(response => {
1265
- if (!response.ok) throw new Error(`API error: ${response.status}`);
1266
- return response.json();
1267
- });
1268
- };
1269
-
1270
- let currentAttempt = 0;
1271
- const attemptApiCall = () => {
1272
- if (currentAttempt >= apiEndpoints.length) {
1273
- // Fallback
1274
- let fallbackResponse = '';
1275
- switch(action) {
1276
- case 'summarize':
1277
- fallbackResponse = `تلخيص الملف "${this.currentFile.name}":\n\nالمحتوى الأصلي يحتوي على ${this.currentFile.content.length} حرفاً. النقاط الرئيسية المستخلصة هي:\n1. ...\n2. ...\n3. ...\n\nهذا تلخيص عام، للحصول على تلخيص دقيق يرجى رفع ملف أصغر أو تقسيمه.`;
1278
- break;
1279
- case 'review':
1280
- fallbackResponse = `مراجعة الملف "${this.currentFile.name}":\n\nالملف بحجم ${Math.round(this.currentFile.size/1024)} كيلوبايت. بشكل عام، المحتوى يحتاج إلى تحسين في التنسيق وإضافة عناوين فرعية. اقترح تقسيمه إلى أقسام واضحة.`;
1281
- break;
1282
- case 'update':
1283
- fallbackResponse = `تحديث الملف "${this.currentFile.name}":\n\nتمت إضافة معلومات جديدة وتحسين الصياغة. يوصى بإعادة تنظيم المحتوى إلى:\n- مقدمة\n- محتوى رئيسي\n- خاتمة\n\nيمكنك استخدام هذه الهيكلة لتحسين الملف.`;
1284
- break;
1285
- }
1286
- this.addMessage('assistant', fallbackResponse);
1287
- return;
1288
- }
1289
-
1290
- const endpoint = apiEndpoints[currentAttempt];
1291
- tryApiCall(endpoint)
1292
- .then(data => {
1293
- if (data.choices && data.choices[0] && data.choices[0].message) {
1294
- let aiResponse = data.choices[0].message.content;
1295
- // Add action header
1296
- const actionTitles = {
1297
- 'summarize': '📄 **تلخيص الملف**',
1298
- 'review': '✏️ **مراجعة الملف**',
1299
- 'update': '🔄 **تحديث الملف**'
1300
- };
1301
- aiResponse = `${actionTitles[action]} - "${this.currentFile.name}"\n\n${aiResponse}`;
1302
- this.addMessage('assistant', aiResponse);
1303
- } else {
1304
- throw new Error('Invalid API response structure');
1305
- }
1306
- })
1307
- .catch(error => {
1308
- console.warn(`API attempt ${currentAttempt + 1} failed:`, error);
1309
- currentAttempt++;
1310
- setTimeout(attemptApiCall, 500);
1311
- });
1312
- };
1313
-
1314
- attemptApiCall();
1315
- }
1316
- initializeIcons() {
1317
  // Replace feather icons with inline SVGs directly
1318
  const featherIcons = {
1319
  'message-circle': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-circle"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>',
@@ -1323,13 +1010,10 @@ initializeIcons() {
1323
  'book-open': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-book-open"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h 6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>',
1324
  'feather': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-feather"><path d="M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5z"/><line x1="16" y1="8" x2="2" y2="22"/><line x1="17.5" y1="15" x2="9" y2="15"/></svg>',
1325
  'trending-up': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trending-up"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/><polyline points="17 6 23 6 23 12"/></svg>',
1326
- 'send': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-send"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>',
1327
- 'paperclip': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-paperclip"><path d="M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"/></svg>',
1328
- 'file-text': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/><polyline points="14 2 14 8 20 8"/><line x1="16" y1="13" x2="8" y2="13"/><line x1="16" y1="17" x2="8" y2="17"/><polyline points="10 9 9 9 8 9"/></svg>',
1329
- 'check-circle': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/><polyline points="22 4 12 14.01 9 11.01"/></svg>',
1330
- 'refresh-cw': '<svg xmlns="http://www.w3.org2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-refresh-cw"><polyline points="23 4 23 10 17 10"/><polyline points="1 20 1 14 7 14"/><path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/></svg>'
1331
  };
1332
- // Replace all feather-icon elements
 
1333
  this.shadowRoot.querySelectorAll('.feather-icon').forEach(el => {
1334
  const iconName = el.getAttribute('data-icon');
1335
  if (featherIcons[iconName]) {
 
140
  typingIndicator.parentElement.remove();
141
  }
142
 
 
 
 
 
 
 
143
  // Enhanced system prompt for comprehensive question answering
144
  const systemPrompt = `أنت "مساعد العلو" الذكي المتطور، مدعوم بأحدث نماذج الذكاء الاصطناعي. مهمتك الأساسية هي الإجابة على أي سؤال يطرح عليك مهما كان نوعه أو مجاله، مع تقديم إجابات شاملة ومفيدة وصحيحة قدر الإمكان.
145
 
 
152
  6. **اللغة العربية**: ركز على استخدام اللغة العربية الفصحى أو العامية المفهومة، مع مراعاة السياق.
153
  7. **التهذيب والاحترام**: حافظ على المهنية والاحترام في جميع الإجابات.
154
 
155
+ أمثلة على أنواع الأسئلة التي ستجيب عنها:
156
  - أسئلة علمية: "كيف تعمل الخلايا الشمسية؟"
157
  - أسئلة تاريخية: "ما هي أسباب الحرب العالمية الأولى؟"
158
  - أسئلة تقنية: "ما الفرق بين الذكاء الاصطناعي والتعلم الآلي؟"
 
164
  - أسئلة رياضية: "ما هو قانون فيثاغورس؟"
165
  - أسئلة طبية: "ما هي أعراض الإنفلونزا؟"
166
  - أسئلة دينية: "ما هي أركان الإسلام؟"
 
167
 
168
  تذكر: أنت هنا لمساعدة المستخدم، فقدم أفضل ما لديك في كل مرة.`;
169
+
170
+ // Updated API configuration with multiple fallbacks for maximum reliability
171
  const requestBody = {
172
  model: 'openai/gpt-4-turbo-preview',
173
  messages: [
 
653
  flex: 1;
654
  }
655
  .chat-avatar {
656
+ width: 40px;
657
+ height: 40px;
658
  border-radius: 50%;
659
  background: white;
660
  display: flex;
 
662
  justify-content: center;
663
  color: #6366f1;
664
  font-weight: bold;
665
+ font-size: 20px;
666
  }
667
+ .chat-header-text {
668
  flex: 1;
669
  }
670
  .chat-header-text h3 {
671
+ font-size: 18px;
672
  margin: 0 0 4px 0;
673
  font-weight: 700;
674
  }
675
  .chat-header-text p {
676
+ font-size: 13px;
677
  opacity: 0.9;
678
  margin: 0;
679
  }
680
  .chat-header-text p .tag {
681
  background: rgba(255,255,255,0.3);
682
+ padding: 2px 8px;
683
+ border-radius: 10px;
684
+ font-size: 11px;
685
+ margin-right: 5px;
686
  }
687
  .connection-status {
688
  display: flex;
689
  align-items: center;
690
+ gap: 6px;
691
+ font-size: 12px;
692
  background: rgba(255, 255, 255, 0.2);
693
+ padding: 4px 10px;
694
  border-radius: 20px;
695
  }
696
+ .status-dot {
697
  width: 8px;
698
  height: 8px;
699
  background: #10b981;
 
706
  }
707
  .chat-actions {
708
  display: flex;
709
+ gap: 8px;
710
  }
711
  .chat-actions button {
712
  background: rgba(255, 255, 255, 0.2);
713
  border: none;
714
  color: white;
715
+ width: 36px;
716
+ height: 36px;
717
  border-radius: 50%;
718
  cursor: pointer;
719
  display: flex;
 
721
  justify-content: center;
722
  transition: background 0.2s;
723
  }
724
+ .chat-actions button:hover {
 
 
 
 
725
  background: rgba(255, 255, 255, 0.3);
726
  }
727
  .chat-body {
 
745
  align-self: flex-start;
746
  }
747
  .message-bubble {
748
+ padding: 14px 18px;
749
+ border-radius: 20px;
750
+ font-size: 15px;
751
  line-height: 1.5;
752
  }
753
+ .message.user .message-bubble {
754
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
755
  color: white;
756
  border-radius: 20px 20px 4px 20px;
 
762
  border-radius: 20px 20px 20px 4px;
763
  }
764
  .message-time {
765
+ font-size: 12px;
766
  color: #9ca3af;
767
+ margin-top: 5px;
768
  }
769
+ .quick-questions {
770
  display: flex;
771
  flex-wrap: wrap;
772
  gap: 10px;
 
775
  .quick-question {
776
  background: #f3f4f6;
777
  border: 1px solid #e5e7eb;
778
+ border-radius: 20px;
779
+ padding: 10px 16px;
780
+ font-size: 14px;
781
  color: #4b5563;
782
  cursor: pointer;
783
  transition: background 0.2s;
784
  border: none;
785
  }
786
+ .quick-question:hover {
787
  background: #e5e7eb;
788
  }
789
  .chat-footer {
 
802
  .quick-action {
803
  background: #f1f5f9;
804
  border: 1px solid #e2e8f0;
805
+ border-radius: 20px;
806
+ padding: 8px 14px;
807
+ font-size: 13px;
808
  color: #4b5563;
809
  cursor: pointer;
810
  display: flex;
811
  align-items: center;
812
+ gap: 6px;
813
  transition: all 0.2s;
814
  }
815
+ .quick-action:hover {
 
 
 
 
816
  background: #e5e7eb;
817
  transform: translateY(-2px);
818
  }
 
824
  flex: 1;
825
  border: 1px solid #d1d5db;
826
  border-radius: 50px;
827
+ padding: 14px 20px;
828
+ font-size: 15px;
829
  outline: none;
830
  transition: border 0.3s;
831
  direction: rtl;
832
  }
833
+ .chat-input:focus {
834
  border-color: #6366f1;
835
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
836
  }
 
838
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
839
  border: none;
840
  color: white;
841
+ width: 50px;
842
+ height: 50px;
843
  border-radius: 50%;
844
  cursor: pointer;
845
  display: flex;
 
847
  justify-content: center;
848
  transition: all 0.3s;
849
  }
850
+ .send-button:hover {
 
 
 
 
851
  transform: scale(1.05);
852
  box-shadow: 0 5px 15px rgba(99, 102, 241, 0.4);
853
  }
854
  .chat-footer-note {
855
+ font-size: 11px;
856
  color: #6b7280;
857
  display: flex;
858
  align-items: center;
859
+ gap: 6px;
860
  justify-content: center;
861
+ margin-top: 8px;
 
 
 
 
862
  }
863
+ .typing-indicator {
864
  display: flex;
865
  align-items: center;
866
  gap: 5px;
 
873
  .typing-indicator.ai-typing {
874
  align-self: flex-start;
875
  }
876
+ .typing-dot {
877
+ width: 8px;
878
+ height: 8px;
879
  background: #9ca3af;
880
  border-radius: 50%;
881
  animation: typing 1.4s infinite;
882
  }
883
+ .typing-dot:nth-child(2) { animation-delay: 0.2s; }
884
  .typing-dot:nth-child(3) { animation-delay: 0.4s; }
885
  @keyframes typing {
886
  0%, 60%, 100% { transform: translateY(0); }
887
  30% { transform: translateY(-6px); }
888
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
889
  @media (max-width: 640px) {
890
  #alolo-chat-widget {
891
  bottom: 20px;
 
903
  .quick-actions {
904
  flex-wrap: wrap;
905
  }
 
 
 
 
 
 
 
 
906
  .chat-header-text h3 {
907
  font-size: 16px;
908
  }
 
942
  <div class="chat-body" id="chatBody">
943
  <!-- Messages will be inserted here -->
944
  </div>
945
+
946
+ <div class="chat-footer">
947
+ <div class="quick-actions">
948
+ <button class="quick-action" data-question="اكتب مقالاً عن التعليم الإلكتروني">
949
+ <i class="feather-icon" data-icon="edit"></i>
950
+ كتابة
951
+ </button>
952
+ <button class="quick-action" data-question="اشرح مفهوم الذكاء الاصطناعي">
953
+ <i class="feather-icon" data-icon="book-open"></i>
954
+ شرح
955
+ </button>
956
+ <button class="quick-action" data-question="أنشئ قصة تعليمية قصيرة">
957
+ <i class="feather-icon" data-icon="feather"></i>
958
+ إبداع
959
+ </button>
960
+ <button class="quick-action" data-question="ما هي أحدث اتجاهات التعليم؟">
961
+ <i class="feather-icon" data-icon="trending-up"></i>
962
+ اتجاهات
963
+ </button>
964
+ </div>
965
+ <div class="chat-input-container">
966
+ <input type="text" class="chat-input" id="messageInput" placeholder="اكتب سؤالك هنا... (اضغط Enter لإرسال)" autocomplete="off">
967
+ <button class="send-button" id="sendMessage" title="إرسال">
968
+ <i class="feather-icon" data-icon="send"></i>
969
+ </button>
970
+ </div>
971
+ <div class="chat-footer-note">
972
+ <svg class="feather feather-cpu" xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="4" y="4" width="16" height="16" rx="2" ry="2"/><rect x="9" y="9" width="6" height="6"/><line x1="9" y1="1" x2="9" y2="4"/><line x1="15" y1="1" x2="15" y2="4"/><line x1="9" y1="20" x2="9" y2="23"/><line x1="15" y1="20" x2="15" y2="23"/><line x1="20" y1="9" x2="23" y2="9"/><line x1="20" y1="14" x2="23" y2="14"/><line x1="1" y1="9" x2="4" y2="9"/><line x1="1" y1="14" x2="4" y2="14"/></svg>
973
+ <span>مساعد ذكي متطور - يجيب على أي سؤال ويولد النصوص والشرح</span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
974
  </div>
975
+ </div>
976
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
977
  </div>
978
  `;
979
  // Attach event listeners
 
983
  this.shadowRoot.getElementById('messageInput').addEventListener('keypress', (e) => {
984
  if (e.key === 'Enter') this.sendMessage();
985
  });
986
+
987
  // Attach quick action buttons
988
  this.shadowRoot.querySelectorAll('.quick-action').forEach(btn => {
989
  btn.addEventListener('click', () => {
 
994
  });
995
  });
996
 
 
 
997
  // Render initial messages
998
  this.renderMessages();
999
  // Initialize icons
1000
  this.initializeIcons();
1001
  }
1002
 
1003
+ initializeIcons() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1004
  // Replace feather icons with inline SVGs directly
1005
  const featherIcons = {
1006
  'message-circle': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-circle"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"/></svg>',
 
1010
  'book-open': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-book-open"><path d="M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"/><path d="M22 3h 6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"/></svg>',
1011
  'feather': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-feather"><path d="M20.24 12.24a6 6 0 0 0-8.49-8.49L5 10.5V19h8.5z"/><line x1="16" y1="8" x2="2" y2="22"/><line x1="17.5" y1="15" x2="9" y2="15"/></svg>',
1012
  'trending-up': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-trending-up"><polyline points="23 6 13.5 15.5 8.5 10.5 1 18"/><polyline points="17 6 23 6 23 12"/></svg>',
1013
+ 'send': '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-send"><line x1="22" y1="2" x2="11" y2="13"/><polygon points="22 2 15 22 11 13 2 9 22 2"/></svg>'
 
 
 
 
1014
  };
1015
+
1016
+ // Replace all feather-icon elements
1017
  this.shadowRoot.querySelectorAll('.feather-icon').forEach(el => {
1018
  const iconName = el.getAttribute('data-icon');
1019
  if (featherIcons[iconName]) {
components/quick-actions.js CHANGED
@@ -21,18 +21,18 @@ class AloloQuickActions extends HTMLElement {
21
  background: white;
22
  border: 1px solid #d1d5db;
23
  border-radius: 50px;
24
- padding: 10px 16px;
25
- font-size: 13px;
26
  color: #4b5563;
27
  cursor: pointer;
28
  display: flex;
29
  align-items: center;
30
- gap: 6px;
31
  transition: all 0.2s;
32
- min-width: 120px;
33
  justify-content: center;
34
  }
35
- .quick-action-btn:hover {
36
  background: #f3f4f6;
37
  border-color: #9ca3af;
38
  transform: translateY(-2px);
@@ -46,10 +46,10 @@ class AloloQuickActions extends HTMLElement {
46
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
47
  }
48
  .icon {
49
- width: 16px;
50
- height: 16px;
51
  }
52
- @media (max-width: 640px) {
53
  .quick-actions-bar {
54
  flex-direction: column;
55
  }
 
21
  background: white;
22
  border: 1px solid #d1d5db;
23
  border-radius: 50px;
24
+ padding: 12px 20px;
25
+ font-size: 14px;
26
  color: #4b5563;
27
  cursor: pointer;
28
  display: flex;
29
  align-items: center;
30
+ gap: 8px;
31
  transition: all 0.2s;
32
+ min-width: 140px;
33
  justify-content: center;
34
  }
35
+ .quick-action-btn:hover {
36
  background: #f3f4f6;
37
  border-color: #9ca3af;
38
  transform: translateY(-2px);
 
46
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
47
  }
48
  .icon {
49
+ width: 18px;
50
+ height: 18px;
51
  }
52
+ @media (max-width: 640px) {
53
  .quick-actions-bar {
54
  flex-direction: column;
55
  }
index.html CHANGED
@@ -13,8 +13,8 @@
13
  <script src="components/footer.js"></script>
14
  <script src="components/chat-widget.js"></script>
15
  <script src="components/feature-card.js"></script>
16
- <script src="components/file-manager.js"></script>
17
- <style>
18
  @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');
19
  * {
20
  font-family: 'Tajawal', sans-serif;
@@ -72,11 +72,11 @@
72
 
73
  <div class="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start">
74
  <a href="#chatDemo" class="px-8 py-3 bg-gradient-to-r from-indigo-600 to-purple-600 text-white rounded-full font-semibold shadow-lg hover:shadow-xl transition-shadow">
75
- تجربة المحادثة الآن
76
  </a>
77
  <a href="https://alolo.sa" target="_blank" class="px-8 py-3 border border-indigo-300 text-indigo-600 rounded-full font-semibold hover:bg-indigo-50 transition">
78
- زيارة الموقع الرسمي
79
- </a>
80
  </div>
81
  </div>
82
 
@@ -113,56 +113,20 @@
113
  </div>
114
  </div>
115
  </section>
116
- <!-- File Management Section -->
117
- <section id="fileManagement" class="py-16 px-4 max-w-6xl mx-auto">
118
- <div class="text-center mb-12">
119
- <h2 class="text-3xl font-bold text-gray-900 mb-4">إدارة الملفات النصية الذكية</h2>
120
- <p class="text-lg text-gray-600 max-w-3xl mx-auto">رفع، تلخيص، مراجعة وتحديث الملفات النصية باستخدام الذكاء الاصطناعي المتقدم.</p>
121
- </div>
122
-
123
- <div class="mb-12">
124
- <alolo-file-manager></alolo-file-manager>
125
- </div>
126
-
127
- <div class="grid md:grid-cols-3 gap-8 mb-16">
128
- <div class="bg-white p-8 rounded-2xl shadow-lg border border-gray-100">
129
- <div class="w-14 h-14 rounded-full bg-gradient-to-r from-blue-400 to-cyan-500 text-white flex items-center justify-center mb-6 mx-auto">
130
- <i data-feather="file-text" class="w-7 h-7"></i>
131
- </div>
132
- <h3 class="text-xl font-bold text-gray-900 mb-4 text-center">رفع الملفات</h3>
133
- <p class="text-gray-600 text-center">يمكنك رفع ملفات نصية بصيغ مختلفة (txt, pdf, doc, docx) بسهولة. المساعد سيقوم بقراءة المحتوى ومعالجته.</p>
134
- </div>
135
- <div class="bg-white p-8 rounded-2xl shadow-lg border border-gray-100">
136
- <div class="w-14 h-14 rounded-full bg-gradient-to-r from-green-400 to-emerald-500 text-white flex items-center justify-center mb-6 mx-auto">
137
- <i data-feather="zap" class="w-7 h-7"></i>
138
- </div>
139
- <h3 class="text-xl font-bold text-gray-900 mb-4 text-center">معالجة ذكية</h3>
140
- <p class="text-gray-600 text-center">استخدم الذكاء الاصطناعي لتلخيص المحتوى، مراجعة الأخطاء، تحديث المعلومات وإعادة صياغة النصوص.</p>
141
- </div>
142
- <div class="bg-white p-8 rounded-2xl shadow-lg border border-gray-100">
143
- <div class="w-14 h-14 rounded-full bg-gradient-to-r from-purple-400 to-pink-500 text-white flex items-center justify-center mb-6 mx-auto">
144
- <i data-feather="download" class="w-7 h-7"></i>
145
- </div>
146
- <h3 class="text-xl font-bold text-gray-900 mb-4 text-center">تحميل النتائج</h3>
147
- <p class="text-gray-600 text-center">بعد المعالجة، يمكنك تحميل الملف المعدل بصيغة نصية جاهزة للاستخدام أو مشاركتها مع الآخرين.</p>
148
- </div>
149
- </div>
150
- </section>
151
-
152
  <!-- Chat Demo Section -->
153
  <section id="chatDemo" class="py-16 px-4 max-w-6xl mx-auto">
154
  <div class="text-center mb-12">
155
- <h2 class="text-3xl font-bold text-gray-900 mb-4">محادثة ذكية متقدمة (شبيهة بـ ChatGPT)</h2>
156
  <p class="text-lg text-gray-600 max-w-3xl mx-auto">مساعد ذكي يعمل بالذكاء الاصطناعي المتقدم، يفهم أسئلتك ويقدم إجابات دقيقة في الوقت الفعلي.</p>
157
  </div>
158
- <div class="bg-gradient-to-br from-white to-indigo-50 p-8 rounded-3xl shadow-2xl border border-indigo-100">
159
  <div class="grid md:grid-cols-2 gap-12 items-center">
160
  <div>
161
  <h3 class="text-2xl font-bold text-gray-900 mb-6">ميزات المساعد الذكي الجديد</h3>
162
  <ul class="space-y-5">
163
  <li class="flex items-start gap-3">
164
- <div class="w-9 h-9 rounded-full bg-gradient-to-r from-green-400 to-emerald-500 text-white flex items-center justify-center flex-shrink-0">
165
- <i data-feather="cpu" class="w-5 h-5"></i>
166
  </div>
167
  <div>
168
  <h4 class="font-semibold text-gray-900">ذكاء اصطناعي متقدم</h4>
@@ -170,8 +134,8 @@
170
  </div>
171
  </li>
172
  <li class="flex items-start gap-3">
173
- <div class="w-9 h-9 rounded-full bg-gradient-to-r from-blue-400 to-cyan-500 text-white flex items-center justify-center flex-shrink-0">
174
- <i data-feather="zap" class="w-5 h-5"></i>
175
  </div>
176
  <div>
177
  <h4 class="font-semibold text-gray-900">استجابة آنية</h4>
@@ -179,8 +143,8 @@
179
  </div>
180
  </li>
181
  <li class="flex items-start gap-3">
182
- <div class="w-9 h-9 rounded-full bg-gradient-to-r from-purple-400 to-pink-500 text-white flex items-center justify-center flex-shrink-0">
183
- <i data-feather="message-square" class="w-5 h-5"></i>
184
  </div>
185
  <div>
186
  <h4 class="font-semibold text-gray-900">محادثة طبيعية متعددة المنعطفات</h4>
@@ -188,8 +152,8 @@
188
  </div>
189
  </li>
190
  <li class="flex items-start gap-3">
191
- <div class="w-9 h-9 rounded-full bg-gradient-to-r from-orange-400 to-red-500 text-white flex items-center justify-center flex-shrink-0">
192
- <i data-feather="award" class="w-5 h-5"></i>
193
  </div>
194
  <div>
195
  <h4 class="font-semibold text-gray-900">مدعوم بـ OpenRouter API</h4>
@@ -203,32 +167,32 @@
203
  <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'ما هي منصة العلو التعليمية؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-4 py-2 bg-indigo-100 hover:bg-indigo-200 text-indigo-800 rounded-full text-sm transition">
204
  ما هي منصة العلو؟
205
  </button>
206
- <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'كيف يمكن للذكاء الاصطناعي تحسين التعليم؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-3 py-1.5 bg-green-100 hover:bg-green-200 text-green-800 rounded-full text-xs transition">
207
- الذكاء الاصطناعي والتعليم
208
  </button>
209
- <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'ما هي مزايا استخدام العلو للمدرسين؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-3 py-1.5 bg-purple-100 hover:bg-purple-200 text-purple-800 rounded-full text-xs transition">
210
- مزايا المدرسين
211
  </button>
212
  </div>
213
  </div>
214
  </div>
215
- <div class="bg-white p-8 rounded-3xl shadow-xl border">
216
  <div class="text-center mb-8">
217
  <div class="w-20 h-20 mx-auto rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 flex items-center justify-center text-white text-3xl font-bold mb-4">AI</div>
218
  <h4 class="text-2xl font-bold text-gray-900">مساعد Alolo الذكي المتطور</h4>
219
  <p class="text-gray-500 mt-2">انقر على أيقونة المحادثة في الزاوية السفلية اليسرى</p>
220
- <div class="inline-flex items-center mt-4 px-3 py-1 bg-gradient-to-r from-indigo-50 to-purple-50 rounded-full border border-indigo-100">
221
- <div class="w-2 h-2 rounded-full bg-green-500 mr-2 animate-pulse"></div>
222
- <span class="text-xs font-medium text-indigo-700">متصل الآن - يجيب على أي سؤال ويولد النصوص بكفاءة</span>
223
  </div>
224
  </div>
225
  <div class="space-y-4">
226
  <div class="flex items-center justify-between p-5 bg-gradient-to-r from-gray-50 to-white rounded-2xl border border-gray-200 hover:border-indigo-300 transition">
227
  <div class="flex items-center gap-4">
228
- <div class="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center">
229
- <i data-feather="brain" class="text-indigo-600 wB hB"></i>
230
  </div>
231
- <div>
232
  <h5 class="font-bold text-gray-900">فهم السياق والذاكرة</h5>
233
  <p class="text-sm text-gray-500">يتذكر محادثتك السابقة للرد بشكل مترابط</p>
234
  </div>
@@ -237,10 +201,10 @@
237
  </div>
238
  <div class="flex items-center justify-between p-5 bg-gradient-to-r from-gray-50 to-white rounded-2xl border border-gray-200 hover:border-indigo-300 transition">
239
  <div class="flex items-center gap-4">
240
- <div class="w-10 h-10 rounded-full bg-green-100 flex items-center justify-center">
241
- <i data-feather="globe" class="text-green-600 wB hB"></i>
242
  </div>
243
- <div>
244
  <h5 class="font-bold text-gray-900">معرفة موسوعية</h5>
245
  <p class="text-sm text-gray-500">يغطي مواضيع تعليمية وتقنية وإدارية متنوعة</p>
246
  </div>
 
13
  <script src="components/footer.js"></script>
14
  <script src="components/chat-widget.js"></script>
15
  <script src="components/feature-card.js"></script>
16
+
17
+ <style>
18
  @import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap');
19
  * {
20
  font-family: 'Tajawal', sans-serif;
 
72
 
73
  <div class="flex flex-col sm:flex-row gap-4 justify-center lg:justify-start">
74
  <a href="#chatDemo" class="px-8 py-3 bg-gradient-to-r from-indigo-600 to-purple-600 text-white rounded-full font-semibold shadow-lg hover:shadow-xl transition-shadow">
75
+ <span style="font-size: 0.9rem;">تجربة المحادثة الآن</span>
76
  </a>
77
  <a href="https://alolo.sa" target="_blank" class="px-8 py-3 border border-indigo-300 text-indigo-600 rounded-full font-semibold hover:bg-indigo-50 transition">
78
+ <span style="font-size: 0.9rem;">زيارة الموقع الرسمي</span>
79
+ </a>
80
  </div>
81
  </div>
82
 
 
113
  </div>
114
  </div>
115
  </section>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  <!-- Chat Demo Section -->
117
  <section id="chatDemo" class="py-16 px-4 max-w-6xl mx-auto">
118
  <div class="text-center mb-12">
119
+ <h2 class="text-3xl font-bold text-gray-900 mb-4">محادثة ذكية متقدمة</h2>
120
  <p class="text-lg text-gray-600 max-w-3xl mx-auto">مساعد ذكي يعمل بالذكاء الاصطناعي المتقدم، يفهم أسئلتك ويقدم إجابات دقيقة في الوقت الفعلي.</p>
121
  </div>
122
+ <div class="bg-gradient-to-br from-white to-indigo-50 p-8 rounded-3xl shadow-2xl border border-indigo-100">
123
  <div class="grid md:grid-cols-2 gap-12 items-center">
124
  <div>
125
  <h3 class="text-2xl font-bold text-gray-900 mb-6">ميزات المساعد الذكي الجديد</h3>
126
  <ul class="space-y-5">
127
  <li class="flex items-start gap-3">
128
+ <div class="w-10 h-10 rounded-full bg-gradient-to-r from-green-400 to-emerald-500 text-white flex items-center justify-center flex-shrink-0">
129
+ <i data-feather="cpu"></i>
130
  </div>
131
  <div>
132
  <h4 class="font-semibold text-gray-900">ذكاء اصطناعي متقدم</h4>
 
134
  </div>
135
  </li>
136
  <li class="flex items-start gap-3">
137
+ <div class="w-10 h-10 rounded-full bg-gradient-to-r from-blue-400 to-cyan-500 text-white flex items-center justify-center flex-shrink-0">
138
+ <i data-feather="zap"></i>
139
  </div>
140
  <div>
141
  <h4 class="font-semibold text-gray-900">استجابة آنية</h4>
 
143
  </div>
144
  </li>
145
  <li class="flex items-start gap-3">
146
+ <div class="w-10 h-10 rounded-full bg-gradient-to-r from-purple-400 to-pink-500 text-white flex items-center justify-center flex-shrink-0">
147
+ <i data-feather="message-square"></i>
148
  </div>
149
  <div>
150
  <h4 class="font-semibold text-gray-900">محادثة طبيعية متعددة المنعطفات</h4>
 
152
  </div>
153
  </li>
154
  <li class="flex items-start gap-3">
155
+ <div class="w-10 h-10 rounded-full bg-gradient-to-r from-orange-400 to-red-500 text-white flex items-center justify-center flex-shrink-0">
156
+ <i data-feather="award"></i>
157
  </div>
158
  <div>
159
  <h4 class="font-semibold text-gray-900">مدعوم بـ OpenRouter API</h4>
 
167
  <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'ما هي منصة العلو التعليمية؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-4 py-2 bg-indigo-100 hover:bg-indigo-200 text-indigo-800 rounded-full text-sm transition">
168
  ما هي منصة العلو؟
169
  </button>
170
+ <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'كيف يمكن للذكاء الاصطناعي تحسين التعليم؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-4 py-2 bg-green-100 hover:bg-green-200 text-green-800 rounded-full text-sm transition">
171
+ الذكاء الاصطناعي والتعليم
172
  </button>
173
+ <button onclick="document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#messageInput').value = 'ما هي مزايا استخدام العلو للمدرسين؟'; document.querySelector('alolo-chat-widget').shadowRoot.querySelector('#sendMessage').click();" class="px-4 py-2 bg-purple-100 hover:bg-purple-200 text-purple-800 rounded-full text-sm transition">
174
+ مزايا المدرسين
175
  </button>
176
  </div>
177
  </div>
178
  </div>
179
+ <div class="bg-white p-8 rounded-3xl shadow-xl border">
180
  <div class="text-center mb-8">
181
  <div class="w-20 h-20 mx-auto rounded-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 flex items-center justify-center text-white text-3xl font-bold mb-4">AI</div>
182
  <h4 class="text-2xl font-bold text-gray-900">مساعد Alolo الذكي المتطور</h4>
183
  <p class="text-gray-500 mt-2">انقر على أيقونة المحادثة في الزاوية السفلية اليسرى</p>
184
+ <div class="inline-flex items-center mt-4 px-4 py-2 bg-gradient-to-r from-indigo-50 to-purple-50 rounded-full border border-indigo-100">
185
+ <div class="w-3 h-3 rounded-full bg-green-500 mr-2 animate-pulse"></div>
186
+ <span class="text-sm font-medium text-indigo-700">متصل الآن - يجيب على أي سؤال ويولد النصوص بكفاءة</span>
187
  </div>
188
  </div>
189
  <div class="space-y-4">
190
  <div class="flex items-center justify-between p-5 bg-gradient-to-r from-gray-50 to-white rounded-2xl border border-gray-200 hover:border-indigo-300 transition">
191
  <div class="flex items-center gap-4">
192
+ <div class="w-12 h-12 rounded-full bg-indigo-100 flex items-center justify-center">
193
+ <i data-feather="brain" class="text-indigo-600"></i>
194
  </div>
195
+ <div>
196
  <h5 class="font-bold text-gray-900">فهم السياق والذاكرة</h5>
197
  <p class="text-sm text-gray-500">يتذكر محادثتك السابقة للرد بشكل مترابط</p>
198
  </div>
 
201
  </div>
202
  <div class="flex items-center justify-between p-5 bg-gradient-to-r from-gray-50 to-white rounded-2xl border border-gray-200 hover:border-indigo-300 transition">
203
  <div class="flex items-center gap-4">
204
+ <div class="w-12 h-12 rounded-full bg-green-100 flex items-center justify-center">
205
+ <i data-feather="globe" class="text-green-600"></i>
206
  </div>
207
+ <div>
208
  <h5 class="font-bold text-gray-900">معرفة موسوعية</h5>
209
  <p class="text-sm text-gray-500">يغطي مواضيع تعليمية وتقنية وإدارية متنوعة</p>
210
  </div>