添加了设置采样、重载配置两个功能(默认采样值temperature、top_p均为1)

修改了帮助命令相关内容

function_call相关功能待开发(重载配置->反射加载)
This commit is contained in:
2024-12-25 13:43:46 +08:00
parent 1fd4a96896
commit 7d7ee1ae03
13 changed files with 217 additions and 124 deletions

View File

@@ -1,5 +1,6 @@
package work.slhaf.chatai;
import lombok.extern.slf4j.Slf4j;
import net.mamoe.mirai.console.plugin.jvm.JavaPlugin;
import net.mamoe.mirai.console.plugin.jvm.JvmPluginDescriptionBuilder;
import net.mamoe.mirai.event.GlobalEventChannel;
@@ -13,6 +14,7 @@ import work.slhaf.chatai.config.ModelConfigTemplate;
import work.slhaf.chatai.listener.FriendMessageListener;
import work.slhaf.chatai.listener.GroupMessageListener;
import work.slhaf.chatai.listener.OwnerMessageListener;
import work.slhaf.chatai.ocr.util.OCRUtil;
import java.io.IOException;
import java.util.ArrayList;
@@ -22,6 +24,7 @@ import java.util.List;
/**
* @author SLHAF
*/
@Slf4j
public final class App extends JavaPlugin {
public static final App INSTANCE = new App();
@@ -41,17 +44,16 @@ public final class App extends JavaPlugin {
//加载配置
try {
Config config = Config.ConfigLoader.load();
App.class.getClassLoader().loadClass("work.slhaf.chatai.utils.OCRUtil");
App.class.getClassLoader().loadClass("work.slhaf.chatai.utils.ChatUtil");
OCRUtil.load();
owner = config.getOwner().substring(1);
bot = config.getBot().substring(1);
customCommands = config.getCustomCommandTemplates();
blacklist = config.getBlacklist();
} catch (IOException | ClassNotFoundException e) {
} catch (IOException e) {
throw new RuntimeException(e);
}
getLogger().info("ChatAI loaded!");
log.info("ChatAI loaded!");
//群聊监听器
GlobalEventChannel.INSTANCE.filterIsInstance(GroupMessageEvent.class)
@@ -59,7 +61,7 @@ public final class App extends JavaPlugin {
String msg = event.getMessage().contentToString();
long groupId = event.getGroup().getId();
String prefix = msg.split(Constant.Order.SPLIT_BLANK)[0];
return (msg.startsWith(Constant.Order.PREFIX_DEFAULT + bot) || checkCommandExist(prefix,customCommands)) && !blacklist.contains(groupId);
return (msg.startsWith(Constant.Order.PREFIX_DEFAULT + bot) || checkCommandExist(prefix, customCommands)) && !blacklist.contains(groupId);
}).registerListenerHost(new GroupMessageListener());
//私聊监听器
@@ -69,7 +71,7 @@ public final class App extends JavaPlugin {
String sender = String.valueOf(event.getFriend().getId());
String prefix = msg.split(Constant.Order.SPLIT_BLANK)[0];
// return !(msg.startsWith(Constant.Order.PREFIX_SET) && sender.equals(owner)) && !msg.equals(Constant.Order.MSG_HELP);
return checkCommandExist(prefix,customCommands) //包含指令前缀
return checkCommandExist(prefix, customCommands) //包含指令前缀
|| !((msg.startsWith(Constant.Order.PREFIX_SET) && sender.equals(owner)) || msg.startsWith(Constant.Order.PREFIX_CUSTOM)); //如果不包含指令前缀,则不能以设置指令、"/"开头
}).registerListenerHost(new FriendMessageListener());
@@ -84,46 +86,88 @@ public final class App extends JavaPlugin {
//帮助监听
GlobalEventChannel.INSTANCE
.filterIsInstance(MessageEvent.class)
.filter(event -> event.getMessage().contentToString().equals(Constant.Order.MSG_HELP))
.filter(event -> event.getMessage().contentToString().startsWith(Constant.Order.MSG_HELP))
.subscribeAlways(MessageEvent.class, event -> {
synchronized (customCommands) {
final String[] helpMsg = {"""
————<群聊命令>————
@<bot> <content> (仅限群聊)
/<command> <content>
例:
@机器人 你好
/c 你好
————<控制命令>————
$ clearAll (仅限群聊)
$ shutUp (仅限群聊)
$ speak (仅限群聊)
$ 添加预设|<预设指令>|<模型模板ID>|<模型名称>|<预设内容>
$ 切换模型|<预设指令>|<模型模板ID>|<模型名称>
$ 更改预设|<预设指令>|<预设内容>
$ 删除预设|<预设指令>
例:
$ 添加预设|/c|<模型模板ID>|glm-4-flash|你是一只猫娘...
"""};
helpMsg[0] += "————<预设列表>————";
for (CustomCommandTemplate customCommand : customCommands) {
helpMsg[0] += "\r\n\r\n"+customCommand.toString();
String msg = event.getMessage().contentToString();
String result;
if (msg.equals(Constant.Order.MSG_HELP)) {
result = """
————<ChatAI>————
>> 群聊命令
>> 预设列表
>> 预设查询|<预设指令>
>> 模型列表""";
} else {
try {
String helpCommand = msg.split(Constant.Order.SPLIT_BLANK)[1];
String[] split = helpCommand.split(Constant.Order.SPLIT_CUSTOM);
helpCommand = split[0];
Config config = Config.ConfigLoader.getConfig();
result = switch (helpCommand) {
case "群聊命令" -> """
————<群聊命令>————
@<bot> <message> (仅限群聊)
/<command> <message>
例:
@机器人 你好
/c 你好""";
case "控制命令" -> """
————<控制命令>————
$ clearAll (仅限群聊)
$ shutUp (仅限群聊)
$ speak (仅限群聊)
$ 添加预设|<预设指令>|<模型模板ID>|<模型名称>|<预设内容>
$ 切换模型|<预设指令>|<模型模板ID>|<模型名称>
$ 更改预设|<预设指令>|<预设内容>
$ 删除预设|<预设指令>
例:
$ 添加预设|/c|<模型模板ID>|glm-4-flash|你是一只猫娘...""";
case "预设列表" -> {
StringBuilder customListStr = new StringBuilder("————<预设列表>————");
for (CustomCommandTemplate customCommandTemplate : config.getCustomCommandTemplates()) {
customListStr.append("\r\n\r\n")
.append("command: ").append(customCommandTemplate.getCommand()).append("\r\n")
.append("model: ").append(customCommandTemplate.getCustomModel());
}
yield customListStr.toString();
}
case "预设查询" -> {
StringBuilder customDetail = new StringBuilder("————<预设查询>————");
if (split.length == 1) {
yield """
格式不正确
/chatHelp 预设查询|<command>""";
}
String customCommand = split[1];
for (CustomCommandTemplate customCommandTemplate : config.getCustomCommandTemplates()) {
if (customCommand.equals(customCommandTemplate.getCommand())) {
customDetail.append("\r\n")
.append(customCommandTemplate);
yield customDetail.toString();
}
}
yield "未找到指令" + customCommand;
}
case "模型列表" -> {
StringBuilder modelListStr = new StringBuilder("————<模型列表>————");
for (ModelConfigTemplate modelConfigTemplate : config.getModelConfigTemplates()) {
modelListStr.append("\r\n\r\n")
.append("name: ").append(modelConfigTemplate.getTemplate_name()).append("\r\n")
.append("base_url: ").append(modelConfigTemplate.getBase_url());
}
yield modelListStr.toString();
}
default -> "未知指令,输入`/chatHelp`查看";
};
} catch (Exception e) {
result = "出现错误: \r\n"+e.getMessage();
}
}
helpMsg[0] += "\r\n";
helpMsg[0] += "————<模型列表>————";
for (int i = 0; i < Config.ConfigLoader.getConfig().getModelConfigTemplates().size(); i++) {
ModelConfigTemplate modelConfigTemplate = Config.ConfigLoader.getConfig().getModelConfigTemplates().get(i);
helpMsg[0] += "\r\n\r\n"+"TemplateIndex: "+i+"\r\n" +
"name: "+modelConfigTemplate.getTemplate_name() +"\r\n"+
"base_url: "+modelConfigTemplate.getBase_url()+"\r\n";
}
event.getSubject().sendMessage(helpMsg[0]);
event.getSubject().sendMessage(result);
}
});
@@ -140,6 +184,6 @@ public final class App extends JavaPlugin {
@Override
public void onDisable() {
getLogger().info("ChatAI-InGroup disabled!");
log.info("ChatAI-InGroup disabled!");
}
}

View File

@@ -26,10 +26,9 @@ public class ChatClient {
private String url;
private String apikey;
private String model;
private String prompt = "12333";
private int top_p;
private int temperature;
private double top_p;
private double temperature;
private int max_tokens;
private List<Message> messages = new ArrayList<>();
@@ -39,12 +38,12 @@ public class ChatClient {
this.clientId = clientId;
}
public ChatClient(String clientId, String url, String apikey, String model, int top_p, int temperature, int max_tokens) {
public ChatClient(String clientId, String url, String apikey, String model, double top_p, double temperature, int max_tokens) {
this(url, apikey, model, top_p, temperature, max_tokens);
this.clientId = clientId;
}
public ChatClient(String url, String apikey, String model, int top_p, int temperature, int max_tokens) {
public ChatClient(String url, String apikey, String model, double top_p, double temperature, int max_tokens) {
this(url, apikey, model);
this.top_p = top_p;
this.temperature = temperature;
@@ -58,36 +57,30 @@ public class ChatClient {
}
public void setPromotion(String promotion) {
Message message = Message.builder()
.role(Constant.Character.SYSTEM)
.content(promotion)
.build();
messages.add(0, message);
if (!promotion.equals("null")) {
Message message = Message.builder()
.role(Constant.Character.SYSTEM)
.content(promotion)
.build();
messages.add(0, message);
}
}
public ChatResponse runChat(String content) {
HttpRequest request = HttpRequest.post(url + "/completions");
log.info("URL: {}",request.getUrl());
log.info("URL: {}", request.getUrl());
request.header("Content-Type", "application/json");
request.header("Authorization", "Bearer " + apikey);
Message message = new Message(Constant.Character.USER, content);
messages.add(message);
ChatBody body;
if (top_p > 0) {
body = ChatBody.builder()
.model(model)
.messages(messages)
.top_p(top_p)
.temperature(temperature)
.max_tokens(max_tokens)
.build();
} else {
body = ChatBody.builder()
.model(model)
.messages(messages)
.build();
}
ChatBody body = ChatBody.builder()
.model(model)
.messages(messages)
.top_p(top_p)
.temperature(temperature)
.max_tokens(max_tokens)
.build();
HttpResponse response = request.body(JSONUtil.toJsonStr(body)).execute();
ChatResponse finalResponse;

View File

@@ -45,6 +45,7 @@ public class Constant {
public static final String MSG_STATUS = "/status";
public static final String PREFIX_CUSTOM = "/";
public static final String MODEL_CHANGE = ".*\\|.*";
public static final String SET_TEMP = ".*\\|.*\\|.*";
}
public static class StatusCode {

View File

@@ -13,13 +13,10 @@ public class ChatBody {
private String model;
@NonNull
private List<Message> messages;
@Builder.Default
private int temperature = 1;
@Builder.Default
private int top_p = 1;
private double temperature;
private double top_p;
private boolean stream;
@Builder.Default
private int max_tokens = 1024;
private int max_tokens;
private int presence_penalty;
private int frequency_penalty;
}

View File

@@ -1,4 +1,4 @@
package work.slhaf.chatai.utils;
package work.slhaf.chatai.chat.util;
import lombok.extern.slf4j.Slf4j;
import work.slhaf.chatai.chat.ChatClient;
@@ -63,18 +63,27 @@ public class ChatUtil {
int modelTemplateIndex;
String customModel;
String customPromotion;
double top_p;
double temperature;
int max_tokens;
Config config = Config.ConfigLoader.getConfig();
for (CustomCommandTemplate customCommandTemplate : config.getCustomCommandTemplates()) {
if (customCommandTemplate.getCommand().equals(command)) {
//读取预设配置
modelTemplateIndex = customCommandTemplate.getModelTemplateIndex();
customModel = customCommandTemplate.getCustomModel();
customPromotion = customCommandTemplate.getCustomPromotion();
top_p = customCommandTemplate.getTop_p();
temperature = customCommandTemplate.getTemperature();
max_tokens = customCommandTemplate.getMax_tokens();
//读取模型配置
ModelConfigTemplate modelConfigTemplate = config.getModelConfigTemplates().get(modelTemplateIndex);
String url = modelConfigTemplate.getBase_url();
String apikey = modelConfigTemplate.getApikey();
ChatClient chatClient = new ChatClient(chatId, url, apikey, customModel);
ChatClient chatClient = new ChatClient(chatId, url, apikey, customModel,top_p,temperature,max_tokens);
chatClient.setPromotion(customPromotion);
chatClients.put(chatId, chatClient);
log.info("final content: {}", content);

View File

@@ -69,7 +69,7 @@ public class Config {
public static class ConfigLoader {
private static final Yaml yaml;
@Getter
private static Config config = new Config();
private static Config config;
static {
DumperOptions options = new DumperOptions();
@@ -78,6 +78,7 @@ public class Config {
}
public static Config load() throws IOException {
config = new Config();
LoaderOptions loaderOptions = new LoaderOptions();
TagInspector tagInspector = tag -> true;
loaderOptions.setTagInspector(tagInspector);
@@ -158,8 +159,8 @@ public class Config {
//自定义预设
ArrayList<CustomCommandTemplate> customCommands = new ArrayList<>();
customCommands.add(new CustomCommandTemplate("default", 0, "glm-4-flash", "null"));
customCommands.add(new CustomCommandTemplate("/c", 0, "glm-4-flash", "你是一位智能编程助手,你会为用户回答关于编程、代码、计算机方面的任何问题,并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。 请用中文回答。"));
customCommands.add(new CustomCommandTemplate("default", 0, "glm-4-flash", "null",1,1,1024));
customCommands.add(new CustomCommandTemplate("/c", 0, "glm-4-flash", "你是一位智能编程助手,你会为用户回答关于编程、代码、计算机方面的任何问题,并提供格式规范、可以执行、准确安全的代码,并在必要时提供详细的解释。 请用中文回答。",1,1,1024));
config.setCustomCommandTemplates(customCommands);
dump();
log.warn("配置文件创建成功,请关闭后进行配置");
@@ -228,7 +229,7 @@ public class Config {
return "当前指令已存在!\r\n" + customCommand;
}
}
CustomCommandTemplate customCommand = new CustomCommandTemplate(command, modelTemplateIndex, customModel, customPromotion);
CustomCommandTemplate customCommand = new CustomCommandTemplate(command, modelTemplateIndex, customModel, customPromotion,1,1,1024);
customCommands.add(customCommand);
return "预设添加完毕!\r\n" + customCommand;
}

View File

@@ -17,13 +17,19 @@ public class CustomCommandTemplate {
private int modelTemplateIndex;
private String customModel;
private String customPromotion;
private double top_p = 1;
private double temperature = 1;
private int max_tokens = 1024;
@Override
public String toString() {
return "command: " + command + "\r\n" +
"modelTemplateIndex: " + modelTemplateIndex + "\r\n" +
"customModel: " + customModel + "\r\n" +
"customPromotion: " + customPromotion;
"customPromotion: " + customPromotion + "\r\n" +
"top_p: " + top_p + "\r\n" +
"temperature: " + temperature +"\r\n" +
"max_tokens: " + max_tokens;
}
public LinkedHashMap<String,String> toMap(){
@@ -32,6 +38,9 @@ public class CustomCommandTemplate {
map.put("modelTemplateIndex", String.valueOf(modelTemplateIndex));
map.put("customModel",customModel);
map.put("customPromotion",customPromotion);
map.put("top_p",String.valueOf(top_p));
map.put("temperature",String.valueOf(temperature));
map.put("max_tokens",String.valueOf(max_tokens));
return map;
}
@@ -40,5 +49,8 @@ public class CustomCommandTemplate {
this.modelTemplateIndex = Integer.parseInt(map.get("modelTemplateIndex"));
this.customModel = map.get("customModel");
this.customPromotion = map.get("customPromotion");
this.top_p = Double.parseDouble(map.get("top_p"));
this.temperature = Double.parseDouble(map.get("temperature"));
this.max_tokens = Integer.parseInt(map.get("max_tokens"));
}
}

View File

@@ -1,17 +0,0 @@
package work.slhaf.chatai.constant;
public enum MethodsConstant {
/**
* 正常对话
*/
NORMAL,
/**
* 预设对话
*/
CUSTOM,
/**
* 未匹配
*/
NONE
}

View File

@@ -4,8 +4,8 @@ import net.mamoe.mirai.event.EventHandler;
import net.mamoe.mirai.event.SimpleListenerHost;
import net.mamoe.mirai.event.events.FriendMessageEvent;
import work.slhaf.chatai.chat.constant.Constant;
import work.slhaf.chatai.utils.ChatUtil;
import work.slhaf.chatai.utils.OCRUtil;
import work.slhaf.chatai.chat.util.ChatUtil;
import work.slhaf.chatai.ocr.util.OCRUtil;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@@ -6,8 +6,8 @@ import net.mamoe.mirai.event.SimpleListenerHost;
import net.mamoe.mirai.event.events.GroupMessageEvent;
import net.mamoe.mirai.message.data.At;
import work.slhaf.chatai.chat.constant.Constant;
import work.slhaf.chatai.utils.ChatUtil;
import work.slhaf.chatai.utils.OCRUtil;
import work.slhaf.chatai.chat.util.ChatUtil;
import work.slhaf.chatai.ocr.util.OCRUtil;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@@ -9,9 +9,9 @@ import net.mamoe.mirai.event.events.GroupMessageEvent;
import net.mamoe.mirai.event.events.MessageEvent;
import net.mamoe.mirai.message.data.At;
import work.slhaf.chatai.chat.constant.Constant;
import work.slhaf.chatai.chat.util.ChatUtil;
import work.slhaf.chatai.config.Config;
import work.slhaf.chatai.config.CustomCommandTemplate;
import work.slhaf.chatai.utils.ChatUtil;
import java.io.IOException;
@@ -61,10 +61,12 @@ public class OwnerMessageListener extends SimpleListenerHost {
private void onFriendMessageEvent(FriendMessageEvent event) throws IOException {
String primaryContent = event.getMessage().contentToString().split(Constant.Order.SPLIT_BLANK)[1];
String instruction;
String arguments;
String arguments = null;
try {
instruction = primaryContent.split(Constant.Order.SPLIT_CUSTOM)[0];
arguments = primaryContent.substring(instruction.length()+1);
if (!instruction.equals(primaryContent)){
arguments = primaryContent.substring(instruction.length() + 1);
}
} catch (ArrayIndexOutOfBoundsException e) {
event.getFriend().sendMessage("操作失败,缺少参数");
return;
@@ -76,8 +78,8 @@ public class OwnerMessageListener extends SimpleListenerHost {
/**
* 对命令及其参数进行处理
*
* @param instruction 命令
* @param arguments 参数
* @param instruction 命令
* @param arguments 参数
* @return 处理结果
*/
private String handleCommand(String instruction, String arguments) throws IOException {
@@ -89,10 +91,10 @@ public class OwnerMessageListener extends SimpleListenerHost {
int modelTemplateIndex = Integer.parseInt(argumentsArray[1]);
String customModel = argumentsArray[2];
String customPromotion = argumentsArray[3];
if (modelTemplateIndex >= Config.ConfigLoader.getConfig().getModelConfigTemplates().size()){
yield "不存在模型模板["+modelTemplateIndex+"]";
if (modelTemplateIndex >= Config.ConfigLoader.getConfig().getModelConfigTemplates().size()) {
yield "不存在模型模板[" + modelTemplateIndex + "]";
}
yield Config.ConfigLoader.addCustom(command,modelTemplateIndex,customModel,customPromotion);
yield Config.ConfigLoader.addCustom(command, modelTemplateIndex, customModel, customPromotion);
} else {
yield "格式不正确!";
}
@@ -103,19 +105,19 @@ public class OwnerMessageListener extends SimpleListenerHost {
String[] argumentsArray = arguments.split(Constant.Order.SPLIT_CUSTOM);
String command = argumentsArray[0];
int modelTemplateIndex = Integer.parseInt(argumentsArray[1]);
if (modelTemplateIndex >= Config.ConfigLoader.getConfig().getModelConfigTemplates().size()){
yield "不存在模型模板["+modelTemplateIndex+"]";
if (modelTemplateIndex >= Config.ConfigLoader.getConfig().getModelConfigTemplates().size()) {
yield "不存在模型模板[" + modelTemplateIndex + "]";
}
String customModel = argumentsArray[2];
//迭代现有预设,更改对应信息
for (CustomCommandTemplate customCommandTemplate : Config.ConfigLoader.getConfig().getCustomCommandTemplates()) {
if (customCommandTemplate.getCommand().equals(command)){
if (customCommandTemplate.getCommand().equals(command)) {
customCommandTemplate.setModelTemplateIndex(modelTemplateIndex);
customCommandTemplate.setCustomModel(customModel);
yield "指令: "+command+"模型切换成功!\r\n"+customCommandTemplate;
yield "指令: " + command + "模型切换成功!\r\n" + customCommandTemplate;
}
}
yield "未找到指令: "+command;
yield "未找到指令: " + command;
} else {
yield "格式不正确!";
}
@@ -127,17 +129,68 @@ public class OwnerMessageListener extends SimpleListenerHost {
String customPromotion = argumentsArray[1];
//迭代现有预设,更改对应信息
for (CustomCommandTemplate customCommandTemplate : Config.ConfigLoader.getConfig().getCustomCommandTemplates()) {
if (customCommandTemplate.getCommand().equals(command)){
if (customCommandTemplate.getCommand().equals(command)) {
customCommandTemplate.setCustomPromotion(customPromotion);
yield "指令: "+command+"更改预设成功!\r\n"+customCommandTemplate;
yield "指令: " + command + "更改预设成功!\r\n" + customCommandTemplate;
}
}
yield "未找到指令: "+command;
yield "未找到指令: " + command;
} else {
yield "格式不正确!";
}
}
case "设置采样" -> {
if (!arguments.matches(Constant.Order.SET_TEMP)) {
yield "格式不正确";
}
String[] split = arguments.split(Constant.Order.SPLIT_CUSTOM);
String command = split[0];
int type;
double value;
try {
type = Integer.parseInt(split[1]);
value = Double.parseDouble(split[2]);
if (type != 1 && type != 2) {
yield """
格式不正确
type = 1 -> temperature
type = 2 -> top_p""";
}
if (type == 1 && (value > 2 || value < 0) || (type == 2 && (value > 1 || value < 0))) {
yield """
采样设置错误:
采样类型:
1 -> temperature
2 -> top_p
采样数值:
1 -> 0-2
2 -> 0-1
默认为1,值越高,输出越随机""";
}
} catch (NumberFormatException e) {
yield """
格式不正确:
$ 设置采样|<指令>|<采样类型>|<采样数值>""";
}
//检查是否存在对应指令
for (CustomCommandTemplate customCommandTemplate : Config.ConfigLoader.getConfig().getCustomCommandTemplates()) {
if (customCommandTemplate.getCommand().equals(split[0])) {
if (type == 1){
customCommandTemplate.setTemperature(value);
}else {
customCommandTemplate.setTop_p(value);
}
yield "采样已设置";
}
}
yield "未找到指令: " + command;
}
case "删除预设" -> Config.ConfigLoader.removeCustom(arguments);
case "重载配置" -> {
Config.ConfigLoader.load();
yield "配置已重新加载";
}
default -> "该指令不存在!";
};
Config.ConfigLoader.dump();

View File

@@ -1,4 +1,4 @@
package work.slhaf.chatai.pojo;
package work.slhaf.chatai.ocr.pojo;
import lombok.Getter;
import lombok.Setter;

View File

@@ -1,4 +1,4 @@
package work.slhaf.chatai.utils;
package work.slhaf.chatai.ocr.util;
import cn.hutool.json.JSONUtil;
import com.aliyun.ocr_api20210707.Client;
@@ -8,14 +8,14 @@ import com.aliyun.tea.TeaException;
import com.aliyun.teautil.models.RuntimeOptions;
import lombok.extern.slf4j.Slf4j;
import work.slhaf.chatai.config.Config;
import work.slhaf.chatai.pojo.OCRDataInfo;
import work.slhaf.chatai.ocr.pojo.OCRDataInfo;
@Slf4j
public class OCRUtil {
private static Client client;
public static boolean isSupported;
static {
public static void load() {
//读取密钥
Config pluginConfig = Config.ConfigLoader.getConfig();
String accessKeyId = pluginConfig.getOcrConfig().getAccessKeyId();