11import { 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" ;
103import { ModelDescription } from "core" ;
114import {
125 SharedConfigSchema ,
136 modifyAnyConfigWithSharedConfig ,
147} from "core/config/sharedConfig" ;
15- import { Fragment , useContext , useEffect , useState } from "react" ;
8+ import { useContext , useEffect , useState } from "react" ;
169import { useNavigate } from "react-router-dom" ;
1710import { Input } from "../../components" ;
1811import NumberInput from "../../components/gui/NumberInput" ;
1912import { Select } from "../../components/gui/Select" ;
2013import ToggleSwitch from "../../components/gui/Switch" ;
21- import AssistantIcon from "../../components/modelSelection/platform/AssistantIcon" ;
2214import PageHeader from "../../components/PageHeader" ;
2315import { useAuth } from "../../context/Auth" ;
2416import { IdeMessengerContext } from "../../context/IdeMessenger" ;
@@ -29,31 +21,18 @@ import {
2921 setDefaultModel ,
3022 updateConfig ,
3123} from "../../redux/slices/configSlice" ;
32- import { selectProfileThunk } from "../../redux/thunks/profileAndOrg" ;
3324import { getFontSize , isJetBrains } from "../../util" ;
3425import { AccountButton } from "./AccountButton" ;
26+ import { AccountManagement } from "./AccountManagement" ;
3527import ModelRoleSelector from "./ModelRoleSelector" ;
36- import { ScopeSelect } from "./ScopeSelect" ;
3728
3829function ConfigPage ( ) {
3930 useNavigationListener ( ) ;
4031 const dispatch = useAppDispatch ( ) ;
4132 const navigate = useNavigate ( ) ;
4233 const ideMessenger = useContext ( IdeMessengerContext ) ;
4334
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 ( ) ;
5736
5837 const [ hubEnabled , setHubEnabled ] = useState ( false ) ;
5938 useEffect ( ( ) => {
@@ -62,15 +41,6 @@ function ConfigPage() {
6241 } ) ;
6342 } , [ ideMessenger ] ) ;
6443
65- function handleOpenConfig ( ) {
66- if ( ! selectedProfile ) {
67- return ;
68- }
69- ideMessenger . post ( "config/openProfile" , {
70- profileId : selectedProfile . id ,
71- } ) ;
72- }
73-
7444 // NOTE Hub takes priority over Continue for Teams
7545 // Since teams will be moving to hub, not vice versa
7646
@@ -161,23 +131,6 @@ function ConfigPage() {
161131 setFormDisableAutocomplete ( disableAutocompleteInFiles ) ;
162132 } , [ disableAutocompleteInFiles ] ) ;
163133
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-
181134 const jetbrains = isJetBrains ( ) ;
182135
183136 return (
@@ -190,123 +143,7 @@ function ConfigPage() {
190143 />
191144
192145 < 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 } />
310147
311148 { /* Model Roles as a separate section */ }
312149 < div className = "flex flex-col" >
0 commit comments