/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 * <p>
 * https://www.renren.io
 * <p>
 * 版权所有，侵权必究！
 */

package test.com.pjilisense.flxai.controller;

import com.alibaba.fastjson.JSON;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import test.com.pjilisense.flxai.TestUtils;

import java.util.HashMap;
import java.util.Map;

public class ChunksControllerTest {
    @BeforeEach
    public void setUpTestDataWithinTransaction() {
        // set up test data within the transaction
    }
    @AfterEach
    public void tearDownWithinTransaction() {
        // execute "tear down" logic within the transaction
    }

    @Test
    public void testsearch() {
        String url = TestUtils.WebconnectURL+"/api/robot/chunks/search";
        String charset = TestUtils.UTF8;
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("text","开源项目");
            params.put("userId","2f3c5337-cf1a-40ce-bbe3-ec45455d82f1");
            String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
            System.out.println(body);
        } catch (Exception e) {
            e.printStackTrace();
        }
        //param ={"text":"开源项目","userId":"2f3c5337-cf1a-40ce-bbe3-ec45455d82f1"}
        //{"code":0,"msg":"success","data":[{"fid":"file_wb9Pk6GBUq0z","fname":"问答.txt","question":"开源项目","answer":"HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。","similarity":"0.9999999999999997779553950749686919152736663818359375","id":"2bcbd9ae-053e-45e5-a3a9-5498915bd749","text":"开源项目,HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。"},{"fid":"file_wb9Pk6GBUq0z","fname":"问答.txt","question":"开源项目HanLP","answer":"HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。","similarity":"0.81649658092772592343777660062187351286411285400390625","id":"2bcbd9ae-053e-45e5-a3a9-5498915bd748","text":"开源项目HanLP,HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。"}]}

        //2
        //param ={"text":"开源项目","userId":"2f3c5337-cf1a-40ce-bbe3-ec45455d82f1"}
        //{"code":0,"msg":"success","data":[{"fid":"file_wb9Pk6GBUq0z","fname":"问答.txt","similarity":"0.452267016866645388262213600683026015758514404296875","id":"2bcbd9ae-053e-45e5-a3a9-5498915bd749","text":"开源项目,HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。"},{"fid":"file_wb9Pk6GBUq0z","fname":"问答.txt","similarity":"0.424264068711928510335695818866952322423458099365234375","id":"2bcbd9ae-053e-45e5-a3a9-5498915bd748","text":"开源项目HanLP,HanLP是由一系列NLP工具组成的开源项目，其中包含了中文分词、词性标注、命名实体识别等功能。"}]}
    }

}