Base WEB UI Funtion

This commit is contained in:
2026-05-12 19:20:46 +03:00
parent e9a843bdc8
commit 47a704e152
4 changed files with 73 additions and 20 deletions
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
body {
background: #111;
color: white;
font-family: Arial;
}
#chat-container {
width: 800px;
margin: auto;
margin-top: 40px;
}
#messages {
height: 500px;
border: 1px solid #333;
overflow-y: scroll;
padding: 10px;
}
#input-area {
display: flex;
margin-top: 10px;
}
+27
View File
@@ -0,0 +1,27 @@
const sendBtn = document.getElementById("send-btn");
sendBtn.addEventListener("click", async () => {
const input = document.getElementById("user-input");
const text = input.value;
const messages = document.getElementById("messages");
messages.innerHTML += `<p><b>You:</b> ${text}</p>`;
const response = await fetch("/chat", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
message: text
})
});
const data = await response.json();
messages.innerHTML += `<p><b>AI:</b> ${data.response}</p>`;
input.value = "";
});
+23 -20
View File
@@ -1,22 +1,25 @@
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]> <html class="no-js"> <!--<![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Главная страница</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
</head>
<body>
<!--[if lt IE 7]>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="#">upgrade your browser</a> to improve your experience.</p>
<![endif]-->
<script src="" async defer></script>
</body>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LAIC</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<div id="chat-container">
<div id="messages"></div>
<div id="input-area">
<input type="text" id="user-input">
<button id="send-btn">Send</button>
</div>
</div>
<script src="/static/js/chat.js"></script>
</body>
</html>