package com.agent.management.rag.controller;
import com.agent.management.common.Result;import com.agent.management.rag.evaluation.RagEvaluationService;import lombok.RequiredArgsConstructor;import org.springframework.web.bind.annotation.*;import java.util.*;
@RestController @RequestMapping("/api/rag/evaluation") @RequiredArgsConstructor
public class RagEvaluationController {private final RagEvaluationService service;
 @PostMapping("/run") public Result<Map<String,Object>> run(@RequestBody Map<String,Object> body){Long id=Long.valueOf(String.valueOf(body.getOrDefault("knowledgeBaseId",1)));Object raw=body.get("cases");List<Map<String,Object>> cases=new ArrayList<>();if(raw instanceof List<?> list)for(Object item:list)if(item instanceof Map<?,?> map){Map<String,Object> value=new LinkedHashMap<>();map.forEach((k,v)->value.put(String.valueOf(k),v));cases.add(value);}return Result.success(service.run(id,cases));}}
