| | |
| | | @RequestMapping("/chat") |
| | | public class ChatController { |
| | | |
| | | private final ISseService ISseService; |
| | | private final ISseService sseService; |
| | | |
| | | private final IChatMessageService chatMessageService; |
| | | |
| | |
| | | @ResponseBody |
| | | public SseEmitter sseChat(@RequestBody @Valid ChatRequest chatRequest, HttpServletRequest request) { |
| | | if (chatRequest.getModel().startsWith("ollama")) { |
| | | return ISseService.ollamaChat(chatRequest); |
| | | return sseService.ollamaChat(chatRequest); |
| | | } |
| | | return ISseService.sseChat(chatRequest,request); |
| | | return sseService.sseChat(chatRequest,request); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/upload") |
| | | @ResponseBody |
| | | public UploadFileResponse upload(@RequestPart("file") MultipartFile file) { |
| | | return ISseService.upload(file); |
| | | return sseService.upload(file); |
| | | } |
| | | |
| | | |
| | |
| | | @PostMapping("/audio") |
| | | @ResponseBody |
| | | public WhisperResponse audio(@RequestParam("file") MultipartFile file) { |
| | | WhisperResponse whisperResponse = ISseService.speechToTextTranscriptionsV2(file); |
| | | WhisperResponse whisperResponse = sseService.speechToTextTranscriptionsV2(file); |
| | | return whisperResponse; |
| | | } |
| | | |
| | |
| | | @PostMapping("/speech") |
| | | @ResponseBody |
| | | public ResponseEntity<Resource> speech(@RequestBody TextToSpeech textToSpeech) { |
| | | return ISseService.textToSpeed(textToSpeech); |
| | | return sseService.textToSpeed(textToSpeech); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/translation") |
| | | @ResponseBody |
| | | public String translation(@RequestBody TranslationRequest translationRequest) { |
| | | return ISseService.translation(translationRequest); |
| | | return sseService.translation(translationRequest); |
| | | } |
| | | |
| | | @PostMapping("/dall3") |
| | | @ResponseBody |
| | | public R<List<Item>> dall3(@RequestBody @Valid Dall3Request request) { |
| | | return R.ok(ISseService.dall3(request)); |
| | | return R.ok(sseService.dall3(request)); |
| | | } |
| | | |
| | | /** |