Procházet zdrojové kódy

chat glm3增加max-token配置

wukai před 1 rokem
rodič
revize
dd304f5658

+ 2 - 0
doc-admin/src/main/resources/application-dev.yml

@@ -11,6 +11,8 @@ ruoyi:
 chat-glm3:
   flag: true
   host: http://192.168.101.66:8000/
+  max-token: 2048
+
 # Spring配置
 spring:
   #es配置

+ 2 - 2
doc-biz/src/main/java/com/doc/chatglm3/controller/ChatGlm3Controller.java

@@ -40,6 +40,7 @@ public class ChatGlm3Controller extends BaseController {
     @PostMapping()
     public SseEmitter chat(@RequestBody List<Message> messages) {
         String openaiApiHost = environment.getProperty("chat-glm3.host");
+        Integer maxToken = environment.getProperty("chat-glm3.max-token", Integer.class);
         SseEmitterUtf8 sseEmitter = new SseEmitterUtf8(-1L);
 
         SseStreamListener listener = new SseStreamListener(sseEmitter);
@@ -51,8 +52,7 @@ public class ChatGlm3Controller extends BaseController {
                 .topP(0.8)
                 .presencePenalty(0)
                 .frequencyPenalty(0)
-                .maxTokens(100)
-                .user("tom")
+                .maxTokens(maxToken)
                 .build();
 
         // 不需要代理的话,注销此行