Spaces:
Running
Running
Update flare-ui/src/app/components/environment/environment.component.html
Browse files
flare-ui/src/app/components/environment/environment.component.html
CHANGED
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div class="environment-container">
|
2 |
+
<mat-card>
|
3 |
+
<mat-card-header>
|
4 |
+
<mat-card-title>
|
5 |
+
<mat-icon>settings</mat-icon>
|
6 |
+
Environment Configuration
|
7 |
+
</mat-card-title>
|
8 |
+
</mat-card-header>
|
9 |
+
|
10 |
+
<mat-card-content>
|
11 |
+
@if (isGPTMode()) {
|
12 |
+
<mat-card class="info-card">
|
13 |
+
<mat-card-content>
|
14 |
+
<mat-icon>info</mat-icon>
|
15 |
+
<div>
|
16 |
+
<strong>{{ environment.work_mode === 'gpt4o' ? 'GPT-4o' : 'GPT-4o Mini' }} Mode</strong>
|
17 |
+
<p>This mode uses OpenAI's API which has usage-based pricing.</p>
|
18 |
+
<p>Approximate cost: {{ environment.work_mode === 'gpt4o' ? '$0.01-0.03' : '$0.001-0.003' }} per conversation turn.</p>
|
19 |
+
</div>
|
20 |
+
</mat-card-content>
|
21 |
+
</mat-card>
|
22 |
+
}
|
23 |
+
|
24 |
+
<form (ngSubmit)="save()" #envForm="ngForm">
|
25 |
+
<mat-form-field appearance="outline" class="full-width">
|
26 |
+
<mat-label>Work Mode</mat-label>
|
27 |
+
<mat-select
|
28 |
+
name="workMode"
|
29 |
+
[(ngModel)]="environment.work_mode"
|
30 |
+
(selectionChange)="onWorkModeChange()"
|
31 |
+
required
|
32 |
+
[disabled]="loading"
|
33 |
+
>
|
34 |
+
<mat-option value="hfcloud">HF Cloud</mat-option>
|
35 |
+
<mat-option value="cloud">Cloud</mat-option>
|
36 |
+
<mat-option value="on-premise">On-Premise</mat-option>
|
37 |
+
<mat-option value="gpt4o">GPT-4o</mat-option>
|
38 |
+
<mat-option value="gpt4o-mini">GPT-4o Mini</mat-option>
|
39 |
+
</mat-select>
|
40 |
+
<mat-icon matPrefix>cloud</mat-icon>
|
41 |
+
</mat-form-field>
|
42 |
+
|
43 |
+
<mat-form-field appearance="outline" class="full-width">
|
44 |
+
<mat-label>{{ getTokenLabel() }}</mat-label>
|
45 |
+
<input
|
46 |
+
matInput
|
47 |
+
type="password"
|
48 |
+
name="cloudToken"
|
49 |
+
[(ngModel)]="environment.cloud_token"
|
50 |
+
[disabled]="loading || environment.work_mode === 'on-premise'"
|
51 |
+
[placeholder]="getTokenPlaceholder()"
|
52 |
+
>
|
53 |
+
<mat-icon matPrefix>vpn_key</mat-icon>
|
54 |
+
<mat-hint>{{ isGPTMode() ? 'Required for OpenAI API access' : 'Required for HF Cloud and Cloud modes' }}</mat-hint>
|
55 |
+
</mat-form-field>
|
56 |
+
|
57 |
+
<mat-form-field appearance="outline" class="full-width">
|
58 |
+
<mat-label>Spark Endpoint</mat-label>
|
59 |
+
<input
|
60 |
+
matInput
|
61 |
+
type="url"
|
62 |
+
name="sparkEndpoint"
|
63 |
+
[(ngModel)]="environment.spark_endpoint"
|
64 |
+
[required]="!isGPTMode()"
|
65 |
+
[disabled]="loading || isGPTMode()"
|
66 |
+
placeholder="https://spark-service.example.com"
|
67 |
+
>
|
68 |
+
<mat-icon matPrefix>link</mat-icon>
|
69 |
+
<button
|
70 |
+
mat-icon-button
|
71 |
+
matSuffix
|
72 |
+
type="button"
|
73 |
+
(click)="testConnection()"
|
74 |
+
[disabled]="loading || !environment.spark_endpoint || isGPTMode()"
|
75 |
+
matTooltip="Test Connection"
|
76 |
+
>
|
77 |
+
<mat-icon>wifi_tethering</mat-icon>
|
78 |
+
</button>
|
79 |
+
@if (isGPTMode()) {
|
80 |
+
<mat-hint>Not required for GPT mode</mat-hint>
|
81 |
+
}
|
82 |
+
</mat-form-field>
|
83 |
+
|
84 |
+
<!-- TTS Configuration -->
|
85 |
+
<div class="engine-row">
|
86 |
+
<mat-form-field appearance="outline" class="engine-field">
|
87 |
+
<mat-label>TTS Engine</mat-label>
|
88 |
+
<mat-select
|
89 |
+
name="ttsEngine"
|
90 |
+
[(ngModel)]="environment.tts_engine"
|
91 |
+
(selectionChange)="onTTSEngineChange()"
|
92 |
+
[disabled]="loading"
|
93 |
+
>
|
94 |
+
<mat-option value="no_tts">No TTS</mat-option>
|
95 |
+
<mat-option value="elevenlabs">ElevenLabs</mat-option>
|
96 |
+
<mat-option value="blaze">Blaze (Coming Soon)</mat-option>
|
97 |
+
</mat-select>
|
98 |
+
<mat-icon matPrefix>record_voice_over</mat-icon>
|
99 |
+
</mat-form-field>
|
100 |
+
|
101 |
+
<mat-form-field appearance="outline" class="api-key-field">
|
102 |
+
<mat-label>TTS API Key</mat-label>
|
103 |
+
<input
|
104 |
+
matInput
|
105 |
+
type="password"
|
106 |
+
name="ttsApiKey"
|
107 |
+
[(ngModel)]="environment.tts_engine_api_key"
|
108 |
+
[disabled]="loading || environment.tts_engine === 'no_tts'"
|
109 |
+
[required]="environment.tts_engine !== 'no_tts'"
|
110 |
+
placeholder="Enter TTS API key"
|
111 |
+
>
|
112 |
+
<mat-icon matPrefix>key</mat-icon>
|
113 |
+
</mat-form-field>
|
114 |
+
</div>
|
115 |
+
|
116 |
+
<!-- STT Configuration -->
|
117 |
+
<div class="engine-row">
|
118 |
+
<mat-form-field appearance="outline" class="engine-field">
|
119 |
+
<mat-label>STT Engine</mat-label>
|
120 |
+
<mat-select
|
121 |
+
name="sttEngine"
|
122 |
+
[(ngModel)]="environment.stt_engine"
|
123 |
+
(selectionChange)="onSTTEngineChange()"
|
124 |
+
[disabled]="loading"
|
125 |
+
>
|
126 |
+
<mat-option value="no_stt">No STT</mat-option>
|
127 |
+
<mat-option value="google">Google Cloud Speech</mat-option>
|
128 |
+
<mat-option value="azure">Azure Speech (Coming Soon)</mat-option>
|
129 |
+
<mat-option value="amazon">Amazon Transcribe (Coming Soon)</mat-option>
|
130 |
+
<mat-option value="flicker">Flicker (Coming Soon)</mat-option>
|
131 |
+
</mat-select>
|
132 |
+
<mat-icon matPrefix>mic</mat-icon>
|
133 |
+
</mat-form-field>
|
134 |
+
|
135 |
+
<mat-form-field appearance="outline" class="api-key-field">
|
136 |
+
<mat-label>{{ getSTTKeyLabel() }}</mat-label>
|
137 |
+
<input
|
138 |
+
matInput
|
139 |
+
type="password"
|
140 |
+
name="sttApiKey"
|
141 |
+
[(ngModel)]="environment.stt_engine_api_key"
|
142 |
+
[disabled]="loading || environment.stt_engine === 'no_stt'"
|
143 |
+
[required]="environment.stt_engine !== 'no_stt'"
|
144 |
+
[placeholder]="getSTTKeyPlaceholder()"
|
145 |
+
>
|
146 |
+
<mat-icon matPrefix>key</mat-icon>
|
147 |
+
<mat-hint>{{ getSTTKeyHint() }}</mat-hint>
|
148 |
+
</mat-form-field>
|
149 |
+
|
150 |
+
<!-- STT Settings Panel -->
|
151 |
+
<mat-expansion-panel class="stt-settings-panel" *ngIf="environment.stt_engine !== 'no_stt'">
|
152 |
+
<mat-expansion-panel-header>
|
153 |
+
<mat-panel-title>
|
154 |
+
<mat-icon>settings_voice</mat-icon>
|
155 |
+
STT Settings
|
156 |
+
</mat-panel-title>
|
157 |
+
<mat-panel-description>
|
158 |
+
Advanced speech recognition settings
|
159 |
+
</mat-panel-description>
|
160 |
+
</mat-expansion-panel-header>
|
161 |
+
|
162 |
+
<div class="stt-settings-content">
|
163 |
+
<!-- Language -->
|
164 |
+
<mat-form-field appearance="outline" class="full-width">
|
165 |
+
<mat-label>Language</mat-label>
|
166 |
+
<mat-select
|
167 |
+
name="sttLanguage"
|
168 |
+
[(ngModel)]="environment.stt_settings.language"
|
169 |
+
[disabled]="loading"
|
170 |
+
>
|
171 |
+
<mat-option value="tr-TR">Turkish (tr-TR)</mat-option>
|
172 |
+
<mat-option value="en-US">English US (en-US)</mat-option>
|
173 |
+
<mat-option value="en-GB">English UK (en-GB)</mat-option>
|
174 |
+
<mat-option value="de-DE">German (de-DE)</mat-option>
|
175 |
+
<mat-option value="fr-FR">French (fr-FR)</mat-option>
|
176 |
+
<mat-option value="es-ES">Spanish (es-ES)</mat-option>
|
177 |
+
</mat-select>
|
178 |
+
<mat-icon matPrefix>language</mat-icon>
|
179 |
+
</mat-form-field>
|
180 |
+
|
181 |
+
<!-- Model -->
|
182 |
+
<mat-form-field appearance="outline" class="full-width" *ngIf="environment.stt_engine === 'google'">
|
183 |
+
<mat-label>Recognition Model</mat-label>
|
184 |
+
<mat-select
|
185 |
+
name="sttModel"
|
186 |
+
[(ngModel)]="environment.stt_settings.model"
|
187 |
+
[disabled]="loading"
|
188 |
+
>
|
189 |
+
<mat-option value="latest_long">Latest Long (Best for long audio)</mat-option>
|
190 |
+
<mat-option value="latest_short">Latest Short (Best for short audio)</mat-option>
|
191 |
+
<mat-option value="command_and_search">Command and Search</mat-option>
|
192 |
+
<mat-option value="phone_call">Phone Call</mat-option>
|
193 |
+
<mat-option value="video">Video</mat-option>
|
194 |
+
</mat-select>
|
195 |
+
<mat-icon matPrefix>model_training</mat-icon>
|
196 |
+
</mat-form-field>
|
197 |
+
|
198 |
+
<!-- Speech Timeout -->
|
199 |
+
<div class="slider-field">
|
200 |
+
<label>Speech Timeout: {{ environment.stt_settings.speech_timeout_ms }}ms</label>
|
201 |
+
<mat-slider
|
202 |
+
[min]="500"
|
203 |
+
[max]="5000"
|
204 |
+
[step]="100"
|
205 |
+
[discrete]="true"
|
206 |
+
[displayWith]="formatMilliseconds"
|
207 |
+
>
|
208 |
+
<input matSliderThumb [(ngModel)]="environment.stt_settings.speech_timeout_ms">
|
209 |
+
</mat-slider>
|
210 |
+
<mat-hint>Silence duration to end speech detection</mat-hint>
|
211 |
+
</div>
|
212 |
+
|
213 |
+
<!-- VAD Sensitivity -->
|
214 |
+
<div class="slider-field">
|
215 |
+
<label>Voice Activity Detection Sensitivity: {{ environment.stt_settings.vad_sensitivity }}</label>
|
216 |
+
<mat-slider
|
217 |
+
[min]="0"
|
218 |
+
[max]="1"
|
219 |
+
[step]="0.1"
|
220 |
+
[discrete]="true"
|
221 |
+
>
|
222 |
+
<input matSliderThumb [(ngModel)]="environment.stt_settings.vad_sensitivity">
|
223 |
+
</mat-slider>
|
224 |
+
<mat-hint>Higher values = more sensitive</mat-hint>
|
225 |
+
</div>
|
226 |
+
|
227 |
+
<!-- Noise Reduction Level -->
|
228 |
+
<div class="slider-field">
|
229 |
+
<label>Noise Reduction Level: {{ environment.stt_settings.noise_reduction_level }}</label>
|
230 |
+
<mat-slider
|
231 |
+
[min]="0"
|
232 |
+
[max]="3"
|
233 |
+
[step]="1"
|
234 |
+
[discrete]="true"
|
235 |
+
>
|
236 |
+
<input matSliderThumb [(ngModel)]="environment.stt_settings.noise_reduction_level">
|
237 |
+
</mat-slider>
|
238 |
+
<mat-hint>0 = Off, 3 = Maximum</mat-hint>
|
239 |
+
</div>
|
240 |
+
|
241 |
+
<!-- Checkboxes -->
|
242 |
+
<div class="checkbox-group">
|
243 |
+
<mat-checkbox
|
244 |
+
[(ngModel)]="environment.stt_settings.use_enhanced"
|
245 |
+
[disabled]="loading"
|
246 |
+
*ngIf="environment.stt_engine === 'google'">
|
247 |
+
Use Enhanced Model
|
248 |
+
</mat-checkbox>
|
249 |
+
|
250 |
+
<mat-checkbox
|
251 |
+
[(ngModel)]="environment.stt_settings.enable_punctuation"
|
252 |
+
[disabled]="loading">
|
253 |
+
Enable Automatic Punctuation
|
254 |
+
</mat-checkbox>
|
255 |
+
|
256 |
+
<mat-checkbox
|
257 |
+
[(ngModel)]="environment.stt_settings.interim_results"
|
258 |
+
[disabled]="loading">
|
259 |
+
Show Interim Results
|
260 |
+
</mat-checkbox>
|
261 |
+
</div>
|
262 |
+
</div>
|
263 |
+
</mat-expansion-panel>
|
264 |
+
</div>
|
265 |
+
|
266 |
+
<mat-expansion-panel class="prompt-panel">
|
267 |
+
<mat-expansion-panel-header>
|
268 |
+
<mat-panel-title>
|
269 |
+
<mat-icon>psychology</mat-icon>
|
270 |
+
Internal System Prompt
|
271 |
+
</mat-panel-title>
|
272 |
+
<mat-panel-description>
|
273 |
+
Advanced configuration for LLM
|
274 |
+
</mat-panel-description>
|
275 |
+
</mat-expansion-panel-header>
|
276 |
+
|
277 |
+
<mat-form-field appearance="outline" class="full-width">
|
278 |
+
<mat-label>Internal Prompt</mat-label>
|
279 |
+
<textarea
|
280 |
+
matInput
|
281 |
+
name="internalPrompt"
|
282 |
+
[(ngModel)]="environment.internal_prompt"
|
283 |
+
[disabled]="loading"
|
284 |
+
rows="10"
|
285 |
+
placeholder="Enter internal system prompt..."
|
286 |
+
></textarea>
|
287 |
+
<mat-hint>This prompt will be prepended to all project prompts</mat-hint>
|
288 |
+
</mat-form-field>
|
289 |
+
</mat-expansion-panel>
|
290 |
+
|
291 |
+
<div class="form-actions">
|
292 |
+
<button
|
293 |
+
mat-raised-button
|
294 |
+
color="primary"
|
295 |
+
type="submit"
|
296 |
+
[disabled]="loading || !envForm.valid || saving"
|
297 |
+
>
|
298 |
+
@if (saving) {
|
299 |
+
<mat-spinner diameter="20"></mat-spinner>
|
300 |
+
Saving...
|
301 |
+
} @else {
|
302 |
+
<mat-icon>save</mat-icon>
|
303 |
+
Save
|
304 |
+
}
|
305 |
+
</button>
|
306 |
+
|
307 |
+
<button
|
308 |
+
mat-raised-button
|
309 |
+
type="button"
|
310 |
+
(click)="reloadFromSpark()"
|
311 |
+
[disabled]="loading || isGPTMode()"
|
312 |
+
>
|
313 |
+
<mat-icon>refresh</mat-icon>
|
314 |
+
Reload from Spark
|
315 |
+
</button>
|
316 |
+
</div>
|
317 |
+
</form>
|
318 |
+
</mat-card-content>
|
319 |
+
</mat-card>
|
320 |
+
</div>
|