File size: 2,618 Bytes
5d2360a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
HOME_HTML = """
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>GMAT Solver v3</title>
  <style>
    body { font-family: Arial, sans-serif; max-width: 900px; margin: 40px auto; padding: 0 16px; }
    textarea { width: 100%; min-height: 220px; padding: 12px; font-size: 16px; }
    .row { display: flex; gap: 16px; margin: 12px 0; flex-wrap: wrap; }
    .card { border: 1px solid #ddd; border-radius: 10px; padding: 12px; flex: 1 1 220px; }
    button { padding: 10px 16px; font-size: 16px; cursor: pointer; }
    pre { white-space: pre-wrap; background: #f7f7f7; padding: 16px; border-radius: 10px; }
    label { display: block; margin-bottom: 8px; font-weight: bold; }
    select, input[type="range"] { width: 100%; }
  </style>
</head>
<body>
  <h1>GMAT Solver v3</h1>
  <p>This version supports natural chat and hidden Unity context.</p>
  <label for="message">Message</label>
  <textarea id="message" placeholder="Try:
why is it c
Or paste a whole question."></textarea>
  <div class="row">
    <div class="card">
      <label for="help_mode">Help mode</label>
      <select id="help_mode">
        <option value="answer" selected>answer</option>
        <option value="hint">hint</option>
        <option value="walkthrough">walkthrough</option>
      </select>
    </div>
    <div class="card">
      <label for="tone">Tone</label>
      <input id="tone" type="range" min="0" max="1" step="0.01" value="0.5">
    </div>
    <div class="card">
      <label for="verbosity">Verbosity</label>
      <input id="verbosity" type="range" min="0" max="1" step="0.01" value="0.5">
    </div>
    <div class="card">
      <label for="transparency">Transparency</label>
      <input id="transparency" type="range" min="0" max="1" step="0.01" value="0.5">
    </div>
  </div>
  <button onclick="send()">Send</button>
  <h2>Response</h2>
  <pre id="out">Waiting...</pre>
  <script>
    async function send() {
      const payload = {
        message: document.getElementById('message').value,
        help_mode: document.getElementById('help_mode').value,
        tone: parseFloat(document.getElementById('tone').value),
        verbosity: parseFloat(document.getElementById('verbosity').value),
        transparency: parseFloat(document.getElementById('transparency').value)
      };
      const res = await fetch('/chat', {
        method: 'POST',
        headers: {'Content-Type': 'application/json'},
        body: JSON.stringify(payload)
      });
      const data = await res.json();
      document.getElementById('out').textContent = JSON.stringify(data, null, 2);
    }
  </script>
</body>
</html>
"""