From 8032df275a00c1d61ff46a46571ecdb276d3090e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=82=85=E5=93=A5?= <184172133@qq.com> Date: Wed, 11 Oct 2023 20:50:23 +0800 Subject: [PATCH] =?UTF-8?q?docs=EF=BC=9A=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7abf7a..2ed3f44 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ SpringBoot 配置类 public class ChatGLMSDKConfig { @Bean + @ConditionalOnProperty(value = "chatglm.sdk.config.enabled", havingValue = "true", matchIfMissing = false) public OpenAiSession openAiSession(ChatGLMSDKConfigProperties properties) { // 1. 配置文件 cn.bugstack.chatglm.session.Configuration configuration = new cn.bugstack.chatglm.session.Configuration(); @@ -123,7 +124,9 @@ public class ChatGLMSDKConfig { @Data @ConfigurationProperties(prefix = "chatglm.sdk.config", ignoreInvalidFields = true) public class ChatGLMSDKConfigProperties { - + + /** 状态;open = 开启、close 关闭 */ + private boolean enable; /** 转发地址 */ private String apiHost; /** 可以申请 sk-*** */ @@ -132,13 +135,22 @@ public class ChatGLMSDKConfigProperties { } ``` +```java +@Autowired(required = false) +private OpenAiSession openAiSession; +``` + +- 注意:如果你在服务中配置了关闭启动 ChatGLM SDK 那么注入 openAiSession 为 null + yml 配置 ```pom # ChatGLM SDK Config -chatgpt: +chatglm: sdk: config: + # 状态;true = 开启、false 关闭 + enabled: false # 官网地址 api-host: https://open.bigmodel.cn/ # 官网申请 https://open.bigmodel.cn/usercenter/apikeys -- GitLab