package com.tashow.cloud.ai.controller.app.dialog;


import com.tashow.cloud.ai.controller.app.dialog.vo.DialogResp;
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateReqVo;
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
import com.tashow.cloud.ai.service.dialog.AiDialogService;
import com.tashow.cloud.common.pojo.CommonResult;
import com.tashow.cloud.common.pojo.PageParam;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.tashow.cloud.common.pojo.CommonResult.success;

/**
 * 翻译
 */
@RestController
@RequestMapping("/ai/dialog")
@Validated
@Slf4j
public class DialogController {

    @Resource
    private AiDialogService aiDialogService;


    /**
     * 获取对话消息列表
     */
    @GetMapping("/getDialog")
    public CommonResult<DialogResp> msList(@Valid PageParam pageParam) {
        //获取当前登录用户
        Long userId = 1L;
        return success(aiDialogService.getDialog(userId,pageParam));
    }


    /**
     * 翻译
     */
    @PostMapping("/translate")
    public CommonResult<TranslateRespVo> translate(@Validated TranslateReqVo fileReqVo) {
        return success(aiDialogService.translate(fileReqVo));
    }
}
