From 54a2236b6c880909ef14dfdb22aaaeef9b4e73c8 Mon Sep 17 00:00:00 2001 From: killian <63927363+KillianLucas@users.noreply.github.com> Date: Sat, 27 Jan 2024 23:36:59 -0800 Subject: [PATCH] Queue, Conversations --- OS/01/app/index.html | 23 ++-- .../__pycache__/main.cpython-310.pyc | Bin 0 -> 2351 bytes .../__pycache__/main.cpython-311.pyc | Bin 3434 -> 4728 bytes .../core/interpreter/conversations/user.json | 1 + OS/01/core/interpreter/main.py | 113 ++++++++++-------- OS/01/core/interpreter/queue/timestamp.json | 5 - OS/01/core/interpreter/start.py | 3 +- OS/01/core/poetry.lock | 6 +- OS/01/core/pyproject.toml | 2 +- 9 files changed, 88 insertions(+), 65 deletions(-) create mode 100644 OS/01/core/interpreter/__pycache__/main.cpython-310.pyc delete mode 100644 OS/01/core/interpreter/queue/timestamp.json diff --git a/OS/01/app/index.html b/OS/01/app/index.html index b1b6266..65acffb 100644 --- a/OS/01/app/index.html +++ b/OS/01/app/index.html @@ -17,6 +17,21 @@ ws = new WebSocket("ws://localhost:8000/"); ws.onopen = function(event) { console.log("Connected to WebSocket server."); + + ws.onmessage = function (event) { + if (lastMessageElement == null) { + lastMessageElement = document.createElement('p'); + document.getElementById('messages').appendChild(lastMessageElement); + } + var data = JSON.parse(event.data); + if (data.hasOwnProperty('content')) { + if (data.type == 'code') { + lastMessageElement.innerHTML += '
' + data.content + '
'; + } else { + lastMessageElement.innerHTML += data.content; + } + } + }; }; ws.onerror = function(error) { console.log("WebSocket error: ", error); @@ -28,13 +43,7 @@ } connectWebSocket(); var lastMessageElement = null; - ws.onmessage = function (event) { - if (lastMessageElement == null) { - lastMessageElement = document.createElement('p'); - document.getElementById('messages').appendChild(lastMessageElement); - } - lastMessageElement.innerHTML += event.data; - }; + function sendMessage(event) { event.preventDefault(); var input = document.getElementById("messageInput"); diff --git a/OS/01/core/interpreter/__pycache__/main.cpython-310.pyc b/OS/01/core/interpreter/__pycache__/main.cpython-310.pyc new file mode 100644 index 0000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_|D7qe{;3F4FUGW+^X?8|GiIW+5*b?cboyr*gy3*5&Ky zvp4o#u-LN}AK4*{9l#JTJ+gK0$X1wp7W_StyAyomG5A?wl_z87=k5-Y-|Gd?wP?=W z{(QUAtad&em4}0%$0ZM4-Aj~G8$bPMp5HDPRB16-fm(2F36ziKU+9oB zk#WOIYM5%v0|nJdpBE*Say|f|Wdb4#-RA?*nTxDJHW&5|^< zWBrw;28;4=CjqX`3P%nzAih^%GIRhl`KtNR*8j_G|J=)rZLqiE2c5rAq^YYFxv>(nA!7YsK**%^?Mil af(=uC$y^P}M2#ZP14N#@#PdB`^Zo;>c`ua! literal 0 HcmV?d00001 diff --git a/OS/01/core/interpreter/__pycache__/main.cpython-311.pyc b/OS/01/core/interpreter/__pycache__/main.cpython-311.pyc index 87bfb0a3871ab7b4e00c005128ccc75852542484..bd87b157939be24af95199a7d09729c27902adbf 100644 GIT binary patch literal 4728 zcmbUlZEO?g`Mocn?byzjW9Ng9BZQ=$)XR&|Rah2%>TPw6$r=+W^&P*Qao ze{@>(Ykn2)mE*ViLNp|WHP!ba1fth>_IT}kV%Ol{+0&0_$XiW&by)1Zrb;Gzc`*auAnK*7{7pqiTb zJ~YZT6We^bh8P-VY866LrtZZM=oqw$+6ca+s*YiusIFy(wot<_c9+Vd%o2T3kgcIO zI&qn&6f5woVBG{Ih=w9yh}ME_E8ql?iuvO>1Ht=j zJg-oHre9_66R)xYw9R5l>+gVCLAEkaQdM54)PI!9tK44aiR#kY$|J-GEJY3TlP{X7 z3!oQt0Xt51AcY~&1QN&#Ao*g?3Kv|Mu8o*eS4TnB&Oga10 z&VCS+t?M7|b#L49Ov1hN-tv2kC$Xh=83Y4hOYOpzT7oN5i?zI^R`z;a>s_qfSa)py zm6qOlFj?~oj9|cT6hNl7e$j>>tX>T;iP{a!zF#+p(DkN+)Ta)p{E0rq{*{8t--tu( zeHtncQ1f6L^`MmiSZ3GQOJhrY_8R~nR#^63z+qRGEAvE*NDzfq>9;Z>iKJ#q7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