Spaces:
Running
Running
Upload 3 files
Browse files- index.html +27 -19
- script.js +46 -0
- style.css +93 -28
index.html
CHANGED
|
@@ -1,19 +1,27 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="tr">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ZenkaMind — Yapay Zekâ Asistanı</title>
|
| 7 |
+
<link rel="stylesheet" href="style.css">
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div class="container">
|
| 11 |
+
<h1>🧠 ZenkaMind v10</h1>
|
| 12 |
+
<p class="subtitle">Türkçe yapay zekâ sohbet asistanı — <strong>Mixtral 8x7B</strong> modelini kullanır</p>
|
| 13 |
+
|
| 14 |
+
<div class="chat-box" id="chat-box">
|
| 15 |
+
<div class="message bot">Merhaba 👋 Ben ZenkaMind! Size nasıl yardımcı olabilirim?</div>
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
<div class="input-area">
|
| 19 |
+
<input type="text" id="user-input" placeholder="Bir şey yazın..." autocomplete="off">
|
| 20 |
+
<button id="send-btn">Gönder</button>
|
| 21 |
+
</div>
|
| 22 |
+
</div>
|
| 23 |
+
|
| 24 |
+
<footer>© 2025 Zenkamind Bilişim & Teknoloji</footer>
|
| 25 |
+
<script src="script.js"></script>
|
| 26 |
+
</body>
|
| 27 |
+
</html>
|
script.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
const HF_API_URL = httpsapi-inference.huggingface.comodelsmistralaiMixtral-8x7B-Instruct-v0.1;
|
| 2 |
+
|
| 3 |
+
async function sendMessage() {
|
| 4 |
+
const input = document.getElementById(user-input);
|
| 5 |
+
const chatBox = document.getElementById(chat-box);
|
| 6 |
+
const userMessage = input.value.trim();
|
| 7 |
+
if (!userMessage) return;
|
| 8 |
+
|
| 9 |
+
chatBox.innerHTML += `div class=message user${userMessage}div`;
|
| 10 |
+
input.value = ;
|
| 11 |
+
|
| 12 |
+
const loading = document.createElement(div);
|
| 13 |
+
loading.className = message bot;
|
| 14 |
+
loading.textContent = ⏳ Yanıt yazılıyor...;
|
| 15 |
+
chatBox.appendChild(loading);
|
| 16 |
+
chatBox.scrollTop = chatBox.scrollHeight;
|
| 17 |
+
|
| 18 |
+
try {
|
| 19 |
+
const response = await fetch(HF_API_URL, {
|
| 20 |
+
method POST,
|
| 21 |
+
headers {
|
| 22 |
+
Authorization `Bearer ${HF_TOKEN}`, Secret token Hugging Face'ten çekiliyor
|
| 23 |
+
Content-Type applicationjson
|
| 24 |
+
},
|
| 25 |
+
body JSON.stringify({
|
| 26 |
+
inputs userMessage
|
| 27 |
+
})
|
| 28 |
+
});
|
| 29 |
+
|
| 30 |
+
const data = await response.json();
|
| 31 |
+
chatBox.removeChild(loading);
|
| 32 |
+
|
| 33 |
+
const reply = data.[0].generated_text ⚠️ Modelden yanıt alınamadı.;
|
| 34 |
+
chatBox.innerHTML += `div class=message bot${reply}div`;
|
| 35 |
+
} catch (err) {
|
| 36 |
+
chatBox.removeChild(loading);
|
| 37 |
+
chatBox.innerHTML += `div class=message bot❌ Hata ${err.message}div`;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
chatBox.scrollTop = chatBox.scrollHeight;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
document.getElementById(send-btn).addEventListener(click, sendMessage);
|
| 44 |
+
document.getElementById(user-input).addEventListener(keypress, (e) = {
|
| 45 |
+
if (e.key === Enter) sendMessage();
|
| 46 |
+
});
|
style.css
CHANGED
|
@@ -1,28 +1,93 @@
|
|
| 1 |
-
body {
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
body {
|
| 2 |
+
background-color: #0d1117;
|
| 3 |
+
color: #e6edf3;
|
| 4 |
+
font-family: "Segoe UI", sans-serif;
|
| 5 |
+
display: flex;
|
| 6 |
+
flex-direction: column;
|
| 7 |
+
align-items: center;
|
| 8 |
+
justify-content: center;
|
| 9 |
+
height: 100vh;
|
| 10 |
+
margin: 0;
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
.container {
|
| 14 |
+
width: 90%;
|
| 15 |
+
max-width: 700px;
|
| 16 |
+
background-color: #161b22;
|
| 17 |
+
padding: 20px;
|
| 18 |
+
border-radius: 12px;
|
| 19 |
+
box-shadow: 0 0 15px rgba(0,0,0,0.5);
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
h1 {
|
| 23 |
+
text-align: center;
|
| 24 |
+
color: #00b4d8;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
.subtitle {
|
| 28 |
+
text-align: center;
|
| 29 |
+
color: #8b949e;
|
| 30 |
+
margin-bottom: 20px;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.chat-box {
|
| 34 |
+
height: 400px;
|
| 35 |
+
overflow-y: auto;
|
| 36 |
+
background-color: #0d1117;
|
| 37 |
+
border-radius: 10px;
|
| 38 |
+
padding: 15px;
|
| 39 |
+
border: 1px solid #30363d;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
.message {
|
| 43 |
+
margin: 10px 0;
|
| 44 |
+
padding: 10px;
|
| 45 |
+
border-radius: 10px;
|
| 46 |
+
line-height: 1.4;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.bot {
|
| 50 |
+
background-color: #21262d;
|
| 51 |
+
color: #58a6ff;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.user {
|
| 55 |
+
background-color: #238636;
|
| 56 |
+
color: #fff;
|
| 57 |
+
text-align: right;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
.input-area {
|
| 61 |
+
display: flex;
|
| 62 |
+
margin-top: 15px;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
#user-input {
|
| 66 |
+
flex: 1;
|
| 67 |
+
padding: 10px;
|
| 68 |
+
border: none;
|
| 69 |
+
border-radius: 10px;
|
| 70 |
+
background: #21262d;
|
| 71 |
+
color: #fff;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
#send-btn {
|
| 75 |
+
background: #00b4d8;
|
| 76 |
+
color: #fff;
|
| 77 |
+
border: none;
|
| 78 |
+
border-radius: 10px;
|
| 79 |
+
padding: 10px 20px;
|
| 80 |
+
margin-left: 10px;
|
| 81 |
+
cursor: pointer;
|
| 82 |
+
transition: 0.3s;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
#send-btn:hover {
|
| 86 |
+
background: #0096c7;
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
footer {
|
| 90 |
+
margin-top: 10px;
|
| 91 |
+
color: #8b949e;
|
| 92 |
+
font-size: 0.9em;
|
| 93 |
+
}
|