liusuyi
2026-05-30 f4f4fc53260eb67483dce406a963628273786a61
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
    }
}