增加部分日志输出
This commit is contained in:
@@ -26,7 +26,7 @@ public final class App extends JavaPlugin {
|
||||
public static final App INSTANCE = new App();
|
||||
|
||||
private App() {
|
||||
super(new JvmPluginDescriptionBuilder("com.plugin.chatAI-InGroup", "0.1.0")
|
||||
super(new JvmPluginDescriptionBuilder("com.plugin.chatAI-InGroup", "2.1.0")
|
||||
.name("ChatAI-InGroup")
|
||||
.author("SLHAF")
|
||||
.build());
|
||||
@@ -120,7 +120,7 @@ public final class App extends JavaPlugin {
|
||||
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() +
|
||||
"name: "+modelConfigTemplate.getTemplate_name() +"\r\n"+
|
||||
"base_url: "+modelConfigTemplate.getBase_url()+"\r\n";
|
||||
}
|
||||
event.getSubject().sendMessage(helpMsg[0]);
|
||||
|
||||
@@ -6,6 +6,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import work.slhaf.chatai.chat.constant.Constant;
|
||||
import work.slhaf.chatai.chat.pojo.ChatBody;
|
||||
import work.slhaf.chatai.chat.pojo.ChatResponse;
|
||||
@@ -15,6 +16,7 @@ import work.slhaf.chatai.chat.pojo.PrimaryChatResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@@ -24,6 +26,7 @@ public class ChatClient {
|
||||
private String url;
|
||||
private String apikey;
|
||||
private String model;
|
||||
private String prompt = "12333";
|
||||
|
||||
private int top_p;
|
||||
private int temperature;
|
||||
@@ -55,17 +58,16 @@ public class ChatClient {
|
||||
}
|
||||
|
||||
public void setPromotion(String promotion) {
|
||||
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+ "/work/slhaf/chatai/completions");
|
||||
HttpRequest request = HttpRequest.post(url + "/completions");
|
||||
log.info("URL: {}",request.getUrl());
|
||||
request.header("Content-Type", "application/json");
|
||||
request.header("Authorization", "Bearer " + apikey);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ChatUtil {
|
||||
}
|
||||
|
||||
public static String chat(String id, String content, String command) {
|
||||
String chatId = id + "-" + command;
|
||||
String chatId = id + "-" + command + "-" + System.currentTimeMillis();
|
||||
ChatResponse chatResponse = null;
|
||||
synchronized (chatClients) {
|
||||
if (chatClients.containsKey(chatId)) {
|
||||
|
||||
Reference in New Issue
Block a user