package com.sonic.cow.controller.api;

import com.sonic.common.rpc.Result;
import com.sonic.cow.client.ContextChatClient;
import com.sonic.cow.lib.input.NsfwCheckInput;
import com.sonic.sdk.api.annotation.IgnoreAuth;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * AI接口
 *
 * @author code
 */
@RestController
@Slf4j
public class NsfwCheckApi {

    @Autowired
    private ContextChatClient contextChatClient;

    @IgnoreAuth
    @ApiOperation(value = "敏感词校验接口", tags = {"API-接口"})
    @PostMapping("/api/nsfw/check")
    public Result<Void> nsfwCheck(@RequestBody NsfwCheckInput input) {
        contextChatClient.nsfwCheck(input.getContent());
        return Result.success();
    }

}

