Spaces:
Building
Building
Update flare-ui/src/app/components/environment/environment.component.ts
Browse files
flare-ui/src/app/components/environment/environment.component.ts
CHANGED
@@ -39,6 +39,19 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
39 |
</mat-card-header>
|
40 |
|
41 |
<mat-card-content>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
<form (ngSubmit)="save()" #envForm="ngForm">
|
43 |
<mat-form-field appearance="outline" class="full-width">
|
44 |
<mat-label>Work Mode</mat-label>
|
@@ -94,22 +107,10 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
94 |
>
|
95 |
<mat-icon>wifi_tethering</mat-icon>
|
96 |
</button>
|
97 |
-
|
|
|
|
|
98 |
</mat-form-field>
|
99 |
-
|
100 |
-
// GPT mode için bilgi alert'i ekle (mat-card-content içine, form'dan önce)
|
101 |
-
@if (isGPTMode()) {
|
102 |
-
<mat-card class="info-card">
|
103 |
-
<mat-card-content>
|
104 |
-
<mat-icon>info</mat-icon>
|
105 |
-
<div>
|
106 |
-
<strong>{{ environment.work_mode === 'gpt4o' ? 'GPT-4o' : 'GPT-4o Mini' }} Mode</strong>
|
107 |
-
<p>This mode uses OpenAI's API which has usage-based pricing.</p>
|
108 |
-
<p>Approximate cost: {{ environment.work_mode === 'gpt4o' ? '$0.01-0.03' : '$0.001-0.003' }} per conversation turn.</p>
|
109 |
-
</div>
|
110 |
-
</mat-card-content>
|
111 |
-
</mat-card>
|
112 |
-
}
|
113 |
|
114 |
<mat-expansion-panel class="prompt-panel">
|
115 |
<mat-expansion-panel-header>
|
@@ -118,7 +119,7 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
118 |
Internal System Prompt
|
119 |
</mat-panel-title>
|
120 |
<mat-panel-description>
|
121 |
-
Advanced configuration for
|
122 |
</mat-panel-description>
|
123 |
</mat-expansion-panel-header>
|
124 |
|
@@ -130,7 +131,7 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
130 |
[(ngModel)]="environment.internal_prompt"
|
131 |
[disabled]="loading"
|
132 |
rows="10"
|
133 |
-
placeholder="Enter internal system prompt
|
134 |
></textarea>
|
135 |
<mat-hint>This prompt will be prepended to all project prompts</mat-hint>
|
136 |
</mat-form-field>
|
@@ -156,7 +157,7 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
156 |
mat-raised-button
|
157 |
type="button"
|
158 |
(click)="reloadFromSpark()"
|
159 |
-
[disabled]="loading"
|
160 |
>
|
161 |
<mat-icon>refresh</mat-icon>
|
162 |
Reload from Spark
|
@@ -190,6 +191,27 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
190 |
}
|
191 |
}
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
.full-width {
|
194 |
width: 100%;
|
195 |
margin-bottom: 20px;
|
@@ -229,27 +251,6 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
229 |
}
|
230 |
}
|
231 |
|
232 |
-
.info-card {
|
233 |
-
margin-bottom: 20px;
|
234 |
-
background-color: #e3f2fd;
|
235 |
-
|
236 |
-
mat-card-content {
|
237 |
-
display: flex;
|
238 |
-
gap: 16px;
|
239 |
-
align-items: flex-start;
|
240 |
-
|
241 |
-
mat-icon {
|
242 |
-
color: #1976d2;
|
243 |
-
margin-top: 4px;
|
244 |
-
}
|
245 |
-
|
246 |
-
p {
|
247 |
-
margin: 4px 0;
|
248 |
-
font-size: 14px;
|
249 |
-
}
|
250 |
-
}
|
251 |
-
}
|
252 |
-
|
253 |
::ng-deep {
|
254 |
.mat-mdc-form-field-icon-prefix {
|
255 |
padding-right: 12px;
|
@@ -300,12 +301,6 @@ export class EnvironmentComponent implements OnInit {
|
|
300 |
});
|
301 |
}
|
302 |
|
303 |
-
onWorkModeChange() {
|
304 |
-
if (this.environment.work_mode === 'on-premise') {
|
305 |
-
this.environment.cloud_token = '';
|
306 |
-
}
|
307 |
-
}
|
308 |
-
|
309 |
getTokenLabel(): string {
|
310 |
switch(this.environment.work_mode) {
|
311 |
case 'gpt4o':
|
@@ -318,7 +313,7 @@ export class EnvironmentComponent implements OnInit {
|
|
318 |
return 'Cloud Token';
|
319 |
}
|
320 |
}
|
321 |
-
|
322 |
getTokenPlaceholder(): string {
|
323 |
switch(this.environment.work_mode) {
|
324 |
case 'gpt4o':
|
@@ -331,11 +326,17 @@ export class EnvironmentComponent implements OnInit {
|
|
331 |
return 'Enter cloud token';
|
332 |
}
|
333 |
}
|
334 |
-
|
335 |
isGPTMode(): boolean {
|
336 |
return this.environment.work_mode === 'gpt4o' || this.environment.work_mode === 'gpt4o-mini';
|
337 |
}
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
save() {
|
340 |
this.saving = true;
|
341 |
|
@@ -371,6 +372,10 @@ export class EnvironmentComponent implements OnInit {
|
|
371 |
}
|
372 |
|
373 |
reloadFromSpark() {
|
|
|
|
|
|
|
|
|
374 |
this.snackBar.open('Reloading configuration from Spark...', undefined, {
|
375 |
duration: 2000
|
376 |
});
|
|
|
39 |
</mat-card-header>
|
40 |
|
41 |
<mat-card-content>
|
42 |
+
@if (isGPTMode()) {
|
43 |
+
<mat-card class="info-card">
|
44 |
+
<mat-card-content>
|
45 |
+
<mat-icon>info</mat-icon>
|
46 |
+
<div>
|
47 |
+
<strong>{{ environment.work_mode === 'gpt4o' ? 'GPT-4o' : 'GPT-4o Mini' }} Mode</strong>
|
48 |
+
<p>This mode uses OpenAI's API which has usage-based pricing.</p>
|
49 |
+
<p>Approximate cost: {{ environment.work_mode === 'gpt4o' ? '$0.01-0.03' : '$0.001-0.003' }} per conversation turn.</p>
|
50 |
+
</div>
|
51 |
+
</mat-card-content>
|
52 |
+
</mat-card>
|
53 |
+
}
|
54 |
+
|
55 |
<form (ngSubmit)="save()" #envForm="ngForm">
|
56 |
<mat-form-field appearance="outline" class="full-width">
|
57 |
<mat-label>Work Mode</mat-label>
|
|
|
107 |
>
|
108 |
<mat-icon>wifi_tethering</mat-icon>
|
109 |
</button>
|
110 |
+
@if (isGPTMode()) {
|
111 |
+
<mat-hint>Not required for GPT mode</mat-hint>
|
112 |
+
}
|
113 |
</mat-form-field>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
<mat-expansion-panel class="prompt-panel">
|
116 |
<mat-expansion-panel-header>
|
|
|
119 |
Internal System Prompt
|
120 |
</mat-panel-title>
|
121 |
<mat-panel-description>
|
122 |
+
Advanced configuration for LLM
|
123 |
</mat-panel-description>
|
124 |
</mat-expansion-panel-header>
|
125 |
|
|
|
131 |
[(ngModel)]="environment.internal_prompt"
|
132 |
[disabled]="loading"
|
133 |
rows="10"
|
134 |
+
placeholder="Enter internal system prompt..."
|
135 |
></textarea>
|
136 |
<mat-hint>This prompt will be prepended to all project prompts</mat-hint>
|
137 |
</mat-form-field>
|
|
|
157 |
mat-raised-button
|
158 |
type="button"
|
159 |
(click)="reloadFromSpark()"
|
160 |
+
[disabled]="loading || isGPTMode()"
|
161 |
>
|
162 |
<mat-icon>refresh</mat-icon>
|
163 |
Reload from Spark
|
|
|
191 |
}
|
192 |
}
|
193 |
|
194 |
+
.info-card {
|
195 |
+
margin-bottom: 20px;
|
196 |
+
background-color: #e3f2fd;
|
197 |
+
|
198 |
+
mat-card-content {
|
199 |
+
display: flex;
|
200 |
+
gap: 16px;
|
201 |
+
align-items: flex-start;
|
202 |
+
|
203 |
+
mat-icon {
|
204 |
+
color: #1976d2;
|
205 |
+
margin-top: 4px;
|
206 |
+
}
|
207 |
+
|
208 |
+
p {
|
209 |
+
margin: 4px 0;
|
210 |
+
font-size: 14px;
|
211 |
+
}
|
212 |
+
}
|
213 |
+
}
|
214 |
+
|
215 |
.full-width {
|
216 |
width: 100%;
|
217 |
margin-bottom: 20px;
|
|
|
251 |
}
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
::ng-deep {
|
255 |
.mat-mdc-form-field-icon-prefix {
|
256 |
padding-right: 12px;
|
|
|
301 |
});
|
302 |
}
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
getTokenLabel(): string {
|
305 |
switch(this.environment.work_mode) {
|
306 |
case 'gpt4o':
|
|
|
313 |
return 'Cloud Token';
|
314 |
}
|
315 |
}
|
316 |
+
|
317 |
getTokenPlaceholder(): string {
|
318 |
switch(this.environment.work_mode) {
|
319 |
case 'gpt4o':
|
|
|
326 |
return 'Enter cloud token';
|
327 |
}
|
328 |
}
|
329 |
+
|
330 |
isGPTMode(): boolean {
|
331 |
return this.environment.work_mode === 'gpt4o' || this.environment.work_mode === 'gpt4o-mini';
|
332 |
}
|
333 |
+
|
334 |
+
onWorkModeChange() {
|
335 |
+
if (this.environment.work_mode === 'on-premise') {
|
336 |
+
this.environment.cloud_token = '';
|
337 |
+
}
|
338 |
+
}
|
339 |
+
|
340 |
save() {
|
341 |
this.saving = true;
|
342 |
|
|
|
372 |
}
|
373 |
|
374 |
reloadFromSpark() {
|
375 |
+
if (this.isGPTMode()) {
|
376 |
+
return;
|
377 |
+
}
|
378 |
+
|
379 |
this.snackBar.open('Reloading configuration from Spark...', undefined, {
|
380 |
duration: 2000
|
381 |
});
|