joermd commited on
Commit
4e171a7
·
verified ·
1 Parent(s): e42e61f

Update reg.html

Browse files
Files changed (1) hide show
  1. reg.html +41 -8
reg.html CHANGED
@@ -246,7 +246,7 @@
246
  <i class="fas fa-comments ml-3"></i>
247
  <span>استشارة قانونية</span>
248
  </div>
249
- <div class="nav-link" data-section="precedents">
250
  <i class="fas fa-gavel ml-3"></i>
251
  <span>الأحكام والسوابق</span>
252
  </div>
@@ -266,7 +266,7 @@
266
  <section id="home" class="section">
267
  <h2 class="text-3xl font-bold text-gray-800 mb-8">الخدمات القانونية</h2>
268
  <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
269
- <!-- بطاقات الخدمة -->
270
  <div class="feature-card p-6">
271
  <div class="text-center">
272
  <i class="fas fa-balance-scale text-3xl mb-4 text-blue-600"></i>
@@ -277,6 +277,7 @@
277
  <button class="action-button" onclick="showSection('analysis')">ابدأ التحليل</button>
278
  </div>
279
  </div>
 
280
  <div class="feature-card p-6">
281
  <div class="text-center">
282
  <i class="fas fa-project-diagram text-3xl mb-4 text-blue-600"></i>
@@ -287,6 +288,7 @@
287
  <button class="action-button" onclick="showSection('mindMap')">إنشاء خريطة التفكير</button>
288
  </div>
289
  </div>
 
290
  <div class="feature-card p-6">
291
  <div class="text-center">
292
  <i class="fas fa-search text-3xl mb-4 text-blue-600"></i>
@@ -297,6 +299,7 @@
297
  <button class="action-button" onclick="showSection('search')">ابدأ البحث</button>
298
  </div>
299
  </div>
 
300
  <div class="feature-card p-6">
301
  <div class="text-center">
302
  <i class="fas fa-file-alt text-3xl mb-4 text-blue-600"></i>
@@ -307,6 +310,7 @@
307
  <button class="action-button" onclick="showSection('documents')">إنشاء مستند</button>
308
  </div>
309
  </div>
 
310
  <div class="feature-card p-6">
311
  <div class="text-center">
312
  <i class="fas fa-language text-3xl mb-4 text-blue-600"></i>
@@ -317,6 +321,7 @@
317
  <button class="action-button" onclick="showSection('translation')">ترجمة</button>
318
  </div>
319
  </div>
 
320
  <div class="feature-card p-6">
321
  <div class="text-center">
322
  <i class="fas fa-comments text-3xl mb-4 text-blue-600"></i>
@@ -386,7 +391,7 @@
386
  <section id="search" class="section hidden">
387
  <h2 class="text-3xl font-bold text-gray-800 mb-8">البحث القانوني</h2>
388
  <div class="input-group bg-white rounded p-6 shadow">
389
- <textarea class="w-full p-3 border rounded" placeholder="اكتب استعلام البحث القانوني..." ></textarea>
390
  <button class="action-button mt-4" onclick="handleSubmit('search')">بحث</button>
391
  <div id="searchResult" class="mt-4 response-container"></div>
392
  </div>
@@ -527,10 +532,10 @@
527
 
528
  <!-- سكربتات الموقع -->
529
  <script>
530
- // استخدام API كما كان سابقاً
531
  const API_URL = 'https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/chat';
532
 
533
- // دالة الحصول على البادئة (prompt prefix) بناءً على القسم مع برومبت ثابت للبحث
534
  function getPromptPrefix(section) {
535
  switch(section) {
536
  case 'analysis':
@@ -598,11 +603,38 @@
598
  });
599
  });
600
 
601
- // دالة إرسال الطلبات العامة لجميع الأقسام باستخدام API الموحد
602
  async function handleSubmit(section) {
603
  const container = document.getElementById(section);
604
  const textarea = container.querySelector("textarea");
605
  const resultDiv = container.querySelector(".response-container");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
606
  const text = textarea.value.trim();
607
  if (!text) {
608
  alert("الرجاء إدخال نص");
@@ -612,15 +644,16 @@
612
  message: getPromptPrefix(section) + text,
613
  history: []
614
  };
 
 
615
  try {
616
- resultDiv.innerHTML = '<div class="loading-spinner"></div>';
617
  const response = await fetch(API_URL, {
618
  method: "POST",
619
  headers: { "Content-Type": "application/json" },
620
  body: JSON.stringify(payload)
621
  });
622
  if (!response.ok) {
623
- throw new Error("Network response was not ok");
624
  }
625
  const data = await response.json();
626
  resultDiv.innerHTML = data.response || "";
 
246
  <i class="fas fa-comments ml-3"></i>
247
  <span>استشارة قانونية</span>
248
  </div>
249
+ <div class="nav-link" data-section="contracts">
250
  <i class="fas fa-gavel ml-3"></i>
251
  <span>الأحكام والسوابق</span>
252
  </div>
 
266
  <section id="home" class="section">
267
  <h2 class="text-3xl font-bold text-gray-800 mb-8">الخدمات القانونية</h2>
268
  <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
269
+ <!-- بطاقة خدمة التحليل القانوني -->
270
  <div class="feature-card p-6">
271
  <div class="text-center">
272
  <i class="fas fa-balance-scale text-3xl mb-4 text-blue-600"></i>
 
277
  <button class="action-button" onclick="showSection('analysis')">ابدأ التحليل</button>
278
  </div>
279
  </div>
280
+ <!-- بطاقة خدمة خريطة التفكير -->
281
  <div class="feature-card p-6">
282
  <div class="text-center">
283
  <i class="fas fa-project-diagram text-3xl mb-4 text-blue-600"></i>
 
288
  <button class="action-button" onclick="showSection('mindMap')">إنشاء خريطة التفكير</button>
289
  </div>
290
  </div>
291
+ <!-- بطاقة خدمة البحث القانوني -->
292
  <div class="feature-card p-6">
293
  <div class="text-center">
294
  <i class="fas fa-search text-3xl mb-4 text-blue-600"></i>
 
299
  <button class="action-button" onclick="showSection('search')">ابدأ البحث</button>
300
  </div>
301
  </div>
302
+ <!-- بطاقة خدمة إنشاء المستندات -->
303
  <div class="feature-card p-6">
304
  <div class="text-center">
305
  <i class="fas fa-file-alt text-3xl mb-4 text-blue-600"></i>
 
310
  <button class="action-button" onclick="showSection('documents')">إنشاء مستند</button>
311
  </div>
312
  </div>
313
+ <!-- بطاقة خدمة الترجمة القانونية -->
314
  <div class="feature-card p-6">
315
  <div class="text-center">
316
  <i class="fas fa-language text-3xl mb-4 text-blue-600"></i>
 
321
  <button class="action-button" onclick="showSection('translation')">ترجمة</button>
322
  </div>
323
  </div>
324
+ <!-- بطاقة خدمة الاستشارة القانونية -->
325
  <div class="feature-card p-6">
326
  <div class="text-center">
327
  <i class="fas fa-comments text-3xl mb-4 text-blue-600"></i>
 
391
  <section id="search" class="section hidden">
392
  <h2 class="text-3xl font-bold text-gray-800 mb-8">البحث القانوني</h2>
393
  <div class="input-group bg-white rounded p-6 shadow">
394
+ <textarea class="w-full p-3 border rounded" placeholder="اكتب استعلام البحث القانوني..."></textarea>
395
  <button class="action-button mt-4" onclick="handleSubmit('search')">بحث</button>
396
  <div id="searchResult" class="mt-4 response-container"></div>
397
  </div>
 
532
 
533
  <!-- سكربتات الموقع -->
534
  <script>
535
+ // تعريف API النصي (للقسم غير المعتمد على رفع الملفات)
536
  const API_URL = 'https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/chat';
537
 
538
+ // دالة الحصول على البادئة (prompt prefix) بناءً على القسم مع برومبت ثابت
539
  function getPromptPrefix(section) {
540
  switch(section) {
541
  case 'analysis':
 
603
  });
604
  });
605
 
606
+ // دالة إرسال الطلبات العامة لجميع الأقسام
607
  async function handleSubmit(section) {
608
  const container = document.getElementById(section);
609
  const textarea = container.querySelector("textarea");
610
  const resultDiv = container.querySelector(".response-container");
611
+
612
+ // إذا كان القسم "analysis" وتوجد ملفات PDF مرفقة، نستخدم API رفع الملفات
613
+ if (section === 'analysis') {
614
+ const fileInput = container.querySelector("#analysisPDF");
615
+ if (fileInput && fileInput.files && fileInput.files.length > 0) {
616
+ let formData = new FormData();
617
+ formData.append("file", fileInput.files[0]);
618
+ resultDiv.innerHTML = '<div class="loading-spinner"></div>';
619
+ try {
620
+ const uploadResponse = await fetch('https://g2mgow5tgbxsjy-7777.proxy.runpod.net/proxy/8000/upload', {
621
+ method: "POST",
622
+ body: formData
623
+ });
624
+ if (!uploadResponse.ok) {
625
+ throw new Error("فشل رفع الملف");
626
+ }
627
+ const uploadData = await uploadResponse.json();
628
+ resultDiv.innerHTML = uploadData.response || "";
629
+ } catch (error) {
630
+ console.error("Error:", error);
631
+ resultDiv.innerHTML = '<div class="text-red-500">حدث خطأ في رفع الملف. يرجى المحاولة مرة أخرى.</div>';
632
+ }
633
+ return; // عند التعامل مع الملف نتوقف هنا
634
+ }
635
+ }
636
+
637
+ // إذا لم يوجد ملف (أو في الأقسام الأخرى) نستخدم النص المُدخل
638
  const text = textarea.value.trim();
639
  if (!text) {
640
  alert("الرجاء إدخال نص");
 
644
  message: getPromptPrefix(section) + text,
645
  history: []
646
  };
647
+
648
+ resultDiv.innerHTML = '<div class="loading-spinner"></div>';
649
  try {
 
650
  const response = await fetch(API_URL, {
651
  method: "POST",
652
  headers: { "Content-Type": "application/json" },
653
  body: JSON.stringify(payload)
654
  });
655
  if (!response.ok) {
656
+ throw new Error("فشل الاستجابة من الخادم");
657
  }
658
  const data = await response.json();
659
  resultDiv.innerHTML = data.response || "";