feat: 不选择模型自动选择时走原始默认逻辑;

This commit is contained in:
likunlong
2025-08-19 18:00:20 +08:00
committed by Administrator
parent 4b37cfe97d
commit ccdbb20935

View File

@@ -126,7 +126,8 @@ public class SseServiceImpl implements ISseService {
// 自动选择模型并获取对应的聊天服务 // 自动选择模型并获取对应的聊天服务
IChatService chatService = autoSelectModelAndGetService(chatRequest); IChatService chatService = autoSelectModelAndGetService(chatRequest);
// 统一重试与降级封装启动逻辑并通过ThreadLocal传递失败回调 // 仅当 autoSelectModel = true 时,才启用重试与降级
if (Boolean.TRUE.equals(chatRequest.getAutoSelectModel())) {
ChatModelVo currentModel = this.chatModelVo; ChatModelVo currentModel = this.chatModelVo;
String currentCategory = currentModel.getCategory(); String currentCategory = currentModel.getCategory();
ChatRetryHelper.executeWithRetry( ChatRetryHelper.executeWithRetry(
@@ -146,6 +147,10 @@ public class SseServiceImpl implements ISseService {
} }
} }
); );
} else {
// 不重试不降级,直接调用
chatService.chat(chatRequest, sseEmitter);
}
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(),e); log.error(e.getMessage(),e);
SSEUtil.sendErrorEvent(sseEmitter,e.getMessage()); SSEUtil.sendErrorEvent(sseEmitter,e.getMessage());