com.ape9527.core.runner.InitChatGPTService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ape-core Show documentation
Show all versions of ape-core Show documentation
Ape low code platform core module
The newest version!
package com.ape9527.core.runner;
import com.ape9527.core.annotation.CustomizedValue;
import com.ape9527.utils.openai.OpenAiUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
/**
* 初始化ChatGPT服务配置
*
* @author YuanShuai[[email protected]]
*/
@Component
@Slf4j
public class InitChatGPTService implements ApplicationRunner {
/**
* 请求代理
*/
@CustomizedValue("${ape.openai.vpn}")
private String vpn;
/**
* API_KEY
*/
@CustomizedValue("${ape.openai.apikey}")
private String apiKey;
/**
* model
*/
@CustomizedValue("${ape.openai.model}")
private String model;
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("Initialize the configuration of the chat GPT service...");
OpenAiUtil.BASE_URL = vpn;
OpenAiUtil.API_KEY = apiKey;
OpenAiUtil.MODEL = model;
log.info("The chat GPT service configuration was initialized successfully!");
}
}