| 1 | import { DynamicModule, Module } from '@nestjs/common' |
| 2 | import { AitoearnAiClientConfig } from './aitoearn-ai-client.config' |
| 3 | import { AitoearnAiClientService } from './aitoearn-ai-client.service' |
| 4 | import { AiService } from './clients/ai.service' |
| 5 | |
| 6 | @Module({}) |
| 7 | export class AitoearnAiClientModule { |
| 8 | static forRoot(options: AitoearnAiClientConfig): DynamicModule { |
| 9 | return { |
| 10 | global: true, |
| 11 | module: AitoearnAiClientModule, |
| 12 | providers: [ |
| 13 | { |
| 14 | provide: AitoearnAiClientConfig, |
| 15 | useValue: options, |
| 16 | }, |
| 17 | AiService, |
| 18 | AitoearnAiClientService, |
| 19 | ], |
| 20 | exports: [AitoearnAiClientService, AiService], |
| 21 | } |
| 22 | } |
| 23 | } |
| 24 |