feat(gpt): 更新模型切换逻辑并移除冗余代码
- 在 BaiduGPT.java 中添加配置保存逻辑,切换模型时更新配置 - 在 BaiduGPTManager 和 SiliconGPTManager 中实现 setModel 方法,统一模型设置逻辑 - 移除 BaiduGPTManager 中的 setModelFor40 和 setModelFor35 方法,简化代码结构 - 更新 QQBotApplication 版本号至1.7.13
This commit is contained in:
parent
9e062976ac
commit
8ea93c0d61
@ -10,7 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version = "QQBot v.1.7.12";
|
public static final String version = "QQBot v.1.7.13";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("version = " + version);
|
System.out.println("version = " + version);
|
||||||
|
@ -63,16 +63,6 @@ public class BaiduGPTManager extends AbsGPTManager {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void setModelFor40() {
|
|
||||||
model = modelFor40;
|
|
||||||
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.BAIDU_GPT_VERSION, "4.0");
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void setModelFor35() {
|
|
||||||
model = modelFor35;
|
|
||||||
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.BAIDU_GPT_VERSION, "3.5");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 这个是官方的示例代码,表示连续对话
|
// 这个是官方的示例代码,表示连续对话
|
||||||
@ -188,6 +178,12 @@ public class BaiduGPTManager extends AbsGPTManager {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbsGPTManager setModel(String model) {
|
||||||
|
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.BAIDU_GPT_VERSION, model);
|
||||||
|
return super.setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGPTVersion() {
|
public String getGPTVersion() {
|
||||||
return model;
|
return model;
|
||||||
|
@ -89,6 +89,12 @@ public class SiliconGPTManager extends AbsGPTManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AbsGPTManager setModel(String model) {
|
||||||
|
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.GPT_SILICON, model);
|
||||||
|
return super.setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File textToImage(String user, String text) {
|
public File textToImage(String user, String text) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -96,8 +96,10 @@ public class BaiduGPT extends Model {
|
|||||||
val text = event.getTextMessage().replace("@" + QQDatabase.getMe().getUserId(), "").replace("大模型切换到", "").trim();
|
val text = event.getTextMessage().replace("@" + QQDatabase.getMe().getUserId(), "").replace("大模型切换到", "").trim();
|
||||||
if(text.contains("baidu")|| text.contains("百度")){
|
if(text.contains("baidu")|| text.contains("百度")){
|
||||||
gptManager= BaiduGPTManager.class;
|
gptManager= BaiduGPTManager.class;
|
||||||
|
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.GPT, "baidu");
|
||||||
}else if(text.contains("silicon")||text.contains("硅基")){
|
}else if(text.contains("silicon")||text.contains("硅基")){
|
||||||
gptManager= SiliconGPTManager.class;
|
gptManager= SiliconGPTManager.class;
|
||||||
|
ConfigTools.save(ConfigTools.CONFIG, ConfigTools.GPT, "silicon");
|
||||||
}
|
}
|
||||||
list.add(new At(user));
|
list.add(new At(user));
|
||||||
list.add(new Text("切换为" + gptManager.getSimpleName()));
|
list.add(new Text("切换为" + gptManager.getSimpleName()));
|
||||||
@ -154,7 +156,6 @@ public class BaiduGPT extends Model {
|
|||||||
messageEvent.setRawMessage("");
|
messageEvent.setRawMessage("");
|
||||||
new BaiduGPT().onMessage(123456789L, messageEvent, false);
|
new BaiduGPT().onMessage(123456789L, messageEvent, false);
|
||||||
BaiduGPTManager.getManager().clear();
|
BaiduGPTManager.getManager().clear();
|
||||||
BaiduGPTManager.getManager().setModelFor40();
|
|
||||||
new BaiduGPT().onMessage(123456789L, messageEvent, false);
|
new BaiduGPT().onMessage(123456789L, messageEvent, false);
|
||||||
/* BaiduGPTManager.getManager().clear();
|
/* BaiduGPTManager.getManager().clear();
|
||||||
BaiduGPTManager.getManager().setModelFor35();
|
BaiduGPTManager.getManager().setModelFor35();
|
||||||
|
Loading…
Reference in New Issue
Block a user