feat(#27): implement intent classification service
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Implement intent classification for natural language queries in the brain module. Features: - Hybrid classification approach: rule-based (fast, <100ms) with optional LLM fallback - 10 intent types: query_tasks, query_events, query_projects, create_task, create_event, update_task, update_event, briefing, search, unknown - Entity extraction: dates, times, priorities, statuses, people - Pattern-based matching with priority system (higher priority = checked first) - Optional LLM classification for ambiguous queries - POST /api/brain/classify endpoint Implementation: - IntentClassificationService with classify(), classifyWithRules(), classifyWithLlm(), extractEntities() - Comprehensive regex patterns for common query types - Entity extraction for dates, times, priorities, statuses, mentions - Type-safe interfaces for IntentType, IntentClassification, ExtractedEntity, IntentPattern - ClassifyIntentDto and IntentClassificationResultDto for API validation - Integrated with existing LlmService (optional dependency) Testing: - 60 comprehensive tests covering all intent types - Edge cases: empty queries, special characters, case sensitivity, multiple whitespace - Entity extraction tests with position tracking - LLM fallback tests with error handling - 100% test coverage - All tests passing (60/60) - TDD approach: tests written first Quality: - No explicit any types - Explicit return types on all functions - No TypeScript errors - Build successful - Follows existing code patterns - Quality Rails compliance: All lint checks pass Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
import { Module } from "@nestjs/common";
|
||||
import { BrainController } from "./brain.controller";
|
||||
import { BrainService } from "./brain.service";
|
||||
import { IntentClassificationService } from "./intent-classification.service";
|
||||
import { PrismaModule } from "../prisma/prisma.module";
|
||||
import { AuthModule } from "../auth/auth.module";
|
||||
import { LlmModule } from "../llm/llm.module";
|
||||
|
||||
/**
|
||||
* Brain module
|
||||
* Provides unified query interface for agents to access workspace data
|
||||
*/
|
||||
@Module({
|
||||
imports: [PrismaModule, AuthModule],
|
||||
imports: [PrismaModule, AuthModule, LlmModule],
|
||||
controllers: [BrainController],
|
||||
providers: [BrainService],
|
||||
exports: [BrainService],
|
||||
providers: [BrainService, IntentClassificationService],
|
||||
exports: [BrainService, IntentClassificationService],
|
||||
})
|
||||
export class BrainModule {}
|
||||
|
||||
Reference in New Issue
Block a user