From aa8aadac491844d82f70f471ba3b00e665866d6f Mon Sep 17 00:00:00 2001 From: ddaodan <731882332@qq.com> Date: Mon, 22 Jul 2024 13:24:04 +0800 Subject: [PATCH] =?UTF-8?q?2.3=EF=BC=9A[BUG]=E6=8F=90=E9=97=AE=E4=B9=B1?= =?UTF-8?q?=E7=A0=81/=E7=AD=94=E9=9D=9E=E6=89=80=E9=97=AE=20#3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 2 +- changelog.md | 2 ++ readme.md | 7 ++++++- src/main/java/com/ddaodan/MineChatGPT/CommandHandler.java | 4 ++-- src/main/resources/config.yml | 6 ++++-- src/main/resources/config_zh.yml | 6 ++++-- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 6e34f93..0656012 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { } group = 'com' -version = '2.2' +version = '2.3' repositories { mavenCentral() diff --git a/changelog.md b/changelog.md index 6d9c610..ee13dda 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,6 @@ # 更新日志 +## 2.3 +- 修复 #3:[BUG]提问乱码/答非所问 ## 2.2 - 修复插件无法加载 - 修复 #2:模型切换实际并不生效 diff --git a/readme.md b/readme.md index 07e2fad..c7a881f 100644 --- a/readme.md +++ b/readme.md @@ -57,6 +57,7 @@ models: - "gpt-4-turbo" - "gpt-4-turbo-preview" - "gpt-4o" + - "gpt-4o-mini" # Google Gemini # - "gemini-pro" # - "gemini-1.5-pro" @@ -66,6 +67,10 @@ models: # 以及更多... # 默认使用的模型 default_model: "gpt-3.5-turbo" +conversation: + # 连续对话开关 + context_enabled: false + max_history_size: 10 # 消息相关设置 messages: reload: "&a已重新加载配置文件!" @@ -83,7 +88,7 @@ messages: available_models: "&e可用模型列表:" no_permission: "&c你没有权限使用这个指令。需要的权限:%s" # 不要动!!!!! -version: 2.1 +version: 2.3 ``` ## 指令与权限 diff --git a/src/main/java/com/ddaodan/MineChatGPT/CommandHandler.java b/src/main/java/com/ddaodan/MineChatGPT/CommandHandler.java index 30e99a1..1de7938 100644 --- a/src/main/java/com/ddaodan/MineChatGPT/CommandHandler.java +++ b/src/main/java/com/ddaodan/MineChatGPT/CommandHandler.java @@ -148,9 +148,9 @@ public class CommandHandler implements CommandExecutor { logger.info("Built request: " + json.toString()); HttpRequest request = HttpRequest.post(configManager.getBaseUrl() + "/chat/completions") - .header("Content-Type", "application/json") + .header("Content-Type", "application/json; charset=UTF-8") .header("Authorization", "Bearer " + configManager.getApiKey()) - .body(json.toString()); + .bodyText(json.toString()); if (configManager.isDebugMode()) { logger.info("Sending request to ChatGPT: " + request.toString()); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 0d3648a..aa99f59 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -14,6 +14,7 @@ models: - "gpt-4-turbo" - "gpt-4-turbo-preview" - "gpt-4o" + - "gpt-4o-mini" # Google Gemini # - "gemini-pro" # - "gemini-1.5-pro" @@ -24,8 +25,9 @@ models: # The default model to use default_model: "gpt-3.5-turbo" conversation: - max_history_size: 10 + # Continuous conversation switch context_enabled: false + max_history_size: 10 # Message settings messages: reload: "&aConfiguration reloaded successfully!" @@ -51,4 +53,4 @@ messages: # If you don't know what this is, don't change it debug: false # DO NOT EDIT!!!!! -version: 2.2 \ No newline at end of file +version: 2.3 \ No newline at end of file diff --git a/src/main/resources/config_zh.yml b/src/main/resources/config_zh.yml index 9bbc510..17b4e18 100644 --- a/src/main/resources/config_zh.yml +++ b/src/main/resources/config_zh.yml @@ -14,6 +14,7 @@ models: - "gpt-4-turbo" - "gpt-4-turbo-preview" - "gpt-4o" + - "gpt-4o-mini" # Google Gemini # - "gemini-pro" # - "gemini-1.5-pro" @@ -24,8 +25,9 @@ models: # 默认使用的模型 default_model: "gpt-3.5-turbo" conversation: - max_history_size: 10 + # 连续对话开关 context_enabled: false + max_history_size: 10 # 消息相关设置 messages: reload: "&a已重新加载配置文件!" @@ -51,4 +53,4 @@ messages: # 如果你不知道这是什么,请不要动 debug: false # 不要动!!!!! -version: 2.2 \ No newline at end of file +version: 2.3 \ No newline at end of file