From 47a704e15293843209ec520e66aa2caf0685b340 Mon Sep 17 00:00:00 2001 From: Gloomer Date: Tue, 12 May 2026 19:20:46 +0300 Subject: [PATCH] Base WEB UI Funtion --- .../flaskui/__pycache__/flask.cpython-310.pyc | Bin 524 -> 524 bytes core/flaskui/static/css/style.css | 23 ++++++++++ core/flaskui/static/js/chat.js | 27 +++++++++++ core/flaskui/templates/index.html | 43 ++++++++++-------- 4 files changed, 73 insertions(+), 20 deletions(-) create mode 100644 core/flaskui/static/css/style.css create mode 100644 core/flaskui/static/js/chat.js diff --git a/core/flaskui/__pycache__/flask.cpython-310.pyc b/core/flaskui/__pycache__/flask.cpython-310.pyc index 1372f4753ee15f5b676b2466393a6f88ca6e307d..2437825185c27e092e36babb3a03078af2ea39d1 100644 GIT binary patch delta 20 ZcmeBS>0#l?=jG*M0D^=d=B$N0OaLat1C9Uy delta 20 acmeBS>0#l?=jG*M0D^?SKQkBdFaZEBkOeLP diff --git a/core/flaskui/static/css/style.css b/core/flaskui/static/css/style.css new file mode 100644 index 0000000..7f6242e --- /dev/null +++ b/core/flaskui/static/css/style.css @@ -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; +} \ No newline at end of file diff --git a/core/flaskui/static/js/chat.js b/core/flaskui/static/js/chat.js new file mode 100644 index 0000000..244b762 --- /dev/null +++ b/core/flaskui/static/js/chat.js @@ -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 += `

You: ${text}

`; + + const response = await fetch("/chat", { + method: "POST", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify({ + message: text + }) + }); + + const data = await response.json(); + + messages.innerHTML += `

AI: ${data.response}

`; + + input.value = ""; +}); \ No newline at end of file diff --git a/core/flaskui/templates/index.html b/core/flaskui/templates/index.html index 6d93ea5..d62b2f0 100644 --- a/core/flaskui/templates/index.html +++ b/core/flaskui/templates/index.html @@ -1,22 +1,25 @@ - - - - - - - - - Главная страница - - - - - - - - - + + + + LAIC + + + + + +
+ +
+ +
+ + +
+ +
+ + + + \ No newline at end of file