Ritesh-hf commited on
Commit
03ed5c8
·
1 Parent(s): 189cd2f

question number alighments

Browse files
Files changed (1) hide show
  1. templates/chat.html +17 -8
templates/chat.html CHANGED
@@ -15,9 +15,7 @@
15
  <script src="https://cdn.tailwindcss.com"></script>
16
 
17
  <style>
18
- *{
19
- direction: rtl;
20
- }
21
  .main-chat-container{
22
  position: relative;
23
  background-color: rgb(0, 0, 0, 0.4);
@@ -263,7 +261,7 @@
263
  }
264
  }
265
 
266
- *{
267
  unicode-bidi:bidi-override;
268
  direction: RTL;
269
  }
@@ -456,18 +454,29 @@
456
  $(".start-block").removeClass("flex");
457
  }
458
 
459
- const isRTL = true;
 
 
 
 
 
 
 
 
 
 
 
460
 
461
  $(".chat-container").append(`
462
- <div class="chat-block question-block w-full flex flex-row-reverse items-center justify-end p-3 rtl z-10" style="background-color: rgba(255, 255, 255, 0.529);">
463
  <div class="flex items-center order-2">
464
  <span style="width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50px; padding: 3px; border: 2px solid #c2c2c2;">
465
  <svg fill="#000000" width="36px" height="36px" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M128,76a44,44,0,1,1-44,44A43.99983,43.99983,0,0,1,128,76Zm48-12h16V80a8,8,0,0,0,16,0V64h16a8,8,0,0,0,0-16H208V32a8,8,0,0,0-16,0V48H176a8,8,0,0,0,0,16Zm45.56006,40.95605a8.00039,8.00039,0,0,0-6.64893,9.15381A89.00044,89.00044,0,0,1,216,128a87.63672,87.63672,0,0,1-22.24182,58.41016,79.7044,79.7044,0,0,0-24.431-22.97461,59.83641,59.83641,0,0,1-82.6543,0A79.70345,79.70345,0,0,0,62.2417,186.41016,87.9498,87.9498,0,0,1,128,40a89.02966,89.02966,0,0,1,13.89062,1.08887,7.99994,7.99994,0,1,0,2.50391-15.80274A104.0826,104.0826,0,0,0,24,128a103.74716,103.74716,0,0,0,33.81934,76.68066,7.94507,7.94507,0,0,0,1.32629,1.18946,103.784,103.784,0,0,0,137.71252-.00293,7.94633,7.94633,0,0,0,1.31678-1.18115A103.74751,103.74751,0,0,0,232,128a105.04749,105.04749,0,0,0-1.28613-16.39453A7.99752,7.99752,0,0,0,221.56006,104.95605Z"></path> </g></svg>
466
  </span>
467
  </div>
468
  <div class="px-3 order-1">
469
- <div class="message-content pr-2" style="width: 100%; margin: auto; text-wrap: pretty; font-size: 14px; text-align: right;">
470
- <span> ${question} </span>
471
  </div>
472
  </div>
473
  </div>
 
15
  <script src="https://cdn.tailwindcss.com"></script>
16
 
17
  <style>
18
+
 
 
19
  .main-chat-container{
20
  position: relative;
21
  background-color: rgb(0, 0, 0, 0.4);
 
261
  }
262
  }
263
 
264
+ *:not(.special-span){
265
  unicode-bidi:bidi-override;
266
  direction: RTL;
267
  }
 
454
  $(".start-block").removeClass("flex");
455
  }
456
 
457
+ const englishRegex = /[A-Za-z0-9]+/g;
458
+
459
+
460
+ // Wrap Arabic text in <span dir="rtl">
461
+ // content = content.replace(arabicRegex, function(match) {
462
+ // return `<span dir="rtl">${match}</span>`;
463
+ // });
464
+
465
+ // Wrap English text and numbers in <span dir="ltr">
466
+ formatted_question = question.replace(englishRegex, function(match) {
467
+ return `<span class="special-span" dir="ltr">${match}</span>`;
468
+ });
469
 
470
  $(".chat-container").append(`
471
+ <div class="chat-block question-block w-full flex flex-row-reverse items-center justify-end p-3 z-10" style="background-color: rgba(255, 255, 255, 0.529);">
472
  <div class="flex items-center order-2">
473
  <span style="width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50px; padding: 3px; border: 2px solid #c2c2c2;">
474
  <svg fill="#000000" width="36px" height="36px" viewBox="0 0 256 256" id="Flat" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <path d="M128,76a44,44,0,1,1-44,44A43.99983,43.99983,0,0,1,128,76Zm48-12h16V80a8,8,0,0,0,16,0V64h16a8,8,0,0,0,0-16H208V32a8,8,0,0,0-16,0V48H176a8,8,0,0,0,0,16Zm45.56006,40.95605a8.00039,8.00039,0,0,0-6.64893,9.15381A89.00044,89.00044,0,0,1,216,128a87.63672,87.63672,0,0,1-22.24182,58.41016,79.7044,79.7044,0,0,0-24.431-22.97461,59.83641,59.83641,0,0,1-82.6543,0A79.70345,79.70345,0,0,0,62.2417,186.41016,87.9498,87.9498,0,0,1,128,40a89.02966,89.02966,0,0,1,13.89062,1.08887,7.99994,7.99994,0,1,0,2.50391-15.80274A104.0826,104.0826,0,0,0,24,128a103.74716,103.74716,0,0,0,33.81934,76.68066,7.94507,7.94507,0,0,0,1.32629,1.18946,103.784,103.784,0,0,0,137.71252-.00293,7.94633,7.94633,0,0,0,1.31678-1.18115A103.74751,103.74751,0,0,0,232,128a105.04749,105.04749,0,0,0-1.28613-16.39453A7.99752,7.99752,0,0,0,221.56006,104.95605Z"></path> </g></svg>
475
  </span>
476
  </div>
477
  <div class="px-3 order-1">
478
+ <div class="message-content pr-2" dir="auto" style="width: 100%; margin: auto; text-wrap: pretty; font-size: 14px; text-align: right;">
479
+ ${formatted_question}
480
  </div>
481
  </div>
482
  </div>