rasa : 添加说明文档

dev_2.1.0
xueqingkun 1 year ago
parent 2f236f4eef
commit 7320243ee1

@ -16,7 +16,7 @@ import java.util.List;
@Api(tags = "text2vec服务")
@RestController
@RequestMapping("text2vec")
@RequestMapping("/text2vec")
@RequiredArgsConstructor
public class Text2vecController {

@ -55,10 +55,10 @@ public class Text2vecServiceImpl implements Text2vecService {
String path = Objects.isNull(text2vecMatchesReq.getThreshold()) ? MATCHES_PATH : GET_ALL_SIMILARITIES_PATH;
String url = TEXT2VEC_SERVICE_DOMAIN + path;
log.info("matches: url is : {}",url);
log.info("matches: url is : {},req:{}",url,JSONUtil.toJsonStr(text2vecMatchesReq));
String body = HttpUtil.post(url, JSONUtil.toJsonStr(text2vecMatchesReq));
log.info("updateDataset: res is :{}",body);
log.info("matches: res is :{}",body);
JSONObject jsonBody = JSONUtil.parseObj(body);
Assert.isTrue("success".equals(jsonBody.get("status")),"查询失败");

@ -49,11 +49,13 @@ public class RasaTalkServiceImpl implements RasaTalkService {
List<RasaResDTO> list = JSONUtil.toList(post, RasaResDTO.class);
log.info("talkRasa: rasa talk result is: {}",JSONUtil.toJsonStr(list));
if (CollUtil.isNotEmpty(list)){
return list.stream().map(RasaResDTO::getText).collect(Collectors.toList());
}
log.info("talkRasa: rasa talk result is empty , redirect for text2vecService ...");
return text2vecService.matches(new Text2vecMatchesReq(rasaTalkVo.getQuestion()))
.stream().map(Text2vecMatchesRes::getSentence).collect(Collectors.toList());
.stream().map(Text2vecMatchesRes::getId).collect(Collectors.toList());
}
private String getRasaUrl(int port){

Loading…
Cancel
Save