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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html data-theme="dark" dir="rtl" lang="ar">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="utf-8" />
|
| 5 |
+
<title>SurfGO Research | المختبر الذكي</title>
|
| 6 |
+
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&family=Fira+Code:wght@400;500&display=swap" rel="stylesheet">
|
| 7 |
+
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet">
|
| 8 |
+
<style>
|
| 9 |
+
:root { --bg: #05070a; --panel: #0f172a; --accent: #3b82f6; --thinking-bg: #1e293b; --text: #f1f5f9; }
|
| 10 |
+
body { font-family: 'Tajawal', sans-serif; background: var(--bg); color: var(--text); margin: 0; overflow: hidden; }
|
| 11 |
+
|
| 12 |
+
.research-container { display: grid; grid-template-columns: 1fr 1fr; height: 100vh; }
|
| 13 |
+
|
| 14 |
+
/* الجانب الأيمن: محادثة الذكاء الاصطناعي */
|
| 15 |
+
.ai-section { background: var(--panel); border-left: 1px solid #1e293b; display: flex; flex-direction: column; padding: 20px; }
|
| 16 |
+
.chat-box { flex-grow: 1; overflow-y: auto; padding: 10px; }
|
| 17 |
+
.message { margin-bottom: 20px; line-height: 1.6; }
|
| 18 |
+
.thinking-block {
|
| 19 |
+
font-family: 'Fira Code', monospace; font-size: 13px; background: var(--thinking-bg);
|
| 20 |
+
padding: 15px; border-radius: 10px; border-right: 4px solid var(--accent); margin: 10px 0;
|
| 21 |
+
color: #94a3b8; white-space: pre-wrap;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/* الجانب الأيسر: الوثائق والنتائج المقترحة */
|
| 25 |
+
.results-section { padding: 30px; overflow-y: auto; background: var(--bg); }
|
| 26 |
+
.doc-card {
|
| 27 |
+
background: #111827; border: 1px solid #1f2937; padding: 15px;
|
| 28 |
+
border-radius: 8px; margin-bottom: 15px; transition: 0.3s;
|
| 29 |
+
}
|
| 30 |
+
.doc-card:hover { transform: translateY(-3px); border-color: var(--accent); }
|
| 31 |
+
|
| 32 |
+
.search-input-area {
|
| 33 |
+
background: #1e293b; padding: 15px; border-radius: 12px;
|
| 34 |
+
display: flex; gap: 10px; align-items: center;
|
| 35 |
+
}
|
| 36 |
+
input { flex-grow: 1; background: transparent; border: none; color: white; outline: none; font-size: 16px; }
|
| 37 |
+
|
| 38 |
+
.badge { background: var(--accent); padding: 2px 8px; border-radius: 4px; font-size: 11px; margin-left: 5px; }
|
| 39 |
+
</style>
|
| 40 |
+
</head>
|
| 41 |
+
<body>
|
| 42 |
+
|
| 43 |
+
<div class="research-container">
|
| 44 |
+
|
| 45 |
+
<!-- قسم التفاعل مع DeepSeek -->
|
| 46 |
+
<section class="ai-section">
|
| 47 |
+
<div style="display:flex; justify-content:space-between; align-items:center;">
|
| 48 |
+
<h2><i class="fas fa-microscope"></i> مختبر الأبحاث</h2>
|
| 49 |
+
<span id="modelStatus" style="font-size:12px; color:#10b981;">● DeepSeek V4 Flash Online</span>
|
| 50 |
+
</div>
|
| 51 |
+
|
| 52 |
+
<div class="chat-box" id="chatBox">
|
| 53 |
+
<div class="message ai">
|
| 54 |
+
أهلاً بك في ميزة البحث المعمق. ما هو الموضوع الذي تود تفكيكه اليوم؟ سأقوم بطرح أسئلة دقيقة لبناء استعلام بحث مثالي.
|
| 55 |
+
</div>
|
| 56 |
+
</div>
|
| 57 |
+
|
| 58 |
+
<div id="currentThinking" class="thinking-block" style="display:none;"></div>
|
| 59 |
+
|
| 60 |
+
<div class="search-input-area">
|
| 61 |
+
<input type="text" id="userInput" placeholder="اكتب موضوع البحث هنا..." />
|
| 62 |
+
<button id="sendBtn" style="background:var(--accent); border:none; color:white; padding:10px 20px; border-radius:8px; cursor:pointer;">
|
| 63 |
+
<i class="fas fa-paper-plane"></i>
|
| 64 |
+
</button>
|
| 65 |
+
</div>
|
| 66 |
+
</section>
|
| 67 |
+
|
| 68 |
+
<!-- قسم عرض الوثائق المستخرجة -->
|
| 69 |
+
<section class="results-section" id="resultsSection">
|
| 70 |
+
<h3><i class="fas fa-file-invoice"></i> الوثائق والنتائج المبدئية</h3>
|
| 71 |
+
<p style="color:#64748b; font-size:14px;">بناءً على حوارك مع الذكاء الاصطناعي، ستظهر هنا أدق الوثائق من NASA و ASJP وغيرها.</p>
|
| 72 |
+
<div id="docsList">
|
| 73 |
+
<!-- ستظهر النتائج هنا -->
|
| 74 |
+
</div>
|
| 75 |
+
</section>
|
| 76 |
+
|
| 77 |
+
</div>
|
| 78 |
+
|
| 79 |
+
<script type="module">
|
| 80 |
+
import { Ollama } from "https://esm.sh/ollama/browser";
|
| 81 |
+
const ollama = new Ollama();
|
| 82 |
+
|
| 83 |
+
const chatBox = document.getElementById('chatBox');
|
| 84 |
+
const thinkingBlock = document.getElementById('currentThinking');
|
| 85 |
+
const userInput = document.getElementById('userInput');
|
| 86 |
+
const sendBtn = document.getElementById('sendBtn');
|
| 87 |
+
const docsList = document.getElementById('docsList');
|
| 88 |
+
|
| 89 |
+
sendBtn.onclick = async () => {
|
| 90 |
+
const text = userInput.value;
|
| 91 |
+
if (!text) return;
|
| 92 |
+
|
| 93 |
+
// إضافة رسالة المستخدم للواجهة
|
| 94 |
+
chatBox.innerHTML += `<div class="message user" style="color:var(--accent)"><strong>أنت:</strong> ${text}</div>`;
|
| 95 |
+
userInput.value = '';
|
| 96 |
+
|
| 97 |
+
try {
|
| 98 |
+
const stream = await ollama.chat({
|
| 99 |
+
model: 'deepseek-v4-flash', // أو deepseek-v4-flash حسب المتاح في حسابك
|
| 100 |
+
messages: [{ role: 'user', content: text }],
|
| 101 |
+
stream: true,
|
| 102 |
+
});
|
| 103 |
+
|
| 104 |
+
thinkingBlock.style.display = 'block';
|
| 105 |
+
thinkingBlock.innerText = '';
|
| 106 |
+
let content = '';
|
| 107 |
+
|
| 108 |
+
for await (const chunk of stream) {
|
| 109 |
+
if (chunk.message.thinking) {
|
| 110 |
+
thinkingBlock.innerText += chunk.message.thinking;
|
| 111 |
+
} else if (chunk.message.content) {
|
| 112 |
+
thinkingBlock.style.display = 'none'; // إخفاء التفكير عند بدء الرد
|
| 113 |
+
content += chunk.message.content;
|
| 114 |
+
// تحديث الرد في الواجهة
|
| 115 |
+
updateAIChat(content);
|
| 116 |
+
}
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
// بعد انتهاء الحوار، نقوم بعمل webSearch آلي بناءً على ما فهمه الموديل
|
| 120 |
+
triggerAutomaticSearch(text);
|
| 121 |
+
|
| 122 |
+
} catch (error) {
|
| 123 |
+
console.error("Error:", error);
|
| 124 |
+
}
|
| 125 |
+
};
|
| 126 |
+
|
| 127 |
+
function updateAIChat(content) {
|
| 128 |
+
let lastMsg = chatBox.lastElementChild;
|
| 129 |
+
if (lastMsg.classList.contains('ai-reply')) {
|
| 130 |
+
lastMsg.innerText = content;
|
| 131 |
+
} else {
|
| 132 |
+
const div = document.createElement('div');
|
| 133 |
+
div.className = 'message ai-reply';
|
| 134 |
+
div.innerText = content;
|
| 135 |
+
chatBox.appendChild(div);
|
| 136 |
+
}
|
| 137 |
+
chatBox.scrollTop = chatBox.scrollHeight;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
async function triggerAutomaticSearch(query) {
|
| 141 |
+
docsList.innerHTML = '<p><i class="fas fa-spinner fa-spin"></i> جاري استخراج الوثائق الأكثر صلة...</p>';
|
| 142 |
+
try {
|
| 143 |
+
const searchData = await ollama.webSearch(query);
|
| 144 |
+
docsList.innerHTML = ''; // تنظيف التحميل
|
| 145 |
+
|
| 146 |
+
searchData.results.forEach(doc => {
|
| 147 |
+
docsList.innerHTML += `
|
| 148 |
+
<div class="doc-card">
|
| 149 |
+
<span class="badge">وثيقة علمية</span>
|
| 150 |
+
<h4 style="margin:10px 0;"><a href="${doc.url}" target="_blank" style="color:white; text-decoration:none;">${doc.title}</a></h4>
|
| 151 |
+
<p style="font-size:13px; color:#94a3b8;">${doc.content}</p>
|
| 152 |
+
</div>
|
| 153 |
+
`;
|
| 154 |
+
});
|
| 155 |
+
} catch (e) {
|
| 156 |
+
docsList.innerHTML = '<p>تعذر جلب الوثائق حالياً، حاول مرة أخرى.</p>';
|
| 157 |
+
}
|
| 158 |
+
}
|
| 159 |
+
</script>
|
| 160 |
+
|
| 161 |
+
</body>
|
| 162 |
+
</html>
|