-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
307 lines (257 loc) · 10.1 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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>OVOS User Config</title>
<link rel="stylesheet" href="styles.css"> <!-- Link to your external CSS file if you save it separately -->
<style>
/* Set the font for the entire document and increase font size */
body {
font-family: 'Roboto', sans-serif; /* Use your preferred font here */
font-size: 130%;
margin: 0;
padding: 0;
background-color: #fff; /* Set background color to white */
}
/* Header styling */
h1 {
background-color: #3498db;
color: #fff;
padding: 20px;
text-align: center;
margin-bottom: 20px;
}
/* Styling for fieldset legends */
fieldset {
margin-bottom: 30px;
border-radius: 8px; /* Rounded corners for fieldsets */
}
legend {
display: block;
width: 100%;
padding: 10px;
background-color: #f0f0f0;
border: 1px solid #ddd;
border-radius: 8px;
font-weight: bold;
}
label {
margin-bottom: 10px;
display: block;
}
/* Increase spacing between fields */
select,
input,
checkbox,
button {
margin-bottom: 15px;
font-size: 100%; /* Reset font size for buttons to default */
border-radius: 4px; /* Rounded corners for input fields and buttons */
}
/* Increase text input field height */
input[type="text"],
select {
height: 40px; /* Adjust the height as needed */
}
/* Set maximum width for the form */
form {
max-width: 55%;
margin: 0 auto; /* Center the form horizontally */
display: flex; /* Use flexbox to align buttons vertically */
flex-direction: column; /* Align buttons in a column */
}
/* Styling for copy button */
#copyButton {
display: none; /* Hide copy button by default */
background-color: #4caf50;
color: #fff;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
max-width: 25%;
}
#copyButton:hover {
background-color: #45a049;
}
/* Increase the size of checkboxes and make the outline thicker */
input[type="checkbox"] {
width: 20px; /* Adjust width as needed */
height: 20px; /* Adjust height as needed */
border: 10px solid #3498db; /* Adjust thickness and color as needed */
}
#jsonOutput {
width: 100%;
height: 200px; /* Adjust height as needed */
resize: vertical; /* Allow vertical resizing */
font-family: 'Consolas', monospace; /* Use Courier New or preferred monospaced font */
font-size: 20px; /* Adjust font size as needed */
}
</style>
</head>
<body>
<h1>OVOS User Config settings</h1>
<form id="myForm">
<label for="log_level">Log Level: </label>
<select id="log_level" name="log_level">
<option value="INFO">INFO</option>
<option value="DEBUG">DEBUG</option>
</select>
<label for="play_wav_cmdline">Play WAV Cmdline: </label>
<select id="play_wav_cmdline" name="play_wav_cmdline">
<option value="pw-play">pw-play</option>
<option value="aplay">aplay</option>
<option value="paplay">paplay</option>
</select>
<label for="play_mp3_cmdline">Play MP3 Cmdline: </label>
<select id="play_mp3_cmdline" name="play_mp3_cmdline">
<option value="pw-play">pw-play</option>
<option value="aplay">aplay</option>
<option value="paplay">paplay</option>
</select>
<label for="lang">Language: </label>
<select id="lang" name="lang">
<option value="en-us">en-us</option>
<option value="nl-nl">nl-nl</option>
<option value="de-de">de-de</option>
<option value="fr-fr">fr-fr</option>
</select>
<fieldset>
<legend>Listener Settings</legend>
<label for="listener_remove_silence">Remove Silence: </label><input type="checkbox" id="listener_remove_silence" name="listener_remove_silence" value="True">
<fieldset>
<legend>Speech Recognition</legend>
<label for="listener_VAD_module">VAD Module: </label><input type="text" id="listener_VAD_module" name="listener_VAD_module" value="ovos-vad-plugin-silero">
</fieldset>
<label for="listener_instant_listen">Instant Listen: </label><input type="checkbox" id="listener_instant_listen" name="listener_instant_listen" value="True">
</fieldset>
<fieldset>
<legend>Gui Settings</legend>
<label for="gui_extension">Gui Extension: </label><input type="text" id="gui_extension" name="gui_extension" value="ovos-gui-plugin-shell-companion">
</fieldset>
<fieldset>
<legend>Websocket Settings</legend>
<label for="websocket_max_msg_size">Max Message Size: </label>
<select id="websocket_max_msg_size" name="websocket_max_msg_size">
<option value="25" selected>25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</fieldset>
<fieldset>
<legend>Tts Settings</legend>
<fieldset>
<legend>Tts Module</legend>
<label for="tts_module">Module: </label>
<select id="tts_module" name="tts_module" onchange="updateVoiceDropdown()">
<option value="ovos-tts-server">ovos-tts-server</option>
<option value="ovos-tts-plugin-edge-tts">ovos-tts-plugin-edge-tts</option>
<!-- Add more options as needed -->
</select>
<fieldset>
<legend>Voice</legend>
<label for="tts_module_voice">Voice: </label>
<select id="tts_module_voice" name="tts_module_voice">
<!-- Options will be populated dynamically based on the selected module -->
</select>
</fieldset>
</fieldset>
<div id="sentenceTokenizeField" style="display: none;">
<label for="tts_sentence_tokenize">Sentence Tokenize: </label><input type="checkbox" id="tts_sentence_tokenize" name="tts_sentence_tokenize" value="True">
</div>
</fieldset>
<!-- Copy button -->
<button id="copyButton" onclick="copyToClipboard()">Copy JSON</button>
<br>
<h2><label for="jsonOutput">JSON Preview:</label></h2>
<textarea id="jsonOutput" rows="10" cols="50" readonly></textarea>
<br>
<br>
<br>
<script>
function copyToClipboard() {
var jsonOutputTextarea = document.getElementById("jsonOutput");
jsonOutputTextarea.select();
document.execCommand("copy");
}
function updateVoiceDropdown() {
var moduleDropdown = document.getElementById("tts_module");
var voiceDropdown = document.getElementById("tts_module_voice");
var sentenceTokenizeField = document.getElementById("sentenceTokenizeField");
// Clear existing options
voiceDropdown.innerHTML = "";
// Populate voice options based on the selected module
if (moduleDropdown.value === "ovos-tts-server") {
var voices = ["ryan high", "ryan low"];
sentenceTokenizeField.style.display = "block";
} else if (moduleDropdown.value === "ovos-tts-plugin-edge-tts") {
var voices = ["en-US-AriaNeural", "nl-NL-FennaNeural"];
sentenceTokenizeField.style.display = "none";
}
// Add options to the voice dropdown
for (var i = 0; i < voices.length; i++) {
var option = document.createElement("option");
option.value = voices[i];
option.text = voices[i];
voiceDropdown.add(option);
}
}
function convertToJSON() {
var form = document.getElementById("myForm");
var formData = new FormData(form);
var json = {};
formData.forEach(function (value, key) {
if (key === "log_level" || key === "play_wav_cmdline" || key === "play_mp3_cmdline" || key === "websocket_max_msg_size") {
json[key] = value;
} else if (key.includes("_")) {
var keys = key.split("_");
var currentObj = json;
for (var i = 0; i < keys.length - 1; i++) {
if (!(keys[i] in currentObj)) {
currentObj[keys[i]] = {};
}
currentObj = currentObj[keys[i]];
}
currentObj[keys[keys.length - 1]] = value;
} else {
json[key] = value;
}
});
// Include voice option in the JSON structure
var moduleValue = form.elements["tts_module"].value;
var voiceValue = form.elements["tts_module_voice"].value;
if (moduleValue === "ovos-tts-server" || moduleValue === "ovos-tts-plugin-edge-tts") {
if (!json["tts"]) {
json["tts"] = {};
}
if (!json["tts"][moduleValue]) {
json["tts"][moduleValue] = {};
}
json["tts"][moduleValue]["voice"] = voiceValue;
}
var jsonOutputTextarea = document.getElementById("jsonOutput");
jsonOutputTextarea.value = JSON.stringify(json, null, 2);
// Show the copy button after converting to JSON
var copyButton = document.getElementById("copyButton");
copyButton.style.display = "block";
}
function updateJSONOnFormChange() {
// Add an event listener to each form element
var form = document.getElementById("myForm");
var jsonOutputTextarea = document.getElementById("jsonOutput");
form.addEventListener("input", function () {
convertToJSON(); // Update JSON on form change
});
form.addEventListener("change", function () {
convertToJSON(); // Update JSON on form change
});
// Initial population of voice dropdown
updateVoiceDropdown();
}
// Call the function to set up live updating on form change
updateJSONOnFormChange();
</script>
</form>
</body>
</html>