feat(CC-054): add ExternalDataController (legislation search/ask, capability)
This commit is contained in:
parent
aefd370d78
commit
6316717850
1 changed files with 41 additions and 0 deletions
41
src/external-data/external-data.controller.ts
Normal file
41
src/external-data/external-data.controller.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
import { IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
import { ExternalDataService } from './external-data.service';
|
||||
|
||||
class LegislationSearchDto {
|
||||
@IsString() scenario: string;
|
||||
@IsOptional() @IsString() country?: string;
|
||||
@IsOptional() @IsNumber() topK?: number;
|
||||
}
|
||||
|
||||
class LegislationAskDto {
|
||||
@IsString() message: string;
|
||||
@IsOptional() @IsString() sessionId?: string;
|
||||
}
|
||||
|
||||
class CapabilityCheckDto {
|
||||
@IsString() capability: string;
|
||||
@IsOptional() @IsString() context?: string;
|
||||
}
|
||||
|
||||
@Controller('external')
|
||||
export class ExternalDataController {
|
||||
constructor(private readonly svc: ExternalDataService) {}
|
||||
|
||||
/** POST /v1/external/legislation/search — vector search, returnează secțiuni text */
|
||||
@Post('legislation/search')
|
||||
searchLegislation(@Body() dto: LegislationSearchDto) {
|
||||
return this.svc.searchLegislation(dto.scenario, dto.country, dto.topK);
|
||||
}
|
||||
|
||||
/** POST /v1/external/legislation/ask — răspuns AI via AnythingLLM agent */
|
||||
@Post('legislation/ask')
|
||||
askLegislation(@Body() dto: LegislationAskDto) {
|
||||
return this.svc.askLegislationAgent(dto.message, dto.sessionId);
|
||||
}
|
||||
|
||||
@Post('capability/check')
|
||||
checkCapability(@Body() dto: CapabilityCheckDto) {
|
||||
return this.svc.checkCapability(dto.capability, dto.context);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue