package com.iwe3.langchain4j.controller;

import com.iwe3.langchain4j.record.ChatRecord;
import com.iwe3.langchain4j.service.XiaoAIChatAssistant;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@Tag(name="小艾")
@RestController
@RequestMapping("/xiaoai")
public class XiaoAIController {

    @Resource
    private XiaoAIChatAssistant xiaoAIChatAssistant;

    @Operation(summary = "对话")
    @PostMapping("/chat")
    public Flux<String> chat(@RequestBody ChatRecord record){
        return xiaoAIChatAssistant.chat(record.memoryId(),record.message());
    }
}
