添加模板
parent
363ac7187a
commit
88d4dba7ee
|
@ -0,0 +1,25 @@
|
|||
package com.sikadi.user.controller;
|
||||
|
||||
import com.bwie.common.domain.StringAppGTP;
|
||||
import com.sikadi.user.service.GTPService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import top.hualuo.XhStreamClient;
|
||||
|
||||
@RestController
|
||||
public class GTPController {
|
||||
|
||||
@Autowired
|
||||
private GTPService gtpService;
|
||||
|
||||
|
||||
|
||||
@PostMapping("/chat")
|
||||
public String chat(@RequestBody StringAppGTP stringAppGTP){
|
||||
|
||||
return gtpService.chat(stringAppGTP);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.sikadi.user.service;
|
||||
|
||||
import com.bwie.common.domain.StringAppGTP;
|
||||
|
||||
public interface GTPService {
|
||||
String chat(StringAppGTP stringAppGTP);
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.sikadi.user.service.impl;
|
||||
|
||||
import com.bwie.common.domain.StringAppGTP;
|
||||
import com.bwie.common.utils.XfXhListener;
|
||||
import com.sikadi.user.service.GTPService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import top.hualuo.XhStreamClient;
|
||||
import top.hualuo.dto.MsgDTO;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@Service
|
||||
public class GTPServiceImpl implements GTPService {
|
||||
|
||||
@Autowired
|
||||
private XhStreamClient xhStreamClient;
|
||||
|
||||
@Override
|
||||
public String chat(StringAppGTP stringAppGTP) {
|
||||
|
||||
MsgDTO dto = MsgDTO.builder().role(MsgDTO.Role.USER.getName()).content(stringAppGTP.getProblem()).build();
|
||||
|
||||
|
||||
return xhStreamClient.sendMsg("123", Arrays.asList(dto),new XfXhListener());;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue