Spaces:
Running
Running
Update reg.html
Browse files
reg.html
CHANGED
@@ -210,7 +210,6 @@
|
|
210 |
<aside class="sidebar">
|
211 |
<div class="p-6">
|
212 |
<div class="flex items-center gap-4 mb-8">
|
213 |
-
<!-- استخدام الصورة المطلوبة كشعار -->
|
214 |
<img src="https://ufastpro.com/wp-content/uploads/2025/02/تصميم-بدون-عنوان.png" alt="شعار المنصة" class="w-12 h-12 rounded-full" />
|
215 |
<div>
|
216 |
<h1 class="text-xl font-bold text-gray-800">المنصة القانونية</h1>
|
@@ -603,31 +602,34 @@
|
|
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",
|
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 |
-
|
|
|
629 |
} catch (error) {
|
630 |
-
console.error("Error:", error);
|
631 |
resultDiv.innerHTML = '<div class="text-red-500">حدث خطأ في رفع الملف. يرجى المحاولة مرة أخرى.</div>';
|
632 |
}
|
633 |
return; // عند التعامل مع الملف نتوقف هنا
|
@@ -635,6 +637,7 @@
|
|
635 |
}
|
636 |
|
637 |
// إذا لم يوجد ملف (أو في الأقسام الأخرى) نستخدم النص المُدخل
|
|
|
638 |
const text = textarea.value.trim();
|
639 |
if (!text) {
|
640 |
alert("الرجاء إدخال نص");
|
|
|
210 |
<aside class="sidebar">
|
211 |
<div class="p-6">
|
212 |
<div class="flex items-center gap-4 mb-8">
|
|
|
213 |
<img src="https://ufastpro.com/wp-content/uploads/2025/02/تصميم-بدون-عنوان.png" alt="شعار المنصة" class="w-12 h-12 rounded-full" />
|
214 |
<div>
|
215 |
<h1 class="text-xl font-bold text-gray-800">المنصة القانونية</h1>
|
|
|
602 |
});
|
603 |
});
|
604 |
|
605 |
+
// دالة إرسال الطلبات لجميع الأقسام
|
606 |
async function handleSubmit(section) {
|
607 |
const container = document.getElementById(section);
|
|
|
608 |
const resultDiv = container.querySelector(".response-container");
|
609 |
|
610 |
// إذا كان القسم "analysis" وتوجد ملفات PDF مرفقة، نستخدم API رفع الملفات
|
611 |
if (section === 'analysis') {
|
612 |
const fileInput = container.querySelector("#analysisPDF");
|
613 |
if (fileInput && fileInput.files && fileInput.files.length > 0) {
|
614 |
+
const file = fileInput.files[0];
|
615 |
+
console.log("Selected file:", file);
|
616 |
let formData = new FormData();
|
617 |
+
formData.append("file", file);
|
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 |
+
console.log("Upload response:", uploadResponse);
|
625 |
if (!uploadResponse.ok) {
|
626 |
throw new Error("فشل رفع الملف");
|
627 |
}
|
628 |
const uploadData = await uploadResponse.json();
|
629 |
+
console.log("Upload data:", uploadData);
|
630 |
+
resultDiv.innerHTML = uploadData.response || "تم رفع الملف بنجاح";
|
631 |
} catch (error) {
|
632 |
+
console.error("Error uploading file:", error);
|
633 |
resultDiv.innerHTML = '<div class="text-red-500">حدث خطأ في رفع الملف. يرجى المحاولة مرة أخرى.</div>';
|
634 |
}
|
635 |
return; // عند التعامل مع الملف نتوقف هنا
|
|
|
637 |
}
|
638 |
|
639 |
// إذا لم يوجد ملف (أو في الأقسام الأخرى) نستخدم النص المُدخل
|
640 |
+
const textarea = container.querySelector("textarea");
|
641 |
const text = textarea.value.trim();
|
642 |
if (!text) {
|
643 |
alert("الرجاء إدخال نص");
|