mirror of
https://github.com/cloudstack-llc/mlx-knife.git
synced 2026-07-16 10:44:29 -04:00
de7ccf9018
Testing: - pytest defaults to tests_2.0 via pytest.ini - README/TESTING updated; Quick Start uses `pip install -e . && pip install pytest` Safety: - Add test-cache sentinel + centralized checks - Strict delete guard via MLXK2_STRICT_TEST_DELETE=1 - Hide sentinel from 2.0 list output Portability: - Remove site-specific paths; generic test/user cache detection (mlxk2_test_ prefix + sentinel) Docs: - Environment & Caches, HF cache integrity - Local-only hooks/excludes and local test script (excluded from VCS)
77 lines
2.4 KiB
HTML
77 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Lokale Chatbox</title>
|
|
<style>
|
|
/* Einfache CSS für die Chatbox */
|
|
#chatbox {
|
|
width: 300px;
|
|
height: 400px;
|
|
border: 1px solid #ccc;
|
|
overflow-y: scroll;
|
|
margin-bottom: 10px;
|
|
padding: 10px;
|
|
}
|
|
#user-input {
|
|
width: 240px;
|
|
margin-right: 10px;
|
|
}
|
|
.message {
|
|
margin: 5px 0;
|
|
}
|
|
.user {
|
|
color: blue;
|
|
}
|
|
.server {
|
|
color: green;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="chatbox"></div>
|
|
<input type="text" id="user-input" placeholder="Nachricht eingeben"/>
|
|
<button onclick="sendMessage()">Senden</button>
|
|
|
|
<script>
|
|
function sendMessage() {
|
|
const userInput = document.getElementById('user-input').value.trim();
|
|
if (!userInput) return;
|
|
|
|
// Zeige die Benutzernachricht in der Chatbox
|
|
displayMessage('Du', userInput, 'user');
|
|
|
|
// Sende die Nachricht an den Server
|
|
fetch('http://localhost:8000/chat', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ message: userInput })
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
displayMessage('Server', data.response, 'server');
|
|
})
|
|
.catch(error => {
|
|
console.error('Fehler:', error);
|
|
displayMessage('Fehler', 'Keine Verbindung zum Server möglich.', 'server');
|
|
});
|
|
|
|
// Leere das Eingabefeld
|
|
document.getElementById('user-input').value = '';
|
|
}
|
|
|
|
function displayMessage(sender, message, className) {
|
|
const chatbox = document.getElementById('chatbox');
|
|
const messageElement = document.createElement('div');
|
|
messageElement.classList.add('message', className);
|
|
messageElement.textContent = `${sender}: ${message}`;
|
|
chatbox.appendChild(messageElement);
|
|
chatbox.scrollTop = chatbox.scrollHeight; // Scrollt die Chatbox nach unten
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|