wfansh 1 month ago
parent
commit
d1e7ddf59c

+ 1 - 1
jeecg-boot-base-core/pom.xml

@@ -304,7 +304,7 @@
 		<!-- chatgpt -->
 		<dependency>
 			<groupId>org.jeecgframework.boot</groupId>
-			<artifactId>jeecg-boot-starter3-chatgpt</artifactId>
+			<artifactId>jeecg-boot-starter-chatgpt</artifactId>
 		</dependency>
 
 		<!--thumbnailator图片处理-->

+ 6 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/gpt/service/impl/ChatServiceImpl.java

@@ -10,7 +10,7 @@ import lombok.extern.slf4j.Slf4j;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.SecurityUtils;
-import org.jeecg.common.api.vo.Result;
+import org.jeecg.chatgpt.prop.AiChatProperties;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.SpringContextUtils;
@@ -49,12 +49,15 @@ public class ChatServiceImpl implements ChatService {
 
     @Autowired private OpenAiStreamClient openAiStreamClient;
 
+    @Autowired private AiChatProperties aiChatProperties;
+
     @Autowired private IChatHistoryService chatHistoryService;
 
     /** 防止client不能成功注入 */
     private OpenAiStreamClient ensureClient() {
         if (Objects.isNull(this.openAiStreamClient)) {
             this.openAiStreamClient = SpringContextUtils.getBean(OpenAiStreamClient.class);
+            this.aiChatProperties = SpringContextUtils.getBean(AiChatProperties.class);
         }
         return this.openAiStreamClient;
     }
@@ -146,7 +149,7 @@ public class ChatServiceImpl implements ChatService {
         ChatCompletion completion =
                 ChatCompletion.builder()
                         .messages(topicContext)
-                        .model(ChatCompletion.Model.GPT_3_5_TURBO.getName())
+                        .model(aiChatProperties.getModel())
                         .build();
         ensureClient().streamChatCompletion(completion, openAIEventSourceListener);
 
@@ -161,7 +164,7 @@ public class ChatServiceImpl implements ChatService {
                 // 话题context TTL设置为3小时
                 3 * 60 * 60);
 
-        Result.ok(completion.tokens());
+        // Result.ok(completion.tokens());
     }
 
     @Override

+ 6 - 4
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -297,13 +297,15 @@ jeecg:
     enabled: true
   # ai-chat
   ai-chat:
-    # 是否开启;必须。
+    # 是否开启 - 必须
     enabled: true
-    # openAi接口秘钥,填写自己的apiKey;必须。
+    # openAi / deepSeek 接口秘钥
     apiKey: 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
-    # openAi域名,有代理就填代理的域名。默认:openAI官方apiHost
+    # openAi / deepSeek 语言模型
+    model: gpt-3.5-turbo
+    # openAi / deepSeek域名,有代理就填代理的域名
     apiHost: http://openai-proxy.adwebcloud.com
-    # 超时时间单位:s。默认 60s
+    # 超时时间单位:s - 默认 60s
     timeout: 60
 
     # 本地代理地址

+ 6 - 4
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -298,13 +298,15 @@ jeecg:
     enabled: true
   # ai-chat
   ai-chat:
-    # 是否开启;必须。
+    # 是否开启 - 必须
     enabled: true
-    # openAi接口秘钥,填写自己的apiKey;必须。
+    # openAi / deepSeek 接口秘钥
     apiKey: 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
-    # openAi域名,有代理就填代理的域名。默认:openAI官方apiHost
+    # openAi / deepSeek 语言模型
+    model: gpt-3.5-turbo
+    # openAi / deepSeek域名,有代理就填代理的域名
     apiHost: http://openai-proxy.adwebcloud.com
-    # 超时时间单位:s。默认 60s
+    # 超时时间单位:s - 默认 60s
     timeout: 60
 
     # 本地代理地址

+ 8 - 6
jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

@@ -296,13 +296,15 @@ jeecg:
     enabled: true
   # ai-chat
   ai-chat:
-    # 是否开启;必须。
+    # 是否开启 - 必须
     enabled: true
-    # openAi接口秘钥,填写自己的apiKey;必须。
-    apiKey: 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
-    # openAi域名,有代理就填代理的域名。默认:openAI官方apiHost
-    apiHost: http://openai-proxy.adwebcloud.com
-    # 超时时间单位:s。默认 60s
+    # openAi / deepSeek 接口秘钥
+    apiKey: sk-e2e55cc205ee4ca1bdd25533d74fc646
+    # openAi / deepSeek 语言模型
+    model: deepseek-chat
+    # openAi / deepSeek域名,有代理就填代理的域名
+    apiHost: https://api.deepseek.com
+    # 超时时间单位:s - 默认 60s
     timeout: 60
 
     # 本地代理地址

+ 2 - 2
pom.xml

@@ -426,8 +426,8 @@
 			<!-- chatgpt -->
 			<dependency>
 				<groupId>org.jeecgframework.boot</groupId>
-				<artifactId>jeecg-boot-starter3-chatgpt</artifactId>
-                <version>${jeecgboot.version}</version>
+				<artifactId>jeecg-boot-starter-chatgpt</artifactId>
+                <version>3.7.3</version>
 			</dependency>
 
 			<!--flyway 支持 mysql5.7+、MariaDB10.3.16-->