package cn.com.poc.thirdparty.resource.demand.ai.service;

import cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse;
import cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult;
import cn.com.poc.thirdparty.service.ChainService;
import cn.com.yict.framemax.core.spring.SingleContextInitializer;
import com.alibaba.fastjson.JSONObject;
import org.junit.runner.RunWith;
import org.junit.Test;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;

import javax.annotation.Resource;

/**
 * @author alex.yao
 * @date 2025/4/28
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(initializers = SingleContextInitializer.class)
@WebAppConfiguration
public class ChainServiceTest {

    @Resource
    private ChainService chainService;


    @Test
    public void test_dbChain(){

        DBChainResponse response = new DBChainResponse();
        response.setQuestion("查询百度插件详情");
//        response.setPrompt();
//        response.setTableFilters();
        response.setMysqlUser("dmgm_ai_root");
        response.setMysqlPassword("8253f3862ab6");
        response.setMysqlHost("192.168.21.31");
        response.setMysqlPort(3306);
        response.setMysqlDatabase("dgmg_ai_sit");
        DBChainResult dbChainResult = chainService.dbChain(response);
        System.out.println(JSONObject.toJSONString(dbChainResult));

    }

}
