package cn.com.poc.annual_eport.agent;

import java.util.List;
import java.util.Map;

import cn.com.poc.agent_application.entity.AgentResultEntity;
import cn.com.poc.ai_dialogues.constant.AiDialoguesTypeEnum;
import cn.com.poc.common.config.DifyConfigProperties;
import cn.com.poc.common.service.impl.DifyChatServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author alex.yao
 * @date 2026/2/5
 */
@Component
public class AnnualReportAgent {


    @Autowired
    private DifyConfigProperties difyConfigProperties;

    @Autowired
    private DifyChatServiceImpl difyChatService;


    public AgentResultEntity agent(String dialoguesId, List<String> fileUrls, String question, Map<String, Object> data)
            throws Exception {
        String apiKey = difyConfigProperties.getApiKeys().get(AiDialoguesTypeEnum.ANNUAL_REPORT.getType());
        return difyChatService.streamChat(
                fileUrls,
                question,
                data,
                dialoguesId,
                apiKey
        );
    }
}