Ai
1 Star 1 Fork 2

多喝水能美颜/bi-backend

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
AiManager.java 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
多喝水能美颜 提交于 2023-08-25 21:55 +08:00 . add 添加 AI 依赖
package com.yupi.bi.manager;
import com.yupi.bi.common.ErrorCode;
import com.yupi.bi.exception.BusinessException;
import com.yupi.yucongming.dev.client.YuCongMingClient;
import com.yupi.yucongming.dev.common.BaseResponse;
import com.yupi.yucongming.dev.model.DevChatRequest;
import com.yupi.yucongming.dev.model.DevChatResponse;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class AiManager {
@Resource
private YuCongMingClient yuCongMingClient;
/**
* AI 对话
* @param message
* @return
*/
public String doChart(Long modelId, String message) {
DevChatRequest devChatRequest = new DevChatRequest();
devChatRequest.setModelId(modelId);
devChatRequest.setMessage(message);
BaseResponse<DevChatResponse> response = yuCongMingClient.doChat(devChatRequest);
if (response == null){
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "AI 响应错误");
}
if (response.getData() == null){
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, response.getMessage());
}
return response.getData().getContent();
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/dwbf/bi-backend.git
git@gitee.com:dwbf/bi-backend.git
dwbf
bi-backend
bi-backend
master

搜索帮助