package com.easyproject.web.controller.chatAI;

import com.easyproject.common.annotation.RepeatSubmit;
import com.easyproject.common.core.domain.AjaxResult;
import com.easyproject.system.domain.vo.botInfo.DataInfo;
import com.easyproject.system.service.chatAI.IChatBotService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 方法说明: 智能体信息
 * @param
 * @return
 * @author java-101
 * @date 2025-04-07 19:51:43
 */
@RestController
@RequestMapping("/chat/chatBot")
public class ChatBotController {

    @Resource
    private IChatBotService chatBotService;

    /**
     * 方法说明: 获取智能体配置
     * @param
     * @return
     * @author java-101
     * @date 2025-04-07 19:54:08
     */
    @PreAuthorize("@ss.hasPermi('system:chatBot:botConfig')")
    @GetMapping("/getChatBotConfig")
    public AjaxResult getChatBotConfig() {
        return chatBotService.getChatBotConfig();
    }

    /**
     * 方法说明: 编辑智能体-名称、描述、图标
     * @param
     * @return
     * @author java-101
     * @date 2025-04-08 22:54:24
     */
    @RepeatSubmit(interval = 3000)
    @PreAuthorize("@ss.hasPermi('system:chatBot:edit')")
    @PostMapping("/updateBotName")
    public AjaxResult updateBotName(@RequestBody DataInfo dto) {
        return chatBotService.updateBotName(dto);
    }

    /**
     * 方法说明:保存人设与回复逻辑
     * @param
     * @return
     * @author java-101
     * @date 2025-04-09 13:45:42
     */
    @RepeatSubmit(interval = 3000)
    @PreAuthorize("@ss.hasPermi('system:chatBot:edit')")
    @PostMapping("/updatePrompt")
    public AjaxResult updatePrompt(@RequestBody DataInfo dto) {
        return chatBotService.updatePrompt(dto);
    }

    /**
     * 方法说明: 保存 开场白文案、预设问题
     * @param
     * @return
     * @author java-101
     * @date 2025-04-09 15:08:59
     */
    @RepeatSubmit(interval = 3000)
    @PreAuthorize("@ss.hasPermi('system:chatBot:edit')")
    @PostMapping("/updatePrologueQuestion")
    public AjaxResult updateOnboarding(@RequestBody DataInfo dto) {
        return chatBotService.updateOnboarding(dto);
    }

    /**
     * 方法说明: 智能体设置知识库-绑定的知识库
     * @param
     * @return
     * @author java-101
     * @date 2025-04-09 15:36:06
     */
    @RepeatSubmit(interval = 3000)
    @PreAuthorize("@ss.hasPermi('system:chatBot:edit')")
    @PostMapping("/bindKnowledge")
    public AjaxResult bindKnowledge(@RequestBody DataInfo dto) {
        return chatBotService.bindKnowledge(dto);
    }

}
