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
@@ -29,123 +29,127 @@ import { ApiService, Environment } from '../../services/api.service';
|
|
29 |
MatExpansionModule
|
30 |
],
|
31 |
template: `
|
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 |
<mat-form-field appearance="outline" class="full-width">
|
74 |
-
<mat-label>
|
75 |
-
<
|
76 |
matInput
|
77 |
-
|
78 |
-
|
79 |
-
[(ngModel)]="environment.spark_endpoint"
|
80 |
-
required
|
81 |
[disabled]="loading"
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
<
|
86 |
-
mat-icon-button
|
87 |
-
matSuffix
|
88 |
-
type="button"
|
89 |
-
(click)="testConnection()"
|
90 |
-
[disabled]="loading || !environment.spark_endpoint"
|
91 |
-
matTooltip="Test Connection"
|
92 |
-
>
|
93 |
-
<mat-icon>wifi_tethering</mat-icon>
|
94 |
-
</button>
|
95 |
</mat-form-field>
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
<mat-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
<mat-spinner diameter="20" *ngIf="saving"></mat-spinner>
|
130 |
-
<mat-icon *ngIf="!saving">save</mat-icon>
|
131 |
-
{{ saving ? 'Saving...' : 'Save' }}
|
132 |
-
</button>
|
133 |
-
|
134 |
-
<button
|
135 |
-
mat-raised-button
|
136 |
-
type="button"
|
137 |
-
(click)="reloadFromSpark()"
|
138 |
-
[disabled]="loading"
|
139 |
-
>
|
140 |
-
<mat-icon>refresh</mat-icon>
|
141 |
-
Reload from Spark
|
142 |
-
</button>
|
143 |
-
</div>
|
144 |
-
</form>
|
145 |
-
</mat-card-content>
|
146 |
-
</mat-card>
|
147 |
-
</div>
|
148 |
-
`,
|
149 |
styles: [`
|
150 |
.environment-container {
|
151 |
max-width: 800px;
|
|
|
29 |
MatExpansionModule
|
30 |
],
|
31 |
template: `
|
32 |
+
<div class="environment-container">
|
33 |
+
<mat-card>
|
34 |
+
<mat-card-header>
|
35 |
+
<mat-card-title>
|
36 |
+
<mat-icon>settings</mat-icon>
|
37 |
+
Environment Configuration
|
38 |
+
</mat-card-title>
|
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>
|
45 |
+
<mat-select
|
46 |
+
name="workMode"
|
47 |
+
[(ngModel)]="environment.work_mode"
|
48 |
+
(selectionChange)="onWorkModeChange()"
|
49 |
+
required
|
50 |
+
[disabled]="loading"
|
51 |
+
>
|
52 |
+
<mat-option value="hfcloud">HF Cloud</mat-option>
|
53 |
+
<mat-option value="cloud">Cloud</mat-option>
|
54 |
+
<mat-option value="on-premise">On-Premise</mat-option>
|
55 |
+
</mat-select>
|
56 |
+
<mat-icon matPrefix>cloud</mat-icon>
|
57 |
+
</mat-form-field>
|
58 |
+
|
59 |
+
<mat-form-field appearance="outline" class="full-width">
|
60 |
+
<mat-label>Cloud Token</mat-label>
|
61 |
+
<input
|
62 |
+
matInput
|
63 |
+
type="password"
|
64 |
+
name="cloudToken"
|
65 |
+
[(ngModel)]="environment.cloud_token"
|
66 |
+
[disabled]="loading || environment.work_mode === 'on-premise'"
|
67 |
+
placeholder="Enter cloud token"
|
68 |
+
>
|
69 |
+
<mat-icon matPrefix>vpn_key</mat-icon>
|
70 |
+
<mat-hint>Required for HF Cloud and Cloud modes</mat-hint>
|
71 |
+
</mat-form-field>
|
72 |
+
|
73 |
+
<mat-form-field appearance="outline" class="full-width">
|
74 |
+
<mat-label>Spark Endpoint</mat-label>
|
75 |
+
<input
|
76 |
+
matInput
|
77 |
+
type="url"
|
78 |
+
name="sparkEndpoint"
|
79 |
+
[(ngModel)]="environment.spark_endpoint"
|
80 |
+
required
|
81 |
+
[disabled]="loading"
|
82 |
+
placeholder="https://spark-service.example.com"
|
83 |
+
>
|
84 |
+
<mat-icon matPrefix>link</mat-icon>
|
85 |
+
<button
|
86 |
+
mat-icon-button
|
87 |
+
matSuffix
|
88 |
+
type="button"
|
89 |
+
(click)="testConnection()"
|
90 |
+
[disabled]="loading || !environment.spark_endpoint"
|
91 |
+
matTooltip="Test Connection"
|
92 |
+
>
|
93 |
+
<mat-icon>wifi_tethering</mat-icon>
|
94 |
+
</button>
|
95 |
+
</mat-form-field>
|
96 |
+
|
97 |
+
<mat-expansion-panel class="prompt-panel">
|
98 |
+
<mat-expansion-panel-header>
|
99 |
+
<mat-panel-title>
|
100 |
+
<mat-icon>psychology</mat-icon>
|
101 |
+
Internal System Prompt
|
102 |
+
</mat-panel-title>
|
103 |
+
<mat-panel-description>
|
104 |
+
Advanced configuration for Spark LLM
|
105 |
+
</mat-panel-description>
|
106 |
+
</mat-expansion-panel-header>
|
107 |
+
|
108 |
<mat-form-field appearance="outline" class="full-width">
|
109 |
+
<mat-label>Internal Prompt</mat-label>
|
110 |
+
<textarea
|
111 |
matInput
|
112 |
+
name="internalPrompt"
|
113 |
+
[(ngModel)]="environment.internal_prompt"
|
|
|
|
|
114 |
[disabled]="loading"
|
115 |
+
rows="10"
|
116 |
+
placeholder="Enter internal system prompt for Spark..."
|
117 |
+
></textarea>
|
118 |
+
<mat-hint>This prompt will be prepended to all project prompts</mat-hint>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
</mat-form-field>
|
120 |
+
</mat-expansion-panel>
|
121 |
+
|
122 |
+
<div class="form-actions">
|
123 |
+
<button
|
124 |
+
mat-raised-button
|
125 |
+
color="primary"
|
126 |
+
type="submit"
|
127 |
+
[disabled]="loading || !envForm.valid || saving"
|
128 |
+
>
|
129 |
+
@if (saving) {
|
130 |
+
<mat-spinner diameter="20"></mat-spinner>
|
131 |
+
Saving...
|
132 |
+
} @else {
|
133 |
+
<mat-icon>save</mat-icon>
|
134 |
+
Save
|
135 |
+
}
|
136 |
+
</button>
|
137 |
+
|
138 |
+
<button
|
139 |
+
mat-raised-button
|
140 |
+
type="button"
|
141 |
+
(click)="reloadFromSpark()"
|
142 |
+
[disabled]="loading"
|
143 |
+
>
|
144 |
+
<mat-icon>refresh</mat-icon>
|
145 |
+
Reload from Spark
|
146 |
+
</button>
|
147 |
+
</div>
|
148 |
+
</form>
|
149 |
+
</mat-card-content>
|
150 |
+
</mat-card>
|
151 |
+
</div>
|
152 |
+
`,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
styles: [`
|
154 |
.environment-container {
|
155 |
max-width: 800px;
|