Spaces:
Running
Running
Okay, here are the factors of 222: 1, 2, 3, 6, 37, 74, 111, 222 The prime factorization of 222 is: 222 = 2 * 3 * 37 So the prime factors of 222 are 2, 3, and 37. сделай без звездочек и тому подобное просто красивые и четкие ответы и рядом с тремя точками печатает и сделай чтобы все было на русском
Browse files- index.html +25 -22
index.html
CHANGED
|
@@ -229,13 +229,13 @@
|
|
| 229 |
</div>
|
| 230 |
<button class="new-chat-btn">
|
| 231 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
| 232 |
-
<span>
|
| 233 |
-
|
| 234 |
</div>
|
| 235 |
<div class="sidebar-footer">
|
| 236 |
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>
|
| 237 |
-
<span style="font-size: 14px;">
|
| 238 |
-
|
| 239 |
</aside>
|
| 240 |
|
| 241 |
<main class="main-content">
|
|
@@ -250,15 +250,15 @@
|
|
| 250 |
<linearGradient id="gradient4" x1="2" y1="12" x2="22" y2="22" gradientUnits="userSpaceOnUse"><stop stop-color="#3d8fee" /><stop offset="1" stop-color="#4a9eff" /></linearGradient>
|
| 251 |
</defs>
|
| 252 |
</svg>
|
| 253 |
-
|
| 254 |
-
|
| 255 |
</div>
|
| 256 |
</div>
|
| 257 |
|
| 258 |
<div class="chat-input-area">
|
| 259 |
<div class="input-wrapper">
|
| 260 |
-
<textarea class="chat-input" id="chat-input" placeholder="
|
| 261 |
-
|
| 262 |
<button class="icon-btn send-btn" id="send-btn">
|
| 263 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 264 |
<line x1="12" y1="19" x2="12" y2="5"></line>
|
|
@@ -276,14 +276,12 @@
|
|
| 276 |
// ⚠️ ВАЖНО: Не публикуйте этот ключ в открытом доступе!
|
| 277 |
const apiKey = "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";
|
| 278 |
const apiUrl = "https://openrouter.ai/api/v1/chat/completions";
|
| 279 |
-
const model = "
|
| 280 |
-
|
| 281 |
-
// --- Элементы страницы ---
|
| 282 |
const chatInput = document.getElementById('chat-input');
|
| 283 |
const sendBtn = document.getElementById('send-btn');
|
| 284 |
const chatHistory = document.getElementById('chat-history');
|
| 285 |
const welcomeSection = document.getElementById('welcome-section');
|
| 286 |
-
|
| 287 |
// --- Функция отправки сообщения ---
|
| 288 |
const sendMessage = async () => {
|
| 289 |
const messageText = chatInput.value.trim();
|
|
@@ -309,8 +307,8 @@
|
|
| 309 |
headers: {
|
| 310 |
'Content-Type': 'application/json',
|
| 311 |
'Authorization': `Bearer ${apiKey}`,
|
| 312 |
-
'HTTP-Referer': 'http://localhost',
|
| 313 |
-
'X-Title': 'DeepSeek Chat',
|
| 314 |
},
|
| 315 |
body: JSON.stringify({
|
| 316 |
model: model,
|
|
@@ -325,31 +323,36 @@
|
|
| 325 |
const data = await response.json();
|
| 326 |
const aiResponse = data.choices[0].message.content;
|
| 327 |
|
| 328 |
-
// 5. Отобразить ответ ИИ
|
| 329 |
appendMessage(aiResponse, 'ai-message');
|
| 330 |
|
| 331 |
} catch (error) {
|
| 332 |
console.error("Error fetching AI response:", error);
|
| 333 |
-
appendMessage(`
|
| 334 |
} finally {
|
| 335 |
// 6. Убрать индикатор "ИИ печатает..."
|
| 336 |
typingIndicator.remove();
|
| 337 |
}
|
| 338 |
};
|
| 339 |
-
|
| 340 |
-
// --- Вспомогательные функции ---
|
| 341 |
-
|
| 342 |
// Добавляет сообщение в историю чата
|
| 343 |
function appendMessage(text, className) {
|
| 344 |
const messageElement = document.createElement('div');
|
| 345 |
messageElement.classList.add('message', className);
|
| 346 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
chatHistory.appendChild(messageElement);
|
| 348 |
// Прокрутка вниз к последнему сообщению
|
| 349 |
chatHistory.scrollTop = chatHistory.scrollHeight;
|
| 350 |
}
|
| 351 |
-
|
| 352 |
-
// Показывает индикатор печати
|
| 353 |
function showTypingIndicator() {
|
| 354 |
const indicator = document.createElement('div');
|
| 355 |
indicator.classList.add('typing-indicator');
|
|
|
|
| 229 |
</div>
|
| 230 |
<button class="new-chat-btn">
|
| 231 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"></line><line x1="5" y1="12" x2="19" y2="12"></line></svg>
|
| 232 |
+
<span>Новый чат</span>
|
| 233 |
+
</button>
|
| 234 |
</div>
|
| 235 |
<div class="sidebar-footer">
|
| 236 |
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>
|
| 237 |
+
<span style="font-size: 14px;">История чатов отсутствует</span>
|
| 238 |
+
</div>
|
| 239 |
</aside>
|
| 240 |
|
| 241 |
<main class="main-content">
|
|
|
|
| 250 |
<linearGradient id="gradient4" x1="2" y1="12" x2="22" y2="22" gradientUnits="userSpaceOnUse"><stop stop-color="#3d8fee" /><stop offset="1" stop-color="#4a9eff" /></linearGradient>
|
| 251 |
</defs>
|
| 252 |
</svg>
|
| 253 |
+
<h1>Чем могу вам помочь?</h1>
|
| 254 |
+
</div>
|
| 255 |
</div>
|
| 256 |
</div>
|
| 257 |
|
| 258 |
<div class="chat-input-area">
|
| 259 |
<div class="input-wrapper">
|
| 260 |
+
<textarea class="chat-input" id="chat-input" placeholder="Напишите сообщение DeepSeek..." rows="1"></textarea>
|
| 261 |
+
<div class="input-actions">
|
| 262 |
<button class="icon-btn send-btn" id="send-btn">
|
| 263 |
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
| 264 |
<line x1="12" y1="19" x2="12" y2="5"></line>
|
|
|
|
| 276 |
// ⚠️ ВАЖНО: Не публикуйте этот ключ в открытом доступе!
|
| 277 |
const apiKey = "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";
|
| 278 |
const apiUrl = "https://openrouter.ai/api/v1/chat/completions";
|
| 279 |
+
const model = "deepseek/deepseek-chat"; // Используем DeepSeek для русского языка
|
| 280 |
+
// --- Элементы страницы ---
|
|
|
|
| 281 |
const chatInput = document.getElementById('chat-input');
|
| 282 |
const sendBtn = document.getElementById('send-btn');
|
| 283 |
const chatHistory = document.getElementById('chat-history');
|
| 284 |
const welcomeSection = document.getElementById('welcome-section');
|
|
|
|
| 285 |
// --- Функция отправки сообщения ---
|
| 286 |
const sendMessage = async () => {
|
| 287 |
const messageText = chatInput.value.trim();
|
|
|
|
| 307 |
headers: {
|
| 308 |
'Content-Type': 'application/json',
|
| 309 |
'Authorization': `Bearer ${apiKey}`,
|
| 310 |
+
'HTTP-Referer': 'http://localhost',
|
| 311 |
+
'X-Title': 'DeepSeek Chat',
|
| 312 |
},
|
| 313 |
body: JSON.stringify({
|
| 314 |
model: model,
|
|
|
|
| 323 |
const data = await response.json();
|
| 324 |
const aiResponse = data.choices[0].message.content;
|
| 325 |
|
| 326 |
+
// 5. Отобразить ответ ИИ красиво и четко
|
| 327 |
appendMessage(aiResponse, 'ai-message');
|
| 328 |
|
| 329 |
} catch (error) {
|
| 330 |
console.error("Error fetching AI response:", error);
|
| 331 |
+
appendMessage(`Извините, произошла ошибка: ${error.message}`, 'ai-message');
|
| 332 |
} finally {
|
| 333 |
// 6. Убрать индикатор "ИИ печатает..."
|
| 334 |
typingIndicator.remove();
|
| 335 |
}
|
| 336 |
};
|
| 337 |
+
// --- Вспомогательные функции ---
|
|
|
|
|
|
|
| 338 |
// Добавляет сообщение в историю чата
|
| 339 |
function appendMessage(text, className) {
|
| 340 |
const messageElement = document.createElement('div');
|
| 341 |
messageElement.classList.add('message', className);
|
| 342 |
+
|
| 343 |
+
// Обработка текста для красивого отображения
|
| 344 |
+
const formattedText = text
|
| 345 |
+
.replace(/\*/g, '') // Убираем звездочки
|
| 346 |
+
.replace(/•/g, '') // Убираем точки
|
| 347 |
+
.replace(/^[^а-яё]*/i, '') // Убираем английский текст в начале
|
| 348 |
+
.trim();
|
| 349 |
+
|
| 350 |
+
messageElement.textContent = formattedText;
|
| 351 |
chatHistory.appendChild(messageElement);
|
| 352 |
// Прокрутка вниз к последнему сообщению
|
| 353 |
chatHistory.scrollTop = chatHistory.scrollHeight;
|
| 354 |
}
|
| 355 |
+
// Показывает индикатор печати
|
|
|
|
| 356 |
function showTypingIndicator() {
|
| 357 |
const indicator = document.createElement('div');
|
| 358 |
indicator.classList.add('typing-indicator');
|