feat(ai): 添加AI报告生成历史记录功能,支持每日生成限制和双API提供商

This commit is contained in:
richarjiang
2025-12-02 12:07:08 +08:00
parent 5b89a07751
commit 562c66a930
21 changed files with 942 additions and 2074 deletions

View File

@@ -1,10 +1,12 @@
import { Module } from "@nestjs/common";
import { APP_GUARD } from '@nestjs/core';
import { AppController } from "./app.controller";
import { AppService } from "./app.service";
import { DatabaseModule } from "./database/database.module";
import { UsersModule } from "./users/users.module";
import { ConfigModule } from '@nestjs/config';
import { ScheduleModule } from '@nestjs/schedule';
import { ThrottlerModule, ThrottlerGuard } from '@nestjs/throttler';
import { LoggerModule } from './common/logger/logger.module';
import { CheckinsModule } from './checkins/checkins.module';
import { AiCoachModule } from './ai-coach/ai-coach.module';
@@ -30,6 +32,10 @@ import { MedicationsModule } from './medications/medications.module';
envFilePath: '.env',
}),
ScheduleModule.forRoot(),
ThrottlerModule.forRoot([{
ttl: 60000, // 时间窗口60秒
limit: 100, // 每个时间窗口最多100个请求
}]),
LoggerModule,
DatabaseModule,
UsersModule,
@@ -51,6 +57,12 @@ import { MedicationsModule } from './medications/medications.module';
MedicationsModule,
],
controllers: [AppController],
providers: [AppService],
providers: [
AppService,
{
provide: APP_GUARD,
useClass: ThrottlerGuard,
},
],
})
export class AppModule { }