mirror of
https://gitcode.com/ageerle/ruoyi-ai.git
synced 2026-04-15 04:43:40 +00:00
feat: 不选择模型自动选择时走原始默认逻辑;
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user