Skip to content

Commit 6a97cd2

Browse files
committed
👌 IMPROVE: Code
1 parent 11b9472 commit 6a97cd2

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

‎packages/core/src/pipes/pipes.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -339,25 +339,28 @@ export class Pipe {
339339
}
340340

341341
private async createRequest<T>(endpoint: string, body: any): Promise<T> {
342+
const isProdEnv = this.prod;
342343
const prodOptions = {
343344
endpoint,
344345
body: {
345346
...body,
346347
name: this.pipe.name,
347348
},
348349
};
349-
const providerString = this.pipe.model.split(':')[0];
350-
const modelProvider = getProvider(providerString);
351-
const localOptions = {
352-
endpoint,
353-
body: {
354-
...body,
355-
pipe: this.pipe,
356-
llmApiKey: getLLMApiKey(modelProvider),
357-
},
358-
};
359350

360-
const isProdEnv = this.prod;
351+
let localOptions = {} as any;
352+
if (!isProdEnv) {
353+
const providerString = this.pipe.model.split(':')[0];
354+
const modelProvider = getProvider(providerString);
355+
localOptions = {
356+
endpoint,
357+
body: {
358+
...body,
359+
pipe: this.pipe,
360+
llmApiKey: getLLMApiKey(modelProvider),
361+
},
362+
};
363+
}
361364

362365
if (!isProdEnv) {
363366
const isServerRunning = await isLocalServerRunning();

0 commit comments

Comments
 (0)