mirror of
https://github.com/ddaodan/minechatgpt.git
synced 2025-02-18 15:54:13 +08:00
支持 自定义prompt
This commit is contained in:
parent
aa8aadac49
commit
acdfcda8db
@ -1,4 +1,6 @@
|
||||
# 更新日志
|
||||
## 2.4
|
||||
- 添加自定义prompt
|
||||
## 2.3
|
||||
- 修复 #3:[BUG]提问乱码/答非所问
|
||||
## 2.2
|
||||
|
@ -128,10 +128,17 @@ public class CommandHandler implements CommandExecutor {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("model", configManager.getDefaultModel());
|
||||
JSONArray messages = new JSONArray();
|
||||
// 添加自定义 prompt
|
||||
String customPrompt = configManager.getCustomPrompt();
|
||||
if (!customPrompt.isEmpty()) {
|
||||
JSONObject promptMessage = new JSONObject();
|
||||
promptMessage.put("role", "system");
|
||||
promptMessage.put("content", customPrompt);
|
||||
messages.put(promptMessage);
|
||||
}
|
||||
JSONObject message = new JSONObject();
|
||||
message.put("role", "user");
|
||||
message.put("content", utf8Question);
|
||||
//message.put("content", question);
|
||||
messages.put(message);
|
||||
if (contextEnabled) {
|
||||
String history = conversationContext.getConversationHistory();
|
||||
|
@ -56,6 +56,10 @@ public class ConfigManager {
|
||||
return config.getStringList("models");
|
||||
}
|
||||
|
||||
public String getCustomPrompt() {
|
||||
return config.getString("prompt", "You are a helpful assistant.");
|
||||
}
|
||||
|
||||
public String getHelpMessage() {
|
||||
return translateColorCodes(config.getString("messages.help"));
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ conversation:
|
||||
# Continuous conversation switch
|
||||
context_enabled: false
|
||||
max_history_size: 10
|
||||
prompt: "You are a helpful assistant."
|
||||
# Message settings
|
||||
messages:
|
||||
reload: "&aConfiguration reloaded successfully!"
|
||||
@ -53,4 +54,4 @@ messages:
|
||||
# If you don't know what this is, don't change it
|
||||
debug: false
|
||||
# DO NOT EDIT!!!!!
|
||||
version: 2.3
|
||||
version: 2.4
|
Loading…
Reference in New Issue
Block a user