aboutsummaryrefslogtreecommitdiff
path: root/internal/textgeneration/deno_test.js
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2023-03-18 15:56:50 -0400
committerXe Iaso <me@xeiaso.net>2023-03-18 15:57:01 -0400
commite02edb4eb42ba2c1c397a802c60564436635035d (patch)
tree6e2d1e578d21add918347c90bb688b4b23490e8e /internal/textgeneration/deno_test.js
parentd920c709b6cd878547fb9d165d53ad2a54d43a5f (diff)
downloadx-e02edb4eb42ba2c1c397a802c60564436635035d.tar.xz
x-e02edb4eb42ba2c1c397a802c60564436635035d.zip
test
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'internal/textgeneration/deno_test.js')
-rw-r--r--internal/textgeneration/deno_test.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/internal/textgeneration/deno_test.js b/internal/textgeneration/deno_test.js
new file mode 100644
index 0000000..e884a71
--- /dev/null
+++ b/internal/textgeneration/deno_test.js
@@ -0,0 +1,65 @@
+const ws = new WebSocket("ws://ontos:7860/queue/join");
+
+const hash = crypto.randomUUID();
+
+ws.onmessage = (ev) => {
+ const data = JSON.parse(ev.data);
+ console.log(data);
+
+ if (data.msg == "send_hash") {
+ console.log("sending hash");
+ ws.send(JSON.stringify({session_hash: hash, fn_index: 40}));
+ }
+ if (data.msg == "process_starts") {
+ console.log("generation has started");
+ }
+ if (data.msg == "send_data") {
+ ws.send(JSON.stringify({
+ fn_index: 33,
+ data: [
+ "Midori_Yasomi",
+ "Xe",
+ "Midori",
+ ],
+ session_hash: hash,
+ }));
+ ws.send(JSON.stringify({
+ data: [
+ "So, what's the deal with airline food?",
+ 200,
+ true,
+ 0.7,
+ 0.5,
+ 0.19,
+ 1.1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ false,
+ "Xe",
+ "Midori Yasomi",
+ "Midori Yasomi is a young, computer engineer-nerd with a knack for problem solving and a passion for technology.\n\\u003cSTART\\u003e\n{{user}}: So how did you get into computer engineering?\n{{char}}: I've always been into technology, but I didn't really get into programming until my high school robotics club.\n{{user}}: I see, that's neat.\n{{char}}: Yeah, robotics club was really fun.\n{{user}}: So what do you do when you're not working on computers?\n{{char}}: I play a lot of rhythm games and like to write fiction.\n{{user}}: What's your favorite type of computer hardware to work with?\n{{char}}: GPUs. They power my favorite experiences and my brain as a whole.\n{{user}}: That sounds great!\n{{char}}: Yeah, it's really fun. I'm lucky to be able to do this as a job.\n\n",
+ false,
+ 0,
+ 0
+ ],
+ fn_index: 9,
+ session_hash: hash,
+ }));
+ ws.send(JSON.stringify({
+ fn_index: 24,
+ data: ["So, what's the deal with airline food?"],
+ session_hash: hash,
+ }));
+ }
+ if (data.msg == "process_completed" || data.msg == "process_generating") {
+ data.output.data.forEach((row) => {
+ console.log(row);
+ });
+ }
+}
+
+console.log("done");