joermd commited on
Commit
382813c
·
verified ·
1 Parent(s): 344a133

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +30 -7
index.html CHANGED
@@ -87,6 +87,18 @@
87
  align-items: center;
88
  justify-content: center;
89
  }
 
 
 
 
 
 
 
 
 
 
 
 
90
  </style>
91
  </head>
92
  <body class="bg-gradient-to-br from-gray-100 via-blue-100 to-indigo-100 min-h-screen">
@@ -209,6 +221,11 @@
209
  </h2>
210
  <div id="explanationText" class="text-2xl text-gray-700"></div>
211
  </div>
 
 
 
 
 
212
  </div>
213
 
214
  <!-- قسم معلومات المترجم والتقرير وإعادة المراجعة -->
@@ -258,18 +275,18 @@
258
  // متغير لإعادة المحاولة إذا ظهر "server is busy"
259
  let retryCount = 0;
260
 
261
- /* برومت مختصر:
262
- - قم بترجمة النص الهدف إلى لغة النص المصدر.
263
  - قارن بين النص المصدر والنص الهدف المترجم.
264
- - ضع الاختلافات أو النصوص المفقودة بين أقواس ().
265
  - أضف تعريفاً مبسطاً يوضح الفرق بين النصين.
266
  - إذا كانت النصوص متطابقة، اكتب [MATCH].
267
  - أضف "مكافأة: لقد نجحت في التحدي!" إذا كانت النتائج دقيقة، أو "عقوبة: فشلت في التحدي!" إذا كان هناك خطأ.
268
- - إذا ظهر "server is busy"، أعد التحليل.
269
 
270
  النص المصدر:
271
  {source}
272
-
273
  النص الهدف:
274
  {target}`;
275
 
@@ -494,6 +511,7 @@
494
  document.getElementById('sourceTextReview').innerHTML = '';
495
  document.getElementById('targetTextReview').innerHTML = '';
496
  document.getElementById('explanationText').innerHTML = '';
 
497
  retryCount = 0;
498
  };
499
 
@@ -522,20 +540,21 @@
522
  </div>`;
523
  document.getElementById('errorsList').appendChild(progressDiv);
524
 
 
525
  const prompt = ANALYSIS_PROMPT
526
  .replace("{source}", sourceText)
527
  .replace("{target}", targetText);
528
-
529
  const payload = {
530
  model: "deepseek-chat",
531
  messages: [
532
- { role: "system", content: "أنت نموذج DeepSeek؛ ترجم النص الهدف إلى لغة المصدر ثم قارن بينهما واستخرج فقط الاختلافات (النصوص الناقصة) مع وضعها بين أقواس ()." },
533
  { role: "user", content: prompt }
534
  ],
535
  temperature: 0.3,
536
  max_tokens: 2048,
537
  stream: false
538
  };
 
539
 
540
  const response = await fetch('https://api.deepseek.com/chat/completions', {
541
  method: 'POST',
@@ -553,6 +572,10 @@
553
  let analysisOutput = data.choices[0].message.content.trim();
554
  progressDiv.remove();
555
 
 
 
 
 
556
  // إذا ظهر "server is busy" أعد المحاولة
557
  if (analysisOutput.toLowerCase().includes("server is busy")) {
558
  if (retryCount < 3) {
 
87
  align-items: center;
88
  justify-content: center;
89
  }
90
+ /* منطقة سلسلة التفكير */
91
+ #chainOfThought {
92
+ display: none;
93
+ margin-top: 1rem;
94
+ background-color: #f9fafb;
95
+ padding: 1rem;
96
+ border: 1px solid #e5e7eb;
97
+ border-radius: 0.5rem;
98
+ font-size: 0.9rem;
99
+ direction: ltr;
100
+ text-align: left;
101
+ }
102
  </style>
103
  </head>
104
  <body class="bg-gradient-to-br from-gray-100 via-blue-100 to-indigo-100 min-h-screen">
 
221
  </h2>
222
  <div id="explanationText" class="text-2xl text-gray-700"></div>
223
  </div>
224
+ <!-- منطقة سلسلة التفكير -->
225
+ <div id="chainOfThought">
226
+ <h3 class="text-lg font-bold text-gray-800 mb-2">سلسلة التفكير:</h3>
227
+ <pre id="chainText" class="whitespace-pre-wrap text-gray-700"></pre>
228
+ </div>
229
  </div>
230
 
231
  <!-- قسم معلومات المترجم والتقرير وإعادة المراجعة -->
 
275
  // متغير لإعادة المحاولة إذا ظهر "server is busy"
276
  let retryCount = 0;
277
 
278
+ /* برومت مبسط:
279
+ - ترجم النص الهدف إلى لغة النص المصدر.
280
  - قارن بين النص المصدر والنص الهدف المترجم.
281
+ - ضع الاختلافات (النصوص الناقصة) بين أقواس ().
282
  - أضف تعريفاً مبسطاً يوضح الفرق بين النصين.
283
  - إذا كانت النصوص متطابقة، اكتب [MATCH].
284
  - أضف "مكافأة: لقد نجحت في التحدي!" إذا كانت النتائج دقيقة، أو "عقوبة: فشلت في التحدي!" إذا كان هناك خطأ.
285
+ - إذا ظهر "server is busy"، أعد المحاولة.
286
 
287
  النص المصدر:
288
  {source}
289
+
290
  النص الهدف:
291
  {target}`;
292
 
 
511
  document.getElementById('sourceTextReview').innerHTML = '';
512
  document.getElementById('targetTextReview').innerHTML = '';
513
  document.getElementById('explanationText').innerHTML = '';
514
+ document.getElementById('chainOfThought').style.display = "none";
515
  retryCount = 0;
516
  };
517
 
 
540
  </div>`;
541
  document.getElementById('errorsList').appendChild(progressDiv);
542
 
543
+ // التأكد من إرسال النصوص: تسجيل الـ payload في وحدة التحكم
544
  const prompt = ANALYSIS_PROMPT
545
  .replace("{source}", sourceText)
546
  .replace("{target}", targetText);
 
547
  const payload = {
548
  model: "deepseek-chat",
549
  messages: [
550
+ { role: "system", content: "أنت نموذج DeepSeek؛ ترجم النص الهدف إلى لغة النص المصدر ثم قارن بينهما واخرج فقط الاختلافات (النصوص الناقصة) مع وضعها بين أقواس ()." },
551
  { role: "user", content: prompt }
552
  ],
553
  temperature: 0.3,
554
  max_tokens: 2048,
555
  stream: false
556
  };
557
+ console.log("Sending payload:", payload);
558
 
559
  const response = await fetch('https://api.deepseek.com/chat/completions', {
560
  method: 'POST',
 
572
  let analysisOutput = data.choices[0].message.content.trim();
573
  progressDiv.remove();
574
 
575
+ // عرض سلسلة التفكير في منطقة خاصة (قبل التعليم)
576
+ document.getElementById('chainText').innerText = analysisOutput;
577
+ document.getElementById('chainOfThought').style.display = "block";
578
+
579
  // إذا ظهر "server is busy" أعد المحاولة
580
  if (analysisOutput.toLowerCase().includes("server is busy")) {
581
  if (retryCount < 3) {