23 lines
740 B
Java
23 lines
740 B
Java
package com.wonderland.stardewvalley.controller;
|
|||
|
|
|
||
|
|
import com.wonderland.stardewvalley.ai.ChatUtil;
|
||
|
|
import com.wonderland.stardewvalley.entity.AIChatRequest;
|
||
|
|
import jakarta.annotation.Resource;
|
||
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("chat")
|
||
|
|
public class ChatController {
|
||
|
|
|
||
|
|
@Resource
|
||
|
|
private ChatUtil chatUtil;
|
||
|
|
|
||
|
|
@PostMapping
|
||
|
|
public String chat(@RequestBody AIChatRequest aiChatRequest) {
|
||
|
|
return chatUtil.doChat(aiChatRequest.getBackGround(), aiChatRequest.getContent());
|
||
|
|
}
|
||
|
|
}
|