aboutsummaryrefslogtreecommitdiff
path: root/internal/textgeneration/deno_test.js
blob: e884a711a4de1eb289ab4d91d4c4bf16f286153e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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");