-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
60 lines (52 loc) · 2.27 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- BS-5 -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-ENjdO4Dr2bkBIFxQpeoTz1HIcje39Wm4jDKdf19U8gI4ddQ3GYNS7NTKfAdVQSZe"
crossorigin="anonymous"></script>
<!-- icons -->
<link href="https://site-assets.fontawesome.com/releases/v6.1.1/css/all.css" rel="stylesheet">
<style src="style.css"></style>
<title>Streaming OpenAI API Completions in JavaScript</title>
<script type="module" src="index.js"></script>
</head>
<body class="">
<div class="container mt-2">
<div class="row">
<div class="alert alert-success" role="alert">
<h1 class="display-6 text-center">
Streaming OpenAI API Completions in JavaScript
</h1>
</div>
<div class="col-12">
<div id="resultContainer" class="border my-5" style="min-height: 200px;">
<div class="d-flex justify-content-between">
<p class="mb-2 opacity-50 ">Generated Text</p>
<div><button title="Copy text" class="btn btn-sm btn-default fs-4" id="copyTextBtn"><i class="fa-solid fa-copy"></i></button></div>
</div>
<code> <p id="resultText" class="p-3 "> </p></code>
</div>
</div>
<div class="col-8 mx-auto ">
<input type="text" id="promptInput" class="form-control " placeholder="Enter prompt..." style="background-color: rgba(219, 254, 255, 0.555);
min-height: 100px;
padding:5px 20px !important;" />
</div>
<div class="d-flex justify-content-center mt-4">
<button id="generateBtn" class="btn btn-primary m-2">
Generate <i class="fa-duotone fa-arrows-rotate"></i>
</button>
<button id="stopBtn" disabled class="btn btn-warning m-2">
Stop <i class="fa-regular fa-xmark"></i>
</button>
</div>
</div>
</div>
</body>
</html>