forked from ViperX7/Alpaca-Turbo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
45 lines (41 loc) · 1.12 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
<!DOCTYPE html>
<html>
<head>
<title>Alpaca Turbo</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<div>
<label for="question">Ask the bot:</label>
<input type="text" id="question" name="question">
<button id="submit">Submit</button>
</div>
<div>
<p>Bot response:</p>
<pre id="response"></pre>
</div>
<div>
<p>History:</p>
<ul id="history"></ul>
</div>
<script>
$(document).ready(function() {
$('#submit').click(function() {
var question = $('#question').val();
$.ajax({
type: 'POST',
url: '/completions',
data: JSON.stringify({ 'prompt': question }),
contentType: 'application/json; charset=utf-8',
dataType: 'text',
success: function(data) {
$('#response').text(data);
$('#history').append('<li>' + question + '</li>');
$('#history').append('<li>' + data + '</li>');
}
});
});
});
</script>
</body>
</html>