改成onebot-11通用接口 #9
@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class QQBotApplication {
|
||||
public static final String version = "QQBot v.1.7";
|
||||
public static final String version = "QQBot v.1.7.1";
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("version = " + version);
|
||||
|
@ -8,10 +8,14 @@ import com.yutou.qqbot.data.baidu.ResponseMessage;
|
||||
import com.yutou.qqbot.models.Model;
|
||||
import com.yutou.qqbot.utlis.BaiduGPTManager;
|
||||
import com.yutou.napcat.event.MessageEvent;
|
||||
import com.yutou.qqbot.utlis.ConfigTools;
|
||||
import com.yutou.qqbot.utlis.StringUtils;
|
||||
|
||||
@UseModel
|
||||
public class BaiduGPT extends Model {
|
||||
|
||||
private static String version = null;
|
||||
|
||||
@Override
|
||||
public boolean isUserPublic() {
|
||||
return true;
|
||||
@ -33,6 +37,18 @@ public class BaiduGPT extends Model {
|
||||
@Override
|
||||
public void onMessage(Long qq, MessageEvent event, boolean isGroup) {
|
||||
super.onMessage(qq, event, isGroup);
|
||||
if (version == null) {
|
||||
version = ConfigTools.load(ConfigTools.CONFIG, "baidu.gpt.version", String.class);
|
||||
if (StringUtils.isEmpty(version)) {
|
||||
version = "3.5";
|
||||
BaiduGPTManager.getManager().setModelFor35();
|
||||
}
|
||||
}
|
||||
if ("3.5".equals(version)) {
|
||||
BaiduGPTManager.getManager().setModelFor35();
|
||||
} else if ("4.0".equals(version)) {
|
||||
BaiduGPTManager.getManager().setModelFor40();
|
||||
}
|
||||
if (event.getTextMessage().equals(QQGroupCommands.GPT_CLEAR)) {
|
||||
BaiduGPTManager.getManager().clear();
|
||||
QQBotManager.getInstance().sendMessage(event.isUser(), qq, new Text("已经失忆捏"));
|
||||
@ -61,4 +77,8 @@ public class BaiduGPT extends Model {
|
||||
QQBotManager.getInstance().sendMessage(event.isUser(), qq, new Text(sb));
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(ConfigTools.load(ConfigTools.CONFIG,"baidu.gpt.version"));
|
||||
}
|
||||
}
|
||||
|
@ -40,10 +40,12 @@ public class BaiduGPTManager {
|
||||
|
||||
public void setModelFor40() {
|
||||
url = url_4_0;
|
||||
ConfigTools.save(ConfigTools.CONFIG,"baidu.gpt.version","4.0");
|
||||
}
|
||||
|
||||
public void setModelFor35() {
|
||||
url = url_3_5;
|
||||
ConfigTools.save(ConfigTools.CONFIG,"baidu.gpt.version","3.5");
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
|
Loading…
Reference in New Issue
Block a user