v1.8.0: bge-m3 embeddings, qwen3 LLM, retrieval fixes, input validation, memory poisoning fix
This commit is contained in:
+24
-5
@@ -331,7 +331,7 @@ document.title = (bookTitle || 'كتاب') + ' — AfakZaid';
|
||||
|
||||
// Load PDF — public, no auth required
|
||||
if (bookId) {
|
||||
const pdfUrl = `/api/library/${bookId}/pdf`;
|
||||
const pdfUrl = `/api/library/${bookId}/read`;
|
||||
const titleEl = document.getElementById('book-title-loading');
|
||||
if (titleEl) titleEl.textContent = bookTitle || '';
|
||||
|
||||
@@ -370,10 +370,29 @@ if (bookId) {
|
||||
frame.src = `https://docs.google.com/viewer?url=${encodeURIComponent(fullUrl)}&embedded=true`;
|
||||
document.getElementById('loading').style.display = 'none';
|
||||
} else {
|
||||
// Desktop: direct iframe src
|
||||
frame.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:none';
|
||||
frame.src = pdfUrl;
|
||||
setTimeout(() => document.getElementById('loading').style.display = 'none', 1000);
|
||||
// Desktop: check book is accessible first then load
|
||||
fetch(pdfUrl, {method:'HEAD'}).then(r => {
|
||||
document.getElementById('loading').style.display = 'none';
|
||||
if (r.ok) {
|
||||
frame.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:none';
|
||||
frame.src = pdfUrl;
|
||||
} else {
|
||||
frame.style.cssText = 'position:absolute;inset:0;width:100%;height:100%;border:none;display:flex;align-items:center;justify-content:center';
|
||||
frame.srcdoc = `<html dir="rtl"><body style="font-family:sans-serif;display:flex;height:100vh;align-items:center;justify-content:center;background:#0c1324;color:#dce1fb;flex-direction:column;gap:12px">
|
||||
<span style="font-size:48px">📚</span>
|
||||
<p style="font-size:18px;font-weight:bold">الكتاب قيد المعالجة</p>
|
||||
<p style="font-size:14px;color:#888">يتم فهرسة هذا الكتاب حالياً، يرجى المحاولة بعد قليل</p>
|
||||
<a href="/library" style="color:#4edea3;font-size:14px">← العودة للمكتبة</a>
|
||||
</body></html>`;
|
||||
}
|
||||
}).catch(() => {
|
||||
document.getElementById('loading').style.display = 'none';
|
||||
frame.srcdoc = `<html dir="rtl"><body style="font-family:sans-serif;display:flex;height:100vh;align-items:center;justify-content:center;background:#0c1324;color:#dce1fb;flex-direction:column;gap:12px">
|
||||
<span style="font-size:48px">⚠️</span>
|
||||
<p style="font-size:18px;font-weight:bold">تعذّر تحميل الكتاب</p>
|
||||
<a href="/library" style="color:#4edea3;font-size:14px">← العودة للمكتبة</a>
|
||||
</body></html>`;
|
||||
});
|
||||
}
|
||||
|
||||
if (userToken) checkFavorite();
|
||||
|
||||
Reference in New Issue
Block a user