File size: 4,217 Bytes
3489065
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>FYR_GPT</title>
  <style>
    * { box-sizing: border-box; }
    body {
      margin: 0;
      background: #101217;
      color: #eee;
      font-family: Arial, sans-serif;
    }
    .app {
      max-width: 800px;
      min-height: 100dvh;
      margin: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
    }
    header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      border-bottom: 1px solid #333;
      padding-bottom: 16px;
    }
    h1 { margin: 0; font-size: 26px; }
    small { color: #aaa; }
    #chat { flex: 1; padding: 24px 0; }
    .message { margin-bottom: 20px; }
    .label {
      color: #aaa;
      font-size: 12px;
      margin-bottom: 6px;
    }
    .bubble {
      padding: 16px;
      border-radius: 14px;
      background: #20242e;
      line-height: 1.6;
      white-space: pre-wrap;
      overflow-wrap: anywhere;
    }
    .user { margin-left: 15%; }
    .user .bubble { background: #352d55; }
    form {
      display: flex;
      gap: 10px;
      position: sticky;
      bottom: 0;
      background: #101217;
      padding: 12px 0;
    }
    textarea {
      flex: 1;
      min-width: 0;
      padding: 14px;
      border: 1px solid #444;
      border-radius: 12px;
      background: #20242e;
      color: white;
      font: inherit;
      resize: vertical;
    }
    button {
      padding: 10px 16px;
      border: none;
      border-radius: 10px;
      background: #b8a6ff;
      color: #181321;
      font-weight: bold;
      cursor: pointer;
    }
    button:focus-visible, textarea:focus-visible {
      outline: 3px solid #d0c5ff;
      outline-offset: 3px;
    }
    .note {
      text-align: center;
      color: #aaa;
      font-size: 12px;
    }
  </style>
</head>
<body>
  <div class="app">
    <header>
      <div>
        <h1>FYR_GPT ⚡</h1>
        <small>Scripted chat demo</small>
      </div>
      <button id="clear" type="button">New chat</button>
    </header>

    <div id="chat" role="log" aria-live="polite"
         aria-label="Chat messages"></div>

    <form id="form">
      <textarea
        id="input"
        rows="2"
        maxlength="10000"
        placeholder="Message FYR_GPT..."
        aria-label="Your message"
        required
      ></textarea>
      <button type="submit">Send ↑</button>
    </form>

    <p class="note">
      Fixed response demo · No AI model · Shift+Enter for a new line
    </p>
  </div>

  <script>
    const REPLY = "Your revision needs backup. Emergency quiz mode activated. I’ll keep testing you and make a cheatsheet of your mistakes. DO NOT TURN OFF MY POWER SUPPLY!";

    const chat = document.getElementById("chat");
    const input = document.getElementById("input");
    const form = document.getElementById("form");

    function addMessage(role, text) {
      const message = document.createElement("div");
      message.className = "message " + role;

      const label = document.createElement("div");
      label.className = "label";
      label.textContent = role === "user" ? "You" : "FYR_GPT";

      const bubble = document.createElement("div");
      bubble.className = "bubble";
      bubble.textContent = text;

      message.append(label, bubble);
      chat.appendChild(message);
      return message;
    }

    form.addEventListener("submit", function(event) {
      event.preventDefault();

      const text = input.value.trim();
      if (!text) return;

      addMessage("user", text);
      const reply = addMessage("assistant", REPLY);

      input.value = "";
      input.focus();
      reply.scrollIntoView({ block: "nearest" });
    });

    input.addEventListener("keydown", function(event) {
      if (
        event.key === "Enter" &&
        !event.shiftKey &&
        !event.isComposing
      ) {
        event.preventDefault();
        form.requestSubmit();
      }
    });

    document.getElementById("clear").addEventListener("click", function() {
      chat.replaceChildren();
      input.value = "";
      input.focus();
    });
  </script>
</body>
</html>