Package com.alibaba.cloud.ai.controller
Class ChatController
java.lang.Object
com.alibaba.cloud.ai.controller.ChatController
@RestController
@RequestMapping("/api")
@CrossOrigin(origins="*")
public class ChatController
extends Object
聊天控制器
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<ChatResponse>chat(Integer id, ChatRequest request) 智能体聊天接口org.springframework.http.ResponseEntity<ApiResponse>清空智能体的所有会话org.springframework.http.ResponseEntity<ChatSession>createSession(Integer id, Map<String, Object> request) 创建新的会话org.springframework.http.ResponseEntity<ApiResponse>deleteSession(String sessionId) 删除单个会话org.springframework.http.ResponseEntity<List<ChatSession>>获取智能体的会话列表org.springframework.http.ResponseEntity<List<ChatMessage>>getSessionMessages(String sessionId) 获取会话的消息列表org.springframework.http.ResponseEntity<ApiResponse>pinSession(String sessionId, Map<String, Object> request) 置顶/取消置顶会话org.springframework.http.ResponseEntity<ApiResponse>renameSession(String sessionId, Map<String, Object> request) 重命名会话org.springframework.http.ResponseEntity<ChatMessage>saveMessage(String sessionId, ChatMessage message) 保存消息到会话
-
Constructor Details
-
ChatController
public ChatController()
-
-
Method Details
-
getAgentSessions
@GetMapping("/agent/{id}/sessions") public org.springframework.http.ResponseEntity<List<ChatSession>> getAgentSessions(@PathVariable Integer id) 获取智能体的会话列表 -
createSession
@PostMapping("/agent/{id}/sessions") public org.springframework.http.ResponseEntity<ChatSession> createSession(@PathVariable Integer id, @RequestBody(required=false) Map<String, Object> request) 创建新的会话 -
clearAgentSessions
@DeleteMapping("/agent/{id}/sessions") public org.springframework.http.ResponseEntity<ApiResponse> clearAgentSessions(@PathVariable Integer id) 清空智能体的所有会话 -
getSessionMessages
@GetMapping("/sessions/{sessionId}/messages") public org.springframework.http.ResponseEntity<List<ChatMessage>> getSessionMessages(@PathVariable String sessionId) 获取会话的消息列表 -
chat
@PostMapping("/agent/{id}/chat") public org.springframework.http.ResponseEntity<ChatResponse> chat(@PathVariable Integer id, @RequestBody ChatRequest request) 智能体聊天接口 -
saveMessage
@PostMapping("/sessions/{sessionId}/messages") public org.springframework.http.ResponseEntity<ChatMessage> saveMessage(@PathVariable String sessionId, @RequestBody ChatMessage message) 保存消息到会话 -
pinSession
@PutMapping("/sessions/{sessionId}/pin") public org.springframework.http.ResponseEntity<ApiResponse> pinSession(@PathVariable String sessionId, @RequestBody Map<String, Object> request) 置顶/取消置顶会话 -
renameSession
@PutMapping("/sessions/{sessionId}/rename") public org.springframework.http.ResponseEntity<ApiResponse> renameSession(@PathVariable String sessionId, @RequestBody Map<String, Object> request) 重命名会话 -
deleteSession
@DeleteMapping("/sessions/{sessionId}") public org.springframework.http.ResponseEntity<ApiResponse> deleteSession(@PathVariable String sessionId) 删除单个会话
-