summaryrefslogtreecommitdiffstats
path: root/ui/index.html
blob: 90f78c1a220a63b30619a74849282f32fe907b6e (plain)
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
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">
    <title>TaSTT</title>
    <link rel="stylesheet" href="build/output.css">
</head>
<body class="bg-gray-100">
    <div class="container-fluid px-6 py-6 h-screen flex flex-col">
        <div class="flex flex-1 gap-6 overflow-hidden">
            <!-- Left Panel: Configuration Form -->
            <div class="max-w-96 relative flex flex-col">
                <!-- Loading Overlay -->
                <div id="loading-overlay" class="absolute inset-0 bg-white bg-opacity-75 backdrop-blur-sm z-50 hidden flex items-center justify-center rounded-lg">
                    <div class="text-center p-6">
                        <div class="animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"></div>
                        <p class="text-gray-700 font-medium"></p>
                    </div>
                </div>
                
                <!-- Scrollable form container -->
                <div class="overflow-y-auto flex-1">
                    <form id="config-form" class="space-y-6 pr-3">
                        <!-- Basic settings (Always Visible) -->
                        <section class="config-section">
                            <div class="grid grid-cols-2 gap-4">
                                <div>
                                    <label for="model" class="form-label">Model</label>
                                    <select id="model" class="form-input">
                                        <option value="tiny">tiny</option>
                                        <option value="base">base</option>
                                        <option value="small">small</option>
                                        <option value="medium">medium</option>
                                        <option value="large">large</option>
                                        <option value="turbo">turbo</option>
                                    </select>
                                </div>
                                <div>
                                    <label for="language" class="form-label">Language</label>
                                    <select id="language" class="form-input">
                                        <option value="english">English</option>
                                        <option value="spanish">Spanish</option>
                                        <option value="french">French</option>
                                        <option value="german">German</option>
                                        <option value="italian">Italian</option>
                                        <option value="portuguese">Portuguese</option>
                                        <option value="russian">Russian</option>
                                        <option value="chinese">Chinese</option>
                                        <option value="japanese">Japanese</option>
                                        <option value="korean">Korean</option>
                                    </select>
                                </div>
                                <div class="col-span-2">
                                    <label for="microphone" class="form-label">Microphone</label>
                                    <div class="flex gap-2">
                                        <select id="microphone" class="form-input flex-1">
                                            <option value="">Loading microphones...</option>
                                        </select>
                                        <button type="button" id="refresh-microphones" class="btn btn-gray px-3 py-2 flex items-center" title="Refresh microphone list">
                                            <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
                                            </svg>
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </section>

                        <!-- Advanced settings toggle -->
                        <button type="button" id="toggle-advanced" class="flex items-center gap-2 text-gray-600 hover:text-gray-800 font-medium">
                            <svg id="chevron" class="w-5 h-5 transform transition-transform duration-200" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7"/>
                            </svg>
                            Advanced Settings
                        </button>

                        <!-- Advanced settings (initially hidden) -->
                        <div id="advanced-settings" class="hidden space-y-6">
                            <!-- Compute Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Compute Settings</h2>
                                <div class="grid grid-cols-2 gap-4">
                                    <div>
                                        <label for="compute_type" class="form-label">Compute Type</label>
                                        <select id="compute_type" class="form-input">
                                            <option value="int8">int8</option>
                                            <option value="float16">float16</option>
                                            <option value="float32">float32</option>
                                        </select>
                                    </div>
                                    <div>
                                        <label for="gpu_idx" class="form-label">GPU Index</label>
                                        <input type="number" id="gpu_idx" min="0" value="0" class="form-input">
                                    </div>
                                    <div class="col-span-2">
                                        <label for="use_cpu" class="checkbox-label">
                                            <input type="checkbox" id="use_cpu" class="mr-2">
                                            <span class="checkbox-text">Use CPU</span>
                                        </label>
                                    </div>
                                </div>
                            </section>

                            <!-- Audio Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Voice Activity Detection</h2>
                                <div class="grid grid-cols-2 gap-4">
                                    <div>
                                        <label for="max_speech_duration_s" class="form-label">Max Speech Duration (seconds)</label>
                                        <input type="number" id="max_speech_duration_s" min="1" value="10" class="form-input">
                                    </div>
                                    <div>
                                        <label for="min_silence_duration_ms" class="form-label">Min Silence Duration (ms)</label>
                                        <input type="number" id="min_silence_duration_ms" min="0" value="250" class="form-input">
                                    </div>
                                    <div>
                                        <label for="reset_after_silence_s" class="form-label">Reset After Silence (seconds)</label>
                                        <input type="number" id="reset_after_silence_s" min="1" value="15" class="form-input">
                                    </div>
                                </div>
                            </section>

                            <!-- Transcription Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Transcription Settings</h2>
                                <div>
                                    <label for="user_prompt" class="form-label">
                                        Custom Prompt
                                        <span class="text-gray-500 text-xs block mt-1"
                                              title="Whisper is given this prompt before transcribing. It helps guide the transcription style. For example, you could improve the spelling of your friends' names with: 'My friends' names are Saoirse, Azariah, and Caoimhe.'">
                                            (Hover for details)
                                        </span>
                                    </label>
                                    <textarea id="user_prompt" 
                                              class="form-input h-20 resize-none" 
                                              placeholder="My friends' names are Saoirse, Azariah, and Caoimhe."></textarea>
                                </div>
                            </section>

                            <!-- Performance Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Performance Settings</h2>
                                <div>
                                    <label for="transcription_loop_delay_ms" class="form-label">Transcription Loop Delay (ms)</label>
                                    <input type="number" id="transcription_loop_delay_ms" min="0" value="100" class="form-input">
                                </div>
                            </section>

                            <!-- Debug/Preview Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Debug/Preview Settings</h2>
                                <div class="space-y-3">
                                    <label for="enable_debug_mode" class="checkbox-label">
                                        <input type="checkbox" id="enable_debug_mode" class="mr-2">
                                        <span class="checkbox-text">Enable Debug Mode</span>
                                    </label>
                                    <label for="enable_previews" class="checkbox-label">
                                        <input type="checkbox" id="enable_previews" checked class="mr-2">
                                        <span class="checkbox-text">Enable Previews</span>
                                    </label>
                                    <label for="save_audio" class="checkbox-label">
                                        <input type="checkbox" id="save_audio" class="mr-2">
                                        <span class="checkbox-text">Save Audio Segments</span>
                                    </label>
                                </div>
                            </section>

                            <!-- Display Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Custom Chatbox Settings</h2>
                                <div class="grid grid-cols-2 gap-4">
                                    <div>
                                        <label for="block_width" class="form-label">Block Width</label>
                                        <input type="number" id="block_width" min="1" value="2" class="form-input">
                                    </div>
                                    <div>
                                        <label for="num_blocks" class="form-label">Number of Blocks</label>
                                        <input type="number" id="num_blocks" min="1" value="40" class="form-input">
                                    </div>
                                    <div>
                                        <label for="rows" class="form-label">Rows</label>
                                        <input type="number" id="rows" min="1" value="10" class="form-input">
                                    </div>
                                    <div>
                                        <label for="cols" class="form-label">Columns</label>
                                        <input type="number" id="cols" min="1" value="24" class="form-input">
                                    </div>
                                </div>
                            </section>

                            <!-- Configuration Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Configuration</h2>
                                <div>
                                    <button type="button" id="reset-config" class="btn btn-blue w-full">
                                        Reset Config to Defaults
                                    </button>
                                </div>
                            </section>

                            <!-- Virtual Environment Settings -->
                            <section class="config-section">
                                <h2 class="section-title">Virtual Environment</h2>
                                <div class="flex space-x-3">
                                    <button type="button" id="setup-venv" class="btn btn-blue flex-1">
                                        Setup venv
                                    </button>
                                    <button type="button" id="reset-venv" class="btn btn-blue flex-1">
                                        Reset venv
                                    </button>
                                </div>
                            </section>
                        </div>

                        <!-- Action Buttons -->
                        <div class="pb-6">
                            <div class="flex space-x-3">
                                <button type="button" id="start-process" class="btn btn-green flex-1">
                                    Start
                                </button>
                                <button type="button" id="stop-process" class="btn btn-red flex-1" disabled>
                                    Stop
                                </button>
                            </div>
                        </div>
                    </form>
                    
                    <!-- Status Message -->
                    <div id="status-message" class="mt-6 p-4 rounded-md hidden"></div>
                </div>
            </div>

            <!-- Right Panel: Python Console -->
            <div class="flex-1 flex flex-col bg-gray-900 rounded-lg overflow-hidden">
                <div id="python-console" class="flex-1 overflow-y-auto p-4 font-mono text-sm">
                    <div id="console-content" class="text-gray-300 whitespace-pre-wrap"></div>
                </div>
            </div>
        </div>
    </div>

    <script src="renderer.js"></script>
</body>
</html>