Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@ public int getPlatformId() {
}

@Override
public String getSiteId() { return "1"; }
public String getSiteId() {
return "1";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,12 @@ public Result<Map<String, Object>> getAnswerFromAi(AiParam aiParam) {
if (aiParam.getFoundationModel().get("model").isEmpty()) {
model = Enums.FoundationModel.GPT_35_TURBO.getValue();
}
foundationModel.put("model",model);
foundationModel.put("model", model);
aiParam.setFoundationModel(foundationModel);
Result<Map<String, Object>> resultData = requestAnswerFromAi(aiParam.getMessages(), aiParam.getFoundationModel());
// 调用接口失败时且data为null
if(!resultData.isSuccess() && resultData.getData() == null){
return Result.failed(resultData.getCode(),resultData.getMessage());
if (!resultData.isSuccess() && resultData.getData() == null) {
return Result.failed(resultData.getCode(), resultData.getMessage());
}
Map<String, Object> data = resultData.getData();
if (data.isEmpty()) {
Expand Down Expand Up @@ -134,7 +134,7 @@ public Result<Map<String, Object>> getAnswerFromAi(AiParam aiParam) {
try {
data = requestAnswerFromAi(aiParam.getMessages(), aiParam.getFoundationModel()).getData();
} catch (Exception e) {
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultMsg());
throw new ServiceException(ExceptionEnum.CM001.getResultCode(), ExceptionEnum.CM001.getResultMsg());
}
choices = (List<Map<String, Object>>) data.get("choices");
message = (Map<String, String>) choices.get(0).get("message");
Expand Down Expand Up @@ -167,14 +167,14 @@ public Result<Map<String, Object>> getAnswerFromAi(AiParam aiParam) {
private Result<Map<String, Object>> requestAnswerFromAi(List<AiMessages> messages, Map<String, String> foundationModel) {
List<AiMessages> aiMessages = formatMessage(messages);

AiParam aiParam = new AiParam(foundationModel,aiMessages);
AiParam aiParam = new AiParam(foundationModel, aiMessages);
AiChatClient aiChatClient = new AiChatClient(foundationModel.get("model"), foundationModel.get("token"));
Map<String, Object> response = aiChatClient.executeChatRequest(aiParam);
// 适配文心一言的响应数据结构,文心的部分异常情况status也是200,需要转为400,以免前端无所适从
if (response.get("error_code") != null) {
String code = response.get("error_code").toString();
String code = response.get("error_code").toString();
String message = response.get("error_msg").toString();
return Result.failed(code,message);
return Result.failed(code, message);
}
if (response.get("error") != null) {
String code = (response.get("code") != null) ? response.get("code").toString() : "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ public class PageServiceImpl implements PageService {
@SystemServiceLog(description = "通过appId查询page所有数据实现方法")
public List<Page> queryAllPage(Integer aid) {
List<Page> pageList = pageMapper.queryPageByApp(aid);
if(pageList == null){
if (pageList == null) {
return null;
}
// 遍历数据给页面的ishome字段赋值
for (Page page:pageList) {
if(page.getIsPage()){
for (Page page : pageList) {
if (page.getIsPage()) {
addIsHome(page);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -202,7 +201,7 @@ public List<BlockGroup> getBlockGroupByIdsOrAppId(List<Integer> ids, Integer app
blockGroupsListResult = blockGroupMapper.queryBlockGroupByAppId(appId, blockCreatedBy, groupCreatedBy);
}
if (ids == null && appId == null) {
blockGroupsListResult = blockGroupMapper.queryAllBlockGroupAndBlock( blockCreatedBy, groupCreatedBy);
blockGroupsListResult = blockGroupMapper.queryAllBlockGroupAndBlock(blockCreatedBy, groupCreatedBy);
}

if (blockGroupsListResult.isEmpty() || blockGroupsListResult.get(0).getId() == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ public int getPlatformId() {
}

@Override
public String getSiteId() { return "1"; }
public String getSiteId() {
return "1";
}
}
Loading