package com.ruoyi.web.controller.warehouse;

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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.warehouse.domain.agent.AgentAnalyzeRequest;
import com.ruoyi.warehouse.domain.agent.AgentExecuteRequest;
import com.ruoyi.warehouse.service.IAgentService;

@RestController
@RequestMapping("/warehouse/agent")
public class AgentController extends BaseController
{
    @Autowired
    private IAgentService agentService;

    @PostMapping("/analyze")
    public AjaxResult analyze(@RequestBody AgentAnalyzeRequest request)
    {
        return success(agentService.analyze(request.getText(), request.getContextResults(), getUsername()));
    }

    @PostMapping("/execute")
    public AjaxResult execute(@RequestBody AgentExecuteRequest request)
    {
        return success(agentService.execute(request.getPlan(), getUsername()));
    }
}
