Spaces:
Building
Building
Update flare-ui/src/app/components/main/main.component.ts
Browse files
flare-ui/src/app/components/main/main.component.ts
CHANGED
@@ -11,6 +11,7 @@ import { MatDividerModule } from '@angular/material/divider';
|
|
11 |
import { AuthService } from '../../services/auth.service';
|
12 |
import { ActivityLogComponent } from '../activity-log/activity-log.component';
|
13 |
import { ApiService } from '../../services/api.service';
|
|
|
14 |
|
15 |
@Component({
|
16 |
selector: 'app-main',
|
@@ -234,20 +235,34 @@ import { ApiService } from '../../services/api.service';
|
|
234 |
export class MainComponent {
|
235 |
private authService = inject(AuthService);
|
236 |
private apiService = inject(ApiService);
|
|
|
237 |
|
238 |
username = this.authService.getUsername() || '';
|
239 |
showActivityLog = false;
|
240 |
isGPTMode = false;
|
241 |
|
|
|
|
|
242 |
ngOnInit() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
// Environment bilgisini al
|
244 |
this.loadEnvironment();
|
245 |
}
|
246 |
|
|
|
|
|
|
|
|
|
247 |
private loadEnvironment() {
|
248 |
this.apiService.getEnvironment().subscribe({
|
249 |
next: (env) => {
|
250 |
-
this.
|
251 |
},
|
252 |
error: (err) => {
|
253 |
console.error('Failed to load environment:', err);
|
|
|
11 |
import { AuthService } from '../../services/auth.service';
|
12 |
import { ActivityLogComponent } from '../activity-log/activity-log.component';
|
13 |
import { ApiService } from '../../services/api.service';
|
14 |
+
import { EnvironmentService } from '../../services/environment.service';
|
15 |
|
16 |
@Component({
|
17 |
selector: 'app-main',
|
|
|
235 |
export class MainComponent {
|
236 |
private authService = inject(AuthService);
|
237 |
private apiService = inject(ApiService);
|
238 |
+
private environmentService = inject(EnvironmentService);
|
239 |
|
240 |
username = this.authService.getUsername() || '';
|
241 |
showActivityLog = false;
|
242 |
isGPTMode = false;
|
243 |
|
244 |
+
private subscription?: Subscription;
|
245 |
+
|
246 |
ngOnInit() {
|
247 |
+
// Environment değişikliklerini dinle
|
248 |
+
this.subscription = this.environmentService.environment$.subscribe(env => {
|
249 |
+
if (env) {
|
250 |
+
this.isGPTMode = env.work_mode?.startsWith('gpt4o') || false;
|
251 |
+
}
|
252 |
+
});
|
253 |
+
|
254 |
// Environment bilgisini al
|
255 |
this.loadEnvironment();
|
256 |
}
|
257 |
|
258 |
+
ngOnDestroy() {
|
259 |
+
this.subscription?.unsubscribe();
|
260 |
+
}
|
261 |
+
|
262 |
private loadEnvironment() {
|
263 |
this.apiService.getEnvironment().subscribe({
|
264 |
next: (env) => {
|
265 |
+
this.environmentService.updateEnvironment(env);
|
266 |
},
|
267 |
error: (err) => {
|
268 |
console.error('Failed to load environment:', err);
|