AI大模型,key调用错误处理

pull/8191/head
JEECG 2025-04-14 18:32:02 +08:00
parent f7ca26fff0
commit 02f21de8d5
1 changed files with 5 additions and 1 deletions

View File

@ -694,7 +694,11 @@ public class AiragChatServiceImpl implements IAiragChatService {
HttpServletRequest httpRequest = SpringContextUtils.getHttpServletRequest();
TokenStream chatStream;
try {
chatStream = aiChatHandler.chat(modelId,messages, aiChatParams);
if (oConvertUtils.isNotEmpty(modelId)) {
chatStream = aiChatHandler.chat(modelId, messages, aiChatParams);
} else {
chatStream = aiChatHandler.chatByDefaultModel(messages, aiChatParams);
}
} catch (Exception e) {
log.error(e.getMessage(),e);
throw new JeecgBootBizTipException("调用大模型接口失败:" + e.getMessage());