Spaces:
Sleeping
Sleeping
Delete chat_app.html
Browse files- chat_app.html +0 -380
chat_app.html
DELETED
@@ -1,380 +0,0 @@
|
|
1 |
-
<!DOCTYPE html>
|
2 |
-
<html lang="en">
|
3 |
-
<head>
|
4 |
-
<meta charset="UTF-8">
|
5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>LLM Sales Order</title>
|
7 |
-
|
8 |
-
<script src="//cdnjs.cloudflare.com/ajax/libs/annyang/2.6.1/annyang.min.js"></script>
|
9 |
-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
10 |
-
<script>
|
11 |
-
"use strict";
|
12 |
-
var mode_pesanan = false;
|
13 |
-
var mode_tanya = false;
|
14 |
-
var bicara=annyang
|
15 |
-
// first we make sure annyang started succesfully
|
16 |
-
if (bicara) {
|
17 |
-
// define the functions our commands will run.
|
18 |
-
var hello = function(text) {
|
19 |
-
$("#prompt-input").slideDown("slow");
|
20 |
-
scrollTo("#prompt-input");
|
21 |
-
if (mode_tanya==false) {
|
22 |
-
$("#prompt-input").val(""+text)
|
23 |
-
mode_tanya = true
|
24 |
-
} else {
|
25 |
-
let prev= $("#prompt-input").val()
|
26 |
-
$("#prompt-input").val(prev+" "+text)
|
27 |
-
}
|
28 |
-
//console.log($("#prompt-input").val())
|
29 |
-
$("#AppTitle").val("Tanya")
|
30 |
-
};
|
31 |
-
|
32 |
-
var pesanan = function(text) {
|
33 |
-
console.log("|"+text+"|")
|
34 |
-
if (text=="lanjut" || text=="masuk") {
|
35 |
-
submitButton();
|
36 |
-
} else {
|
37 |
-
$("#prompt-input").slideDown("slow");
|
38 |
-
scrollTo("#prompt-input");
|
39 |
-
if (mode_pesanan==false) {
|
40 |
-
$("#prompt-input").val("@ "+text)
|
41 |
-
mode_pesanan = true
|
42 |
-
} else {
|
43 |
-
let prev= $("#prompt-input").val()
|
44 |
-
$("#prompt-input").val(prev+" "+text)
|
45 |
-
}
|
46 |
-
}
|
47 |
-
};
|
48 |
-
|
49 |
-
var warna = function() {
|
50 |
-
$("#warna").slideDown("slow");
|
51 |
-
scrollTo("#section_warna");
|
52 |
-
};
|
53 |
-
var warna_minuman = function() {
|
54 |
-
$("#warna_minuman").slideDown("slow");
|
55 |
-
scrollTo("#section_warna_minuman");
|
56 |
-
};
|
57 |
-
var rasa = function() {
|
58 |
-
$("#rasa").slideDown("slow");
|
59 |
-
scrollTo("#section_rasa");
|
60 |
-
};
|
61 |
-
var aroma = function() {
|
62 |
-
$("#aroma").slideDown("slow");
|
63 |
-
scrollTo("#section_aroma");
|
64 |
-
};
|
65 |
-
var tutup = function() {
|
66 |
-
$("#hello1").hide();
|
67 |
-
$("#section_hello").hide();
|
68 |
-
$("#section_warna").hide();
|
69 |
-
$("#section_rasa").hide();
|
70 |
-
$("#section_aroma").hide();
|
71 |
-
scrollTo("#section_hello");
|
72 |
-
};
|
73 |
-
|
74 |
-
var submitButton = function() {
|
75 |
-
$("#button-input").slideDown("slow");
|
76 |
-
scrollTo("#button-input");
|
77 |
-
$("#button-input").click()
|
78 |
-
console.log("LANJUT")
|
79 |
-
mode_pesanan = false
|
80 |
-
mode_tanya = false
|
81 |
-
};
|
82 |
-
|
83 |
-
var getStarted = function() {
|
84 |
-
window.location.href = 'https://arafaasia.com';
|
85 |
-
}
|
86 |
-
|
87 |
-
// define our commands.
|
88 |
-
// * The key is the phrase you want your users to say.
|
89 |
-
// * The value is the action to do.
|
90 |
-
// You can pass a function, a function name (as a string), or write your function as part of the commands object.
|
91 |
-
var commands = {
|
92 |
-
'halo *teman': hello,
|
93 |
-
'tanya *teman': hello,
|
94 |
-
'pesanan *teman': pesanan,
|
95 |
-
'*teman': pesanan,
|
96 |
-
'lanjut': submitButton,
|
97 |
-
'masuk': submitButton,
|
98 |
-
|
99 |
-
};
|
100 |
-
|
101 |
-
// OPTIONAL: activate debug mode for detailed logging in the console
|
102 |
-
bicara.debug();
|
103 |
-
bicara.addCommands(commands);
|
104 |
-
bicara.setLanguage('id-ID'); // en
|
105 |
-
// Start listening. You can call this here, or attach this call to an event, button, etc.
|
106 |
-
bicara.start();
|
107 |
-
} else {
|
108 |
-
$(document).ready(function() {
|
109 |
-
$('#unsupported').fadeIn('fast');
|
110 |
-
});
|
111 |
-
}
|
112 |
-
|
113 |
-
var scrollTo = function(identifier, speed=1000) {
|
114 |
-
//console.log(identifier, speed)
|
115 |
-
$(identifier).show();
|
116 |
-
$('html, body').animate({
|
117 |
-
// scrollTop: $(identifier).offset().top
|
118 |
-
}, speed || 1000);
|
119 |
-
}
|
120 |
-
</script>
|
121 |
-
|
122 |
-
<style>
|
123 |
-
.table {
|
124 |
-
display:table;
|
125 |
-
|
126 |
-
height:100%;
|
127 |
-
border:1px solid #000;
|
128 |
-
}
|
129 |
-
.row2 {
|
130 |
-
display:table-row;
|
131 |
-
height:100%;
|
132 |
-
}
|
133 |
-
.cell1, .cell2, .cell3 {
|
134 |
-
display:table-cell;
|
135 |
-
width:33%;
|
136 |
-
height:auto;
|
137 |
-
border:1px solid #CCC;
|
138 |
-
}
|
139 |
-
#section_warna {
|
140 |
-
background-color: #ADAD03;
|
141 |
-
color: #fff;
|
142 |
-
}
|
143 |
-
#section_rasa {
|
144 |
-
background-color: #03AD77;
|
145 |
-
color: #fff;
|
146 |
-
}
|
147 |
-
#section_aroma {
|
148 |
-
background-color: #6503AD;
|
149 |
-
color: #fff;
|
150 |
-
}
|
151 |
-
</style>
|
152 |
-
<style>
|
153 |
-
figure {
|
154 |
-
display: flex inline;
|
155 |
-
justify-content: space-between;
|
156 |
-
border: 1px #cccccc solid;
|
157 |
-
padding: 4px;
|
158 |
-
margin: auto;
|
159 |
-
}
|
160 |
-
|
161 |
-
figcaption {
|
162 |
-
background-color: #ADAD03;
|
163 |
-
color: white;
|
164 |
-
font-style: italic;
|
165 |
-
padding: 0px;
|
166 |
-
text-align: center;
|
167 |
-
font-size: 14px;
|
168 |
-
}
|
169 |
-
|
170 |
-
|
171 |
-
.container {
|
172 |
-
background: white;
|
173 |
-
margin: 0 auto;
|
174 |
-
padding: 5%;
|
175 |
-
width: 90%;
|
176 |
-
}
|
177 |
-
.img_ds1 {
|
178 |
-
width: 80%;
|
179 |
-
height: auto
|
180 |
-
horizontal-align: center;
|
181 |
-
}
|
182 |
-
.img_ds {
|
183 |
-
width: 100%;
|
184 |
-
height: 100%; // auto
|
185 |
-
vertical-align: middle;
|
186 |
-
}
|
187 |
-
|
188 |
-
.pics_in_a_row {
|
189 |
-
display: flex;
|
190 |
-
}
|
191 |
-
|
192 |
-
.img1 { flex: 1.5; }
|
193 |
-
.img2 { flex: 1.5; }
|
194 |
-
.img3 { flex: 1.5; }
|
195 |
-
|
196 |
-
.pics_in_a_row {
|
197 |
-
margin: 25px 0;
|
198 |
-
}
|
199 |
-
|
200 |
-
.pics_in_a_row > div:not(:last-child) {
|
201 |
-
margin-right: 2%;
|
202 |
-
}
|
203 |
-
|
204 |
-
</style>
|
205 |
-
|
206 |
-
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
|
207 |
-
<style>
|
208 |
-
main {
|
209 |
-
max-width: 700px;
|
210 |
-
}
|
211 |
-
#conversation .user::before {
|
212 |
-
content: 'Anda: ';
|
213 |
-
font-weight: bold;
|
214 |
-
display: block;
|
215 |
-
}
|
216 |
-
#conversation .model::before {
|
217 |
-
content: 'AI: ';
|
218 |
-
font-weight: bold;
|
219 |
-
display: block;
|
220 |
-
}
|
221 |
-
#spinner {
|
222 |
-
opacity: 0;
|
223 |
-
transition: opacity 500ms ease-in;
|
224 |
-
width: 30px;
|
225 |
-
height: 30px;
|
226 |
-
border: 3px solid #222;
|
227 |
-
border-bottom-color: transparent;
|
228 |
-
border-radius: 50%;
|
229 |
-
animation: rotation 1s linear infinite;
|
230 |
-
}
|
231 |
-
@keyframes rotation {
|
232 |
-
0% { transform: rotate(0deg); }
|
233 |
-
100% { transform: rotate(360deg); }
|
234 |
-
}
|
235 |
-
#spinner.active {
|
236 |
-
opacity: 1;
|
237 |
-
}
|
238 |
-
</style>
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
<style>
|
244 |
-
{box-sizing: border-box;}
|
245 |
-
|
246 |
-
/* Button used to open the contact form - fixed at the bottom of the page */
|
247 |
-
.open-button {
|
248 |
-
background-color: #555;
|
249 |
-
color: white;
|
250 |
-
padding: 10px 10px;
|
251 |
-
border: none;
|
252 |
-
cursor: pointer;
|
253 |
-
opacity: 0.8;
|
254 |
-
position: fixed;
|
255 |
-
bottom: 23px;
|
256 |
-
right: 30%;
|
257 |
-
width: 280px;
|
258 |
-
}
|
259 |
-
|
260 |
-
/* The popup form - hidden by default */
|
261 |
-
.form-popup {
|
262 |
-
display: none;
|
263 |
-
position: fixed;
|
264 |
-
bottom: 0;
|
265 |
-
right: 30%;
|
266 |
-
border: 3px solid #f1f1f1;
|
267 |
-
z-index: 9;
|
268 |
-
}
|
269 |
-
|
270 |
-
/* Add styles to the form container */
|
271 |
-
.form-container {
|
272 |
-
max-width: 300px;
|
273 |
-
padding: 10px;
|
274 |
-
background-color: white;
|
275 |
-
font-size: 12px;
|
276 |
-
}
|
277 |
-
|
278 |
-
/* Full-width input fields */
|
279 |
-
.form-container input[type=text], .form-container input[type=password] {
|
280 |
-
width: 100%;
|
281 |
-
padding: 2px;
|
282 |
-
margin: 1px 0 2px 0;
|
283 |
-
border: none;
|
284 |
-
background: #f1f1f1;
|
285 |
-
}
|
286 |
-
|
287 |
-
/* When the inputs get focus, do something */
|
288 |
-
.form-container input[type=text]:focus, .form-container input[type=password]:focus {
|
289 |
-
background-color: #ddd;
|
290 |
-
outline: none;
|
291 |
-
}
|
292 |
-
|
293 |
-
/* Set a style for the submit/login button */
|
294 |
-
.form-container .btn {
|
295 |
-
background-color: #04AA6D;
|
296 |
-
color: white;
|
297 |
-
padding: 10px 10px;
|
298 |
-
border: none;
|
299 |
-
cursor: pointer;
|
300 |
-
width: 100%;
|
301 |
-
margin-bottom:10px;
|
302 |
-
opacity: 0.8;
|
303 |
-
}
|
304 |
-
|
305 |
-
/* Add a red background color to the cancel button */
|
306 |
-
.form-container .cancel {
|
307 |
-
background-color: red;
|
308 |
-
}
|
309 |
-
.form-container .umum {
|
310 |
-
background-color: grey;
|
311 |
-
}
|
312 |
-
/* Add some hover effects to buttons */
|
313 |
-
.form-container .btn:hover, .open-button:hover {
|
314 |
-
opacity: 1;
|
315 |
-
}
|
316 |
-
</style>
|
317 |
-
<script>
|
318 |
-
function openForm() {
|
319 |
-
document.getElementById("myForm").style.display = "block";
|
320 |
-
}
|
321 |
-
|
322 |
-
function closeForm() {
|
323 |
-
document.getElementById("myForm").style.display = "none";
|
324 |
-
}
|
325 |
-
function closeAiForm(id) {
|
326 |
-
document.getElementById("myaiForm"+id).style.display = "none";
|
327 |
-
document.getElementById("myaiForm2"+id).style.display = "block";
|
328 |
-
}
|
329 |
-
function openAiForm(id) {
|
330 |
-
document.getElementById("myaiForm"+id).style.display = "block";
|
331 |
-
document.getElementById("myaiForm2"+id).style.display = "none";
|
332 |
-
}
|
333 |
-
function abcde(id) {
|
334 |
-
alert("abcde:"+id);
|
335 |
-
}
|
336 |
-
</script>
|
337 |
-
</head>
|
338 |
-
<body>
|
339 |
-
<main class="border rounded mx-auto my-5 p-4">
|
340 |
-
<h1 id="AppTitle">Extract Sales Order from text</h1>
|
341 |
-
<p>Ekstrak JSON / FORM dari text/cerita lisan tentang penjualan (sales order)</p>
|
342 |
-
<p>Ucapkan misalnya "Budiman membeli Teh Putih 4 kaleng, harga per kaleng 33 ribu, ongkos kirim ke Bandung 13 ribu", (jeda sebentar) lanjutkan ucap: "masuk" atau "lanjut"</p>
|
343 |
-
<div id="conversation" class="px-2"></div>
|
344 |
-
<div class="d-flex justify-content-center mb-3">
|
345 |
-
<div id="spinner"></div>
|
346 |
-
</div>
|
347 |
-
<form method="post">
|
348 |
-
<input id="prompt-input" name="prompt" class="form-control"/>
|
349 |
-
<div class="d-flex justify-content-end">
|
350 |
-
<button id="button-input" class="btn btn-primary mt-2">Send</button>
|
351 |
-
</div>
|
352 |
-
</form>
|
353 |
-
<div id="error" class="d-none text-danger">
|
354 |
-
Erro occurred, check the browser developer console for more information.
|
355 |
-
</div>
|
356 |
-
</main>
|
357 |
-
|
358 |
-
</body>
|
359 |
-
</html>
|
360 |
-
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/5.6.3/typescript.min.js" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
361 |
-
<script type="module">
|
362 |
-
// to let me write TypeScript, without adding the burden of npm we do a dirty, non-production-ready hack
|
363 |
-
// and transpile the TypeScript code in the browser
|
364 |
-
// this is (arguably) A neat demo trick, but not suitable for production!
|
365 |
-
async function loadTs() {
|
366 |
-
const response = await fetch('/chat_app.ts');
|
367 |
-
const tsCode = await response.text();
|
368 |
-
const jsCode = window.ts.transpile(tsCode, { target: "es2015" });
|
369 |
-
let script = document.createElement('script');
|
370 |
-
script.type = 'module';
|
371 |
-
script.text = jsCode;
|
372 |
-
document.body.appendChild(script);
|
373 |
-
}
|
374 |
-
|
375 |
-
loadTs().catch((e) => {
|
376 |
-
console.error(e);
|
377 |
-
document.getElementById('error').classList.remove('d-none');
|
378 |
-
document.getElementById('spinner').classList.remove('active');
|
379 |
-
});
|
380 |
-
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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