(endpoint: string, body: any)
| 387 | } |
| 388 | |
| 389 | private async createRequest<T>(endpoint: string, body: any): Promise<T> { |
| 390 | const isProdEnv = this.prod; |
| 391 | const prodOptions = { |
| 392 | endpoint, |
| 393 | body: { |
| 394 | ...body, |
| 395 | name: this.pipe.name, |
| 396 | }, |
| 397 | }; |
| 398 | |
| 399 | let localOptions = {} as any; |
| 400 | |
| 401 | if (!isProdEnv) { |
| 402 | const providerString = this.pipe.model.split(':')[0]; |
| 403 | const modelProvider = getProvider(providerString); |
| 404 | localOptions = { |
| 405 | endpoint, |
| 406 | body: { |
| 407 | ...body, |
| 408 | pipe: this.pipe, |
| 409 | llmApiKey: getLLMApiKey(modelProvider), |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | const isServerRunning = await isLocalServerRunning(); |
| 414 | if (!isServerRunning) return {} as T; |
| 415 | } |
| 416 | |
| 417 | return this.request.post<T>(isProdEnv ? prodOptions : localOptions); |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /** |
nothing calls this directly
no test coverage detected