Spaces:
Building
Building
Create environment.service.ts
Browse files
flare-ui/src/app/services/environment.service.ts
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import { Injectable } from '@angular/core';
|
2 |
+
import { BehaviorSubject, Observable } from 'rxjs';
|
3 |
+
import { Environment } from './api.service';
|
4 |
+
|
5 |
+
@Injectable({
|
6 |
+
providedIn: 'root'
|
7 |
+
})
|
8 |
+
export class EnvironmentService {
|
9 |
+
private environmentSubject = new BehaviorSubject<Environment | null>(null);
|
10 |
+
public environment$ = this.environmentSubject.asObservable();
|
11 |
+
|
12 |
+
updateEnvironment(env: Environment) {
|
13 |
+
this.environmentSubject.next(env);
|
14 |
+
}
|
15 |
+
|
16 |
+
getEnvironment(): Environment | null {
|
17 |
+
return this.environmentSubject.value;
|
18 |
+
}
|
19 |
+
|
20 |
+
isGPTMode(): boolean {
|
21 |
+
const env = this.environmentSubject.value;
|
22 |
+
return env?.work_mode?.startsWith('gpt4o') || false;
|
23 |
+
}
|
24 |
+
}
|