Commit 2ef508ae by patrick

fix: 解决流式响应超过256k大小

parent 54c3ab7b
No preview for this file type
No preview for this file type
...@@ -41,6 +41,7 @@ import reactor.core.publisher.Flux; ...@@ -41,6 +41,7 @@ import reactor.core.publisher.Flux;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -163,7 +164,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService { ...@@ -163,7 +164,7 @@ public class AiChatMessageServiceImpl implements AiChatMessageService {
chatMessageMapper.insert(assistantMessage); chatMessageMapper.insert(assistantMessage);
}); });
}).doOnError(throwable -> { }).doOnError(throwable -> {
// log.error("[sendChatMessageStream][userId({}) sendReqVO({}) 发生异常]", userId, sendReqVO, throwable); log.error("[sendChatMessageStream][userId({}) sendReqVO({}) 发生异常]", userId, sendReqVO, throwable);
// 忽略租户,因为 Flux 异步无法透传租户 // 忽略租户,因为 Flux 异步无法透传租户
// TenantUtils.executeIgnore(() -> // TenantUtils.executeIgnore(() ->
// chatMessageMapper.updateById(new AiChatMessageDO().setId(assistantMessage.getId()).setContent(throwable.getMessage()))); // chatMessageMapper.updateById(new AiChatMessageDO().setId(assistantMessage.getId()).setContent(throwable.getMessage())));
......
...@@ -35,7 +35,7 @@ public class FastGPTApi { ...@@ -35,7 +35,7 @@ public class FastGPTApi {
} }
public FastGPTApi(String baseUrl, String openAiToken) { public FastGPTApi(String baseUrl, String openAiToken) {
this(baseUrl, openAiToken, RestClient.builder(), WebClient.builder()); this(baseUrl, openAiToken, RestClient.builder(), WebClient.builder().codecs(configurer -> configurer.defaultCodecs().maxInMemorySize(10 * 1024 * 1024)));
} }
public FastGPTApi(String baseUrl, String openAiToken, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder) { public FastGPTApi(String baseUrl, String openAiToken, RestClient.Builder restClientBuilder, WebClient.Builder webClientBuilder) {
......
...@@ -216,4 +216,8 @@ iot: ...@@ -216,4 +216,8 @@ iot:
# 保持连接 # 保持连接
keepalive: 60 keepalive: 60
# 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息) # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
clearSession: true clearSession: true
\ No newline at end of file
#spring:
# codec:
# max-in-memory-size: 16777216 # 16MB
...@@ -273,4 +273,4 @@ iot: ...@@ -273,4 +273,4 @@ iot:
# 保持连接 # 保持连接
keepalive: 60 keepalive: 60
# 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息) # 清除会话(设置为false,断开连接,重连后使用原来的会话 保留订阅的主题,能接收离线期间的消息)
clearSession: true clearSession: true
\ No newline at end of file
...@@ -145,7 +145,6 @@ spring: ...@@ -145,7 +145,6 @@ spring:
missing-topics-fatal: false # 消费监听接口监听的主题不存在时,默认会报错。所以通过设置为 false ,解决报错 missing-topics-fatal: false # 消费监听接口监听的主题不存在时,默认会报错。所以通过设置为 false ,解决报错
--- #################### AI 相关配置 #################### --- #################### AI 相关配置 ####################
spring: spring:
ai: ai:
vectorstore: # 向量存储 vectorstore: # 向量存储
......
...@@ -10,6 +10,8 @@ declare module 'vue' { ...@@ -10,6 +10,8 @@ declare module 'vue' {
AddNode: typeof import('./../components/SimpleProcessDesigner/src/addNode.vue')['default'] AddNode: typeof import('./../components/SimpleProcessDesigner/src/addNode.vue')['default']
AppLinkInput: typeof import('./../components/AppLinkInput/index.vue')['default'] AppLinkInput: typeof import('./../components/AppLinkInput/index.vue')['default']
AppLinkSelectDialog: typeof import('./../components/AppLinkInput/AppLinkSelectDialog.vue')['default'] AppLinkSelectDialog: typeof import('./../components/AppLinkInput/AppLinkSelectDialog.vue')['default']
'AutoComponents.d': typeof import('./auto-components.d.ts')['default']
'AutoImports.d': typeof import('./auto-imports.d.ts')['default']
Backtop: typeof import('./../components/Backtop/src/Backtop.vue')['default'] Backtop: typeof import('./../components/Backtop/src/Backtop.vue')['default']
CardTitle: typeof import('./../components/Card/src/CardTitle.vue')['default'] CardTitle: typeof import('./../components/Card/src/CardTitle.vue')['default']
ColorInput: typeof import('./../components/ColorInput/index.vue')['default'] ColorInput: typeof import('./../components/ColorInput/index.vue')['default']
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment