package com.ard.agent.controller;
|
|
import com.alibaba.cloud.ai.graph.exception.GraphRunnerException;
|
import com.ard.agent.service.AIChatService;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import jakarta.annotation.Resource;
|
import org.springframework.web.bind.annotation.*;
|
import reactor.core.publisher.Flux;
|
|
@Tag(name = "聊天管理接口")
|
@RestController
|
@RequestMapping("/ai")
|
public class AIController {
|
|
@Resource
|
private AIChatService aiChatService;
|
|
@Operation(summary = "聊天接口")
|
@GetMapping(value = "/chat/stream", produces = "text/html;charset=UTF-8")
|
public Flux<String> streamChat(@RequestParam String message) {
|
return aiChatService.streamChat(message);
|
}
|
@Operation(summary = "ReactAgent聊天接口")
|
@GetMapping(value = "/chat")
|
public String chat(@RequestParam String message) throws GraphRunnerException {
|
return aiChatService.chat(message);
|
}
|
}
|