forked from metalabplaksha/queues
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
242 lines (205 loc) · 8.74 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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Queues</title>
<link rel="stylesheet" href="styles.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" type="image/x-icon" href="/assets/favicon.png">
<link rel="stylesheet" href="TemplateData/style.css">
<!-- <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> -->
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/lib/jquery-3.6.0.min.js"></script>
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/source/2.0/js/dave_utils.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/dist/js/socket.io-mini.js"></script>
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/dist/js/socket.stream.io-mini.js"></script>
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/dist/js/RecordRTC-mini.js"></script>
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/lib/flac-dep.js"></script>
<script src="https://unity-plugin.iamdave.ai/conversation-plugin/dist/js/vad-mini.js"></script>
<script src="conversation.js"></script>
<script src="streamer.js"></script>
</head>
<body>
<script>
var jsonText;
</script>
<div id="landingForm">
<div class="title-container">
<h1>Multi-Network Queues</h1>
</div>
<div class="container">
<div class="form-toggle">
<button id="signInBtn">Sign In</button>
<button id="signUpBtn">Sign Up</button>
</div>
<div class="form-container">
<form id="signInForm">
<h3>Sign In</h3>
<label for="username">Username</label>
<input type="text" id="username" name="username" required />
<label for="password">Password</label>
<input type="password" id="password" name="password" required />
<label for="username">Token</label>
<input type="text" id="token" name="token" required />
<button type="submit" class="signBtn">Sign In</button>
</form>
<form id="signUpForm">
<h3>Sign Up</h3>
<label for="newUsername">Username</label>
<input type="text" id="newUsername" name="newUsername" required />
<label for="newPassword">Password</label>
<input
type="password"
id="newPassword"
name="newPassword"
required
/>
<label for="username">Token</label>
<input type="text" id="newToken" name="token" required />
<button type="submit" class="signBtn" id="">Sign Up</button>
</form>
</div>
</div>
</div>
<div id="jsonContainer" style="display: none;">
<div class="split left p-4">
<h2>Game Configuration</h2>
<div id="button-div-wrapper" style="margin-top: 15px;">
<p style="font-weight: bold;">Available Configurations:</p>
<div id = "buttons-div" style="position: relative;">
</div>
</div>
<form id="jsonForm">
<div class="form-group" style="margin-top: 10px;">
<p style="font-weight: bold;">Create custom configuration: </p>
<label for="scenario">Scenario:</label>
<select class="form-control" id="scenario" name="scenario" required>
<option value="PCB">PCB</option>
</select>
</div>
<div class="form-group" style="display: none;">
<label for="spawn_prefab">Spawn Prefab:</label>
<select class="form-control" id="spawn_prefab" name="spawn_prefab" required>
<option value="PlainBoard">PlainBoard</option>
</select>
</div>
<div class="form-group">
<label for="config_name">Config Name:</label>
<input class="form-control" id="config_name" name="config_name" required>
</div>
<div id="levels-container">
<!-- Dynamically generated fields for levels -->
</div>
<div class="int-div">
<button type="button" class="btn btn-primary mt-3 json-btn ml-1 mr-1" id="add-level" onclick="addLevel()">Add Level</button>
<button type="button" class="btn btn-danger mt-3 ml-1 mr-1 json-btn" onclick="removeLevel()">Remove Level</button>
<button type="button" class="btn btn-success mt-3 json-btn ml-1 mr-1" onclick="generateJSON(event)">Submit</button>
</div>
</form>
</div>
</div>
<div id = "no-game-container" class="split right hidden">
<p>Select a configuration to start!</p>
</div>
<div id="unity-container" class="unity-desktop split right p-3" style="position: absolute;">
<canvas id="unity-canvas"></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<!-- <div id="unity-webgl-logo"></div> -->
<div id="unity-fullscreen-button"></div>
<div id="conversation_form" class="pt-1">
<label for="customer_response" style="font-weight: bold;">Type Your Query Here</label>
<input type="text" id="customer_response" name="customer_response" required />
<div class="int-div">
<button id="RecordBtn" onclick="startRec()" class="int-btn">Record</button>
<button id="StopRecordBtn" onclick="stopRec()" class="int-btn">Stop Recording</button>
<button id="conversationBtn" class="int-btn">Send</button>
</div>
</div>
<div style="">
<div class="alert alert-secondary m-4" role="alert" style="text-align: center;">
Press ESC twice to see the cursor.
</div>
</div>
<!-- <div id="unity-build-title">q_project</div> -->
</div>
</div>
<script> // speech to text
var streamer_settings = {
asr: true,
asr_server: "https://speech.iamdave.ai",
recognizer: 'google',
model_name: "indian_english",
conversation_id: "deployment_queuess",
enterprise_id: "student_test",
base_url: "https://test.iamdave.ai",
vad: true,
audio_auto_stop: 10,
asr_type: "full",
asr_additional_info: {},
event_callback: function (status, data) {
conversationStart(data["recognized_speech"]);
console.log("my status == "+status)
if (status == "asr-convResp") {
myUnityInstance.SendMessage(
"Assistantcode",
"spawnDave",
JSON.stringify(data["response_channels"])
);
}
if (status == "asr-recText") {
}
if (status == "asr-processing") {
}
if (status == "asr-recording") {
}
if (status == "asr-idel") {
}
//that.eventCallback(event, data);
}
}
var streamer = new Streamer(streamer_settings);
function startRec() {
streamer.startVoiceRecording({
voice_id: 'english-male',
query_type: "speech",
language: 'english',
system_response: "sr_init"
})
}
function stopRec() {
streamer.stopVoiceRecording()
}
</script>
<script>
const popup = document.createElement('div');
popup.className = 'popup';
popup.textContent = 'This is a simple popup message!';
document.body.appendChild(popup);
// Function to show the popup for a certain duration
function showPopup(durationInSeconds, text) {
console.log("PUPUP");
popup.style.display = 'block';
popup.classList.add('show');
popup.textContent = text;
// Hide the popup after the specified duration
setTimeout(function () {
popup.classList.remove('show');
}, durationInSeconds * 1000); // Convert seconds to milliseconds
}
// Call the function to show the popup for 5 seconds (change the value as needed)
</script>
<script src="unityScript.js"></script>
<script src="loginScript.js"></script>
<script src="jsonScript.js"></script>
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
</body>
</html>