feat: 集成 AI 对话与只读查询工具

This commit is contained in:
2026-07-23 14:24:40 +08:00
parent 302dbe0621
commit f3b59935d6
52 changed files with 4942 additions and 4 deletions

View File

@@ -1,9 +1,21 @@
import { Module, OnModuleInit } from '@nestjs/common';
import { StudentsModule } from '../students/students.module';
import { ClassesModule } from '../classes/classes.module';
import { AttendanceModule } from '../attendance/attendance.module';
import { RoomsModule } from '../rooms/rooms.module';
import { BillsModule } from '../bills/bills.module';
import { DashboardModule } from '../dashboard/dashboard.module';
import { AgentToolRegistry } from './agent-tool.registry';
import { AgentToolExecutor } from './agent-tool.executor';
import { SearchStudentsTool } from './tools/search-students.tool';
import { GetStudentBasicTool } from './tools/get-student-basic.tool';
import { AgentBusinessScopeFactory } from './agent-business-scope.factory';
import { SearchClassesTool } from './tools/search-classes.tool';
import { GetAttendanceSummaryTool } from './tools/get-attendance-summary.tool';
import { SearchRoomsTool } from './tools/search-rooms.tool';
import { GetRoomOccupancySummaryTool } from './tools/get-room-occupancy-summary.tool';
import { SearchBillsTool } from './tools/search-bills.tool';
import { GetDashboardStatsTool } from './tools/get-dashboard-stats.tool';
/**
* Agent Tools feature module.
@@ -20,12 +32,19 @@ import { GetStudentBasicTool } from './tools/get-student-basic.tool';
* globally available `AuthorizationModule` and `OperationLogsModule`.
*/
@Module({
imports: [StudentsModule],
imports: [StudentsModule, ClassesModule, AttendanceModule, RoomsModule, BillsModule, DashboardModule],
providers: [
AgentToolRegistry,
AgentToolExecutor,
SearchStudentsTool,
GetStudentBasicTool,
AgentBusinessScopeFactory,
SearchClassesTool,
GetAttendanceSummaryTool,
SearchRoomsTool,
GetRoomOccupancySummaryTool,
SearchBillsTool,
GetDashboardStatsTool,
],
exports: [AgentToolExecutor],
})
@@ -34,10 +53,22 @@ export class AgentToolsModule implements OnModuleInit {
private readonly registry: AgentToolRegistry,
private readonly searchTool: SearchStudentsTool,
private readonly getTool: GetStudentBasicTool,
private readonly searchClassesTool: SearchClassesTool,
private readonly attendanceSummaryTool: GetAttendanceSummaryTool,
private readonly searchRoomsTool: SearchRoomsTool,
private readonly roomOccupancyTool: GetRoomOccupancySummaryTool,
private readonly searchBillsTool: SearchBillsTool,
private readonly dashboardStatsTool: GetDashboardStatsTool,
) {}
onModuleInit(): void {
this.registry.register(this.searchTool);
this.registry.register(this.getTool);
this.registry.register(this.searchClassesTool);
this.registry.register(this.attendanceSummaryTool);
this.registry.register(this.searchRoomsTool);
this.registry.register(this.roomOccupancyTool);
this.registry.register(this.searchBillsTool);
this.registry.register(this.dashboardStatsTool);
}
}