/**
 * 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 AppAiModelControllerTest {
    @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 testAppAiAssistantSave() {
        String url = TestUtils.WebconnectURL+"/api/robot/appaimodel";
        String charset = TestUtils.UTF8;
        try {
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("identifier","alps-tongyi-image2");
            params.put("providers","ollama,YoungTx2");
            params.put("conversations","0");
            params.put("likes","0");
            params.put("tokens","0");
            params.put("description","此插件使用阿里巴巴的通义万象模型根据文本提示生成图像。");
            params.put("displayname","Llama 3.1 8B");
            params.put("enabled","true");
            params.put("category","ollama");
            params.put("title","Llama 3.1 8B");
            params.put("metaId","llama3.1");
            params.put("metaTokens","avatar2");
            params.put("suggestions","a,b,c");
            params.put("createdAt","2024-08-09");
            params.put("userid","flx");
            String body = TestUtils.doPost(url, JSON.toJSONString(params), charset);
            System.out.println(body);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    @Test
    public void testGetAllAiAssistant() {
        String url = TestUtils.WebconnectURL+"/api/robot/appaimodel/getAllAiModel?userid=flx";
        String charset = TestUtils.UTF8;
        try {
            String body = TestUtils.doGet(url, charset);
            System.out.println(body);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}