package com.seer.teach.openapi.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.seer.teach.common.ResultBean;
import com.seer.teach.openapi.llm.resp.CorrectDTO;
import com.seer.teach.openapi.request.CorrectReq;
import com.seer.teach.openapi.service.BusinessService;
import com.seer.teach.openapi.uitl.StpOpenApiUtils;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
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;
import reactor.core.publisher.Flux;

/**
 * @Author: Captain
 * @Description: Ai批改
 * @Date: 2025-05-12 14:28
 */
@Validated
@RequiredArgsConstructor
@RestController
@SaCheckLogin(type = StpOpenApiUtils.TYPE)
@Tag(name = "API - 业务层")
@RequestMapping("/business")
public class BusinessController {

    private final BusinessService businessService;

    @Operation(summary = "批改")
    @PostMapping(value = "/correct", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
    public Flux<ResultBean<CorrectDTO>> correct(@RequestBody @Validated CorrectReq params) {
        return businessService.aiCorrect(params.getImageBase64());
    }

}
