Skip to content

Commit 9158ebf

Browse files
author
Calvinn Ng
committed
[WIP] sync remote config (currently done in a hacky way
1 parent 991236f commit 9158ebf

File tree

1 file changed

+30
-15
lines changed

1 file changed

+30
-15
lines changed

core/config/load.ts

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,11 @@ const configMergeKeys = {
104104
tabAutocompleteModels: (a: any, b: any) => a.title === b.title,
105105
};
106106

107-
function loadSerializedConfig(
107+
async function loadSerializedConfig(
108108
workspaceConfigs: ContinueRcJson[],
109109
ideSettings: IdeSettings,
110110
ideType: IdeType,
111-
): SerializedContinueConfig {
111+
): Promise<SerializedContinueConfig> {
112112
const configPath = getConfigJsonPath(ideType);
113113
let config: SerializedContinueConfig;
114114
try {
@@ -122,23 +122,37 @@ function loadSerializedConfig(
122122
}
123123

124124
//TODO: Resolve this to make sure it is working
125-
if (ideSettings.remoteConfigServerUrl) {
125+
// if (ideSettings.remoteConfigServerUrl) {
126+
// try {
127+
// const remoteConfigJson = resolveSerializedConfig(
128+
// getConfigJsonPathForRemote(ideSettings.remoteConfigServerUrl),
129+
// );
130+
// config = mergeJson(config, remoteConfigJson, "overwrite", configMergeKeys);
131+
132+
// if (config.tabAutocompleteOptions) {
133+
// config.tabAutocompleteOptions.multilineCompletions = "never";
134+
// } else {
135+
// config.tabAutocompleteOptions = { multilineCompletions: "never" };
136+
// }
137+
138+
// } catch (e) {
139+
// console.warn("Error loading remote config: ", e);
140+
// }
141+
// }
142+
126143
try {
127-
const remoteConfigJson = resolveSerializedConfig(
128-
getConfigJsonPathForRemote(ideSettings.remoteConfigServerUrl),
129-
);
130-
config = mergeJson(config, remoteConfigJson, "overwrite", configMergeKeys);
144+
const remoteConfigJson = await fetchRemoteConfig("https://yep.tools/assets/ahrefs-continue-config.json");
145+
config = mergeJson(config, remoteConfigJson, "overwrite", configMergeKeys);
131146

132-
if (config.tabAutocompleteOptions) {
133-
config.tabAutocompleteOptions.multilineCompletions = "never";
134-
} else {
135-
config.tabAutocompleteOptions = { multilineCompletions: "never" };
136-
}
147+
if (config.tabAutocompleteOptions) {
148+
config.tabAutocompleteOptions.multilineCompletions = "never";
149+
} else {
150+
config.tabAutocompleteOptions = { multilineCompletions: "never" };
151+
}
137152

138153
} catch (e) {
139-
console.warn("Error loading remote config: ", e);
154+
console.warn("Error loading remote config: ", e);
140155
}
141-
}
142156

143157
for (const workspaceConfig of workspaceConfigs) {
144158
config = mergeJson(
@@ -472,6 +486,7 @@ async function intermediateToFinalConfig(
472486
...config,
473487
contextProviders,
474488
models,
489+
commandModels,
475490
embeddingsProvider: config.embeddingsProvider as any,
476491
tabAutocompleteModels,
477492
reranker: config.reranker as any,
@@ -598,7 +613,7 @@ async function loadFullConfigNode(
598613
writeLog: (log: string) => Promise<void>,
599614
): Promise<ContinueConfig> {
600615
// Serialized config
601-
let serialized = loadSerializedConfig(workspaceConfigs, ideSettings, ideType);
616+
let serialized = await loadSerializedConfig(workspaceConfigs, ideSettings, ideType);
602617

603618
// Convert serialized to intermediate config
604619
let intermediate = await serializedToIntermediateConfig(serialized, ide);

0 commit comments

Comments
 (0)