1
1
import { ModelRole } from "@continuedev/config-yaml" ;
2
- import { Listbox , Transition } from "@headlessui/react" ;
3
- import {
4
- ArrowTopRightOnSquareIcon ,
5
- CheckIcon ,
6
- ChevronUpDownIcon ,
7
- PlusCircleIcon ,
8
- XMarkIcon ,
9
- } from "@heroicons/react/24/outline" ;
2
+ import { CheckIcon , XMarkIcon } from "@heroicons/react/24/outline" ;
10
3
import { ModelDescription } from "core" ;
11
4
import {
12
5
SharedConfigSchema ,
13
6
modifyAnyConfigWithSharedConfig ,
14
7
} from "core/config/sharedConfig" ;
15
- import { Fragment , useContext , useEffect , useState } from "react" ;
8
+ import { useContext , useEffect , useState } from "react" ;
16
9
import { useNavigate } from "react-router-dom" ;
17
10
import { Input } from "../../components" ;
18
11
import NumberInput from "../../components/gui/NumberInput" ;
19
12
import { Select } from "../../components/gui/Select" ;
20
13
import ToggleSwitch from "../../components/gui/Switch" ;
21
- import AssistantIcon from "../../components/modelSelection/platform/AssistantIcon" ;
22
14
import PageHeader from "../../components/PageHeader" ;
23
15
import { useAuth } from "../../context/Auth" ;
24
16
import { IdeMessengerContext } from "../../context/IdeMessenger" ;
@@ -29,31 +21,18 @@ import {
29
21
setDefaultModel ,
30
22
updateConfig ,
31
23
} from "../../redux/slices/configSlice" ;
32
- import { selectProfileThunk } from "../../redux/thunks/profileAndOrg" ;
33
24
import { getFontSize , isJetBrains } from "../../util" ;
34
25
import { AccountButton } from "./AccountButton" ;
26
+ import { AccountManagement } from "./AccountManagement" ;
35
27
import ModelRoleSelector from "./ModelRoleSelector" ;
36
- import { ScopeSelect } from "./ScopeSelect" ;
37
28
38
29
function ConfigPage ( ) {
39
30
useNavigationListener ( ) ;
40
31
const dispatch = useAppDispatch ( ) ;
41
32
const navigate = useNavigate ( ) ;
42
33
const ideMessenger = useContext ( IdeMessengerContext ) ;
43
34
44
- const {
45
- session,
46
- logout,
47
- login,
48
- profiles,
49
- selectedProfile,
50
- controlServerBetaEnabled,
51
- selectedOrganization,
52
- } = useAuth ( ) ;
53
-
54
- const changeProfileId = ( id : string ) => {
55
- dispatch ( selectProfileThunk ( id ) ) ;
56
- } ;
35
+ const { selectedProfile, controlServerBetaEnabled } = useAuth ( ) ;
57
36
58
37
const [ hubEnabled , setHubEnabled ] = useState ( false ) ;
59
38
useEffect ( ( ) => {
@@ -62,15 +41,6 @@ function ConfigPage() {
62
41
} ) ;
63
42
} , [ ideMessenger ] ) ;
64
43
65
- function handleOpenConfig ( ) {
66
- if ( ! selectedProfile ) {
67
- return ;
68
- }
69
- ideMessenger . post ( "config/openProfile" , {
70
- profileId : selectedProfile . id ,
71
- } ) ;
72
- }
73
-
74
44
// NOTE Hub takes priority over Continue for Teams
75
45
// Since teams will be moving to hub, not vice versa
76
46
@@ -161,23 +131,6 @@ function ConfigPage() {
161
131
setFormDisableAutocomplete ( disableAutocompleteInFiles ) ;
162
132
} , [ disableAutocompleteInFiles ] ) ;
163
133
164
- // Workspace prompts
165
- const promptPath = config . experimental ?. promptPath || "" ;
166
- const [ formPromptPath , setFormPromptPath ] = useState ( promptPath ) ;
167
- const cancelChangePromptPath = ( ) => {
168
- setFormPromptPath ( promptPath ) ;
169
- } ;
170
- const handleSubmitPromptPath = ( ) => {
171
- handleUpdate ( {
172
- promptPath : formPromptPath || "" ,
173
- } ) ;
174
- } ;
175
-
176
- useEffect ( ( ) => {
177
- // Necessary so that reformatted/trimmed values don't cause dirty state
178
- setFormPromptPath ( promptPath ) ;
179
- } , [ promptPath ] ) ;
180
-
181
134
const jetbrains = isJetBrains ( ) ;
182
135
183
136
return (
@@ -190,123 +143,7 @@ function ConfigPage() {
190
143
/>
191
144
192
145
< div className = "divide-x-0 divide-y-2 divide-solid divide-zinc-700 px-4" >
193
- < div className = "flex flex-col" >
194
- < div className = "flex max-w-[400px] flex-col gap-4 py-6" >
195
- < h2 className = "mb-1 mt-0" > Configuration</ h2 >
196
- { hubEnabled ? (
197
- // Hub: show org selector
198
- session && (
199
- < div className = "flex flex-col gap-1.5" >
200
- < span className = "text-lightgray text-sm" > { `Organization` } </ span >
201
- < ScopeSelect />
202
- </ div >
203
- )
204
- ) : (
205
- // Continue for teams: show org text
206
- < div > You are using Continue for Teams</ div >
207
- ) }
208
-
209
- { profiles ? (
210
- < >
211
- < div className = "flex flex-col gap-1.5" >
212
- < div className = "flex items-center justify-between gap-1.5 text-sm" >
213
- < span className = "text-lightgray" > { `${ hubEnabled ? "Assistant" : "Profile" } ` } </ span >
214
- </ div >
215
- < Listbox
216
- value = { selectedProfile ?. id }
217
- onChange = { changeProfileId }
218
- >
219
- { ( { open } ) => (
220
- < div className = "relative w-full" >
221
- < Listbox . Button className = "border-vsc-input-border bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground relative m-0 flex w-full cursor-pointer items-center justify-between rounded-md border border-solid px-3 py-2 text-left" >
222
- < div className = "flex items-center gap-2" >
223
- { selectedProfile && (
224
- < AssistantIcon assistant = { selectedProfile } />
225
- ) }
226
- < span className = "lines lines-1" >
227
- { selectedProfile ?. title ??
228
- "No Assistant Selected" }
229
- </ span >
230
- </ div >
231
- < div className = "pointer-events-none flex items-center" >
232
- < ChevronUpDownIcon
233
- className = "h-5 w-5"
234
- aria-hidden = "true"
235
- />
236
- </ div >
237
- </ Listbox . Button >
238
-
239
- < Transition
240
- as = { Fragment }
241
- show = { open }
242
- enter = "transition ease-out duration-100"
243
- enterFrom = "transform opacity-0 scale-95"
244
- enterTo = "transform opacity-100 scale-100"
245
- leave = "transition ease-in duration-75"
246
- leaveFrom = "transform opacity-100 scale-100"
247
- leaveTo = "transform opacity-0 scale-95"
248
- >
249
- < Listbox . Options className = "bg-vsc-background max-h-80vh absolute z-50 mt-0.5 w-full overflow-y-scroll rounded-sm p-0" >
250
- { profiles . map ( ( option , idx ) => (
251
- < Listbox . Option
252
- key = { idx }
253
- value = { option . id }
254
- className = { `text-vsc-foreground hover:text-list-active-foreground flex cursor-pointer flex-row items-center gap-3 px-3 py-2 ${ selectedProfile ?. id === option . id ? "bg-list-active" : "bg-vsc-input-background" } ` }
255
- >
256
- < AssistantIcon assistant = { option } />
257
- < span className = "lines lines-1 relative flex h-5 items-center justify-between gap-3 pr-2 text-xs" >
258
- { option . title }
259
- </ span >
260
- </ Listbox . Option >
261
- ) ) }
262
- { hubEnabled && (
263
- < Listbox . Option
264
- key = { "no-profiles" }
265
- value = { null }
266
- className = { `text-vsc-foreground hover:bg-list-active bg-vsc-input-background flex cursor-pointer flex-row items-center gap-2 px-3 py-2` }
267
- onClick = { ( ) => {
268
- if ( session ) {
269
- ideMessenger . post ( "controlPlane/openUrl" , {
270
- path : "new" ,
271
- orgSlug : selectedOrganization ?. slug ,
272
- } ) ;
273
- } else {
274
- login ( false ) ;
275
- }
276
- } }
277
- >
278
- < PlusCircleIcon className = "h-4 w-4" />
279
- < span className = "lines lines-1 flex items-center justify-between text-xs" >
280
- Create new Assistant
281
- </ span >
282
- </ Listbox . Option >
283
- ) }
284
- </ Listbox . Options >
285
- </ Transition >
286
-
287
- { selectedProfile && (
288
- < div className = "mt-3 flex w-full justify-center" >
289
- < span
290
- className = "text-lightgray flex cursor-pointer items-center gap-1 hover:underline"
291
- onClick = { handleOpenConfig }
292
- >
293
- < ArrowTopRightOnSquareIcon className = "h-4 w-4" />
294
- { hubEnabled
295
- ? "Open Assistant configuration"
296
- : "View Workspace" }
297
- </ span >
298
- </ div >
299
- ) }
300
- </ div >
301
- ) }
302
- </ Listbox >
303
- </ div >
304
- </ >
305
- ) : (
306
- < div > Loading...</ div >
307
- ) }
308
- </ div >
309
- </ div >
146
+ < AccountManagement hubEnabled = { hubEnabled } />
310
147
311
148
{ /* Model Roles as a separate section */ }
312
149
< div className = "flex flex-col" >
0 commit comments