-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
161 lines (137 loc) · 4.16 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Matrix AI</title>
<style>
body {
font-family: 'Courier New', Courier, monospace;
background-color: #000;
color: #00FF00;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden;
}
h1, h2 {
color: #00FF00;
text-align: center;
}
form {
background-color: #000;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
padding: 20px;
max-width: 500px;
width: 100%;
border: 2px solid #00FF00;
}
label {
font-size: 1.2em;
color: #00FF00;
}
input[type="text"] {
width: 100%;
padding: 10px;
margin: 10px 0;
font-size: 1.1em;
color: #00FF00;
background-color: #000;
border: 2px solid #00FF00;
border-radius: 5px;
transition: border-color 0.3s;
}
input[type="text"]::placeholder {
color: #008000;
}
input[type="text"]:focus {
border-color: #00FF00;
outline: none;
box-shadow: 0 0 10px #00FF00;
}
button {
width: 100%;
padding: 10px;
background-color: #000;
color: #00FF00;
font-size: 1.2em;
border: 2px solid #00FF00;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}
button:hover {
background-color: #00FF00;
color: #000;
box-shadow: 0 0 10px #00FF00;
}
h2 {
color: #00FF00;
font-size: 2em;
}
p {
font-size: 1.2em;
color: #00FF00;
background-color: #000;
padding: 15px;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 255, 0, 0.7);
margin-top: 20px;
border: 2px solid #00FF00;
}
@media (max-width: 600px) {
form {
padding: 15px;
}
h1, h2 {
font-size: 1.5em;
}
input[type="text"], button {
font-size: 1em;
}
p {
font-size: 1em;
}
}
</style>
</head>
<body>
<div>
<h1>Welcome to The Matrix</h1>
<form id="question-form">
<label for="token-input">Enter your API Token:</label>
<input type="text" id="token-input" required placeholder="Enter your API Token">
<label for="question-input">Enter your question:</label>
<input type="text" id="question-input" required placeholder="What is the Matrix?">
<button type="submit">Submit</button>
</form>
<h2>Response:</h2>
<p id="response-output">Your answer will appear here...</p>
</div>
<script type="module">
import init, { ask_question } from './ai_api_integration/pkg/ai_api_integration.js';
async function loadWasm() {
await init();
document.getElementById('question-form').addEventListener('submit', async function(event) {
event.preventDefault();
const tokenInput = document.getElementById('token-input');
const apiKey = tokenInput.value;
const questionInput = document.getElementById('question-input');
const question = questionInput.value;
const responseOutput = document.getElementById('response-output');
try {
const response = await ask_question(apiKey, question);
responseOutput.textContent = response;
} catch (error) {
responseOutput.textContent = 'Error: ' + error.message;
}
});
}
loadWasm();
</script>
</body>
</html>