feat(CC-054): add country+type params to legislation/ask endpoint
This commit is contained in:
parent
2e7e0c85ea
commit
d46b38c216
1 changed files with 20 additions and 4 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { Body, Controller, Post } from '@nestjs/common';
|
||||
import { IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
import { IsEnum, IsNumber, IsOptional, IsString } from 'class-validator';
|
||||
import { ExternalDataService } from './external-data.service';
|
||||
|
||||
class LegislationSearchDto {
|
||||
|
|
@ -10,6 +10,8 @@ class LegislationSearchDto {
|
|||
|
||||
class LegislationAskDto {
|
||||
@IsString() message: string;
|
||||
@IsOptional() @IsString() country?: string;
|
||||
@IsOptional() @IsEnum(['general', 'fiscal', 'national']) type?: 'general' | 'fiscal' | 'national';
|
||||
@IsOptional() @IsString() sessionId?: string;
|
||||
}
|
||||
|
||||
|
|
@ -22,16 +24,30 @@ class CapabilityCheckDto {
|
|||
export class ExternalDataController {
|
||||
constructor(private readonly svc: ExternalDataService) {}
|
||||
|
||||
/** POST /v1/external/legislation/search — vector search, returnează secțiuni text */
|
||||
/**
|
||||
* POST /v1/external/legislation/search
|
||||
* Vector search direct în corpusul legislativ — returnează secțiuni text.
|
||||
* 'scenario': descrie situația completă (ex: "Am o firmă GmbH și vreau să angajez remote")
|
||||
*/
|
||||
@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 /v1/external/legislation/ask
|
||||
* Răspuns AI via agent AnythingLLM, rutare automată după country + type.
|
||||
* country: RO | DE | FR | UK | EU
|
||||
* type: general | fiscal | national
|
||||
*/
|
||||
@Post('legislation/ask')
|
||||
askLegislation(@Body() dto: LegislationAskDto) {
|
||||
return this.svc.askLegislationAgent(dto.message, dto.sessionId);
|
||||
return this.svc.askLegislationAgent(
|
||||
dto.message,
|
||||
dto.country ?? 'RO',
|
||||
dto.type ?? 'general',
|
||||
dto.sessionId,
|
||||
);
|
||||
}
|
||||
|
||||
@Post('capability/check')
|
||||
|
|
|
|||
Loading…
Reference in a new issue