1
- import * as fs from "node:fs" ;
2
-
3
1
import { ConfigResult , FullSlug } from "@continuedev/config-yaml" ;
4
2
5
3
import {
@@ -17,8 +15,6 @@ import {
17
15
} from "../index.js" ;
18
16
import Ollama from "../llm/llms/Ollama.js" ;
19
17
import { GlobalContext } from "../util/GlobalContext.js" ;
20
- import { getConfigJsonPath , getConfigYamlPath } from "../util/paths.js" ;
21
- import { localPathToUri } from "../util/pathToUri.js" ;
22
18
23
19
import { getAllAssistantFiles } from "./getSystemPromptDotFile.js" ;
24
20
import {
@@ -98,7 +94,7 @@ export class ConfigHandler {
98
94
this . ideSettingsPromise ,
99
95
this . controlPlaneClient ,
100
96
this . writeLog ,
101
- assistant . path ,
97
+ assistant ,
102
98
) ;
103
99
} ) ;
104
100
return profiles . map (
@@ -162,14 +158,12 @@ export class ConfigHandler {
162
158
163
159
async openConfigProfile ( profileId ?: string ) {
164
160
let openProfileId = profileId || this . selectedProfileId ;
165
- if ( openProfileId === "local" ) {
161
+ const profile = this . profiles ?. find (
162
+ ( p ) => p . profileDescription . id === openProfileId ,
163
+ ) ;
164
+ if ( profile ?. profileDescription . profileType === "local" ) {
166
165
const ideInfo = await this . ide . getIdeInfo ( ) ;
167
- const configYamlPath = getConfigYamlPath ( ideInfo . ideType ) ;
168
- if ( fs . existsSync ( configYamlPath ) ) {
169
- await this . ide . openFile ( localPathToUri ( configYamlPath ) ) ;
170
- } else {
171
- await this . ide . openFile ( localPathToUri ( getConfigJsonPath ( ) ) ) ;
172
- }
166
+ await this . ide . openFile ( profile . profileDescription . uri ) ;
173
167
} else {
174
168
const env = await getControlPlaneEnv ( this . ide . getIdeSettings ( ) ) ;
175
169
await this . ide . openUrl ( `${ env . APP_URL } ${ openProfileId } ` ) ;
@@ -194,25 +188,27 @@ export class ConfigHandler {
194
188
const assistants =
195
189
await this . controlPlaneClient . listAssistants ( selectedOrgId ) ;
196
190
197
- const hubProfiles = assistants . map ( ( assistant ) => {
198
- const profileLoader = new PlatformProfileLoader (
199
- {
200
- ...assistant . configResult ,
201
- config : assistant . configResult . config ,
202
- } ,
203
- assistant . ownerSlug ,
204
- assistant . packageSlug ,
205
- assistant . iconUrl ,
206
- assistant . configResult . config ?. version ?? "latest" ,
207
- this . controlPlaneClient ,
208
- this . ide ,
209
- this . ideSettingsPromise ,
210
- this . writeLog ,
211
- this . reloadConfig . bind ( this ) ,
212
- ) ;
213
-
214
- return new ProfileLifecycleManager ( profileLoader , this . ide ) ;
215
- } ) ;
191
+ const hubProfiles = await Promise . all (
192
+ assistants . map ( async ( assistant ) => {
193
+ const profileLoader = await PlatformProfileLoader . create (
194
+ {
195
+ ...assistant . configResult ,
196
+ config : assistant . configResult . config ,
197
+ } ,
198
+ assistant . ownerSlug ,
199
+ assistant . packageSlug ,
200
+ assistant . iconUrl ,
201
+ assistant . configResult . config ?. version ?? "latest" ,
202
+ this . controlPlaneClient ,
203
+ this . ide ,
204
+ this . ideSettingsPromise ,
205
+ this . writeLog ,
206
+ this . reloadConfig . bind ( this ) ,
207
+ ) ;
208
+
209
+ return new ProfileLifecycleManager ( profileLoader , this . ide ) ;
210
+ } ) ,
211
+ ) ;
216
212
217
213
if ( selectedOrgId === null ) {
218
214
// Personal
0 commit comments