Skip to content

Commit 73eef02

Browse files
committed
fixup: move check back to after atlas metadata since the hello happens before connecting, remove extra check
1 parent 14e77f8 commit 73eef02

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

packages/compass-generative-ai/src/atlas-ai-service.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,6 @@ export class AtlasAiService {
239239
connectionInfo?: ConnectionInfo
240240
) {
241241
if (this.apiURLPreset === 'cloud') {
242-
const atlasMetadata = connectionInfo?.atlasMetadata;
243-
if (!atlasMetadata) {
244-
throw new Error(
245-
"Can't perform generative ai request: atlasMetadata is not available"
246-
);
247-
}
248-
249242
if (urlId === 'user-access') {
250243
return this.atlasService.cloudEndpoint(
251244
aiURLConfig[this.apiURLPreset][urlId](
@@ -254,6 +247,13 @@ export class AtlasAiService {
254247
);
255248
}
256249

250+
const atlasMetadata = connectionInfo?.atlasMetadata;
251+
if (!atlasMetadata) {
252+
throw new Error(
253+
"Can't perform generative ai request: atlasMetadata is not available"
254+
);
255+
}
256+
257257
return this.atlasService.cloudEndpoint(
258258
aiURLConfig[this.apiURLPreset][urlId](atlasMetadata.projectId)
259259
);
@@ -264,9 +264,7 @@ export class AtlasAiService {
264264
? urlConfig(this.preferences.getPreferencesUser().id)
265265
: urlConfig;
266266

267-
return this.apiURLPreset === 'admin-api'
268-
? this.atlasService.adminApiEndpoint(urlPath)
269-
: this.atlasService.cloudEndpoint(urlPath);
267+
return this.atlasService.adminApiEndpoint(urlPath);
270268
}
271269

272270
private throwIfAINotEnabled() {

0 commit comments

Comments
 (0)