Commit 76fdc087 authored by alex yao's avatar alex yao

i18n

parent 5ff4c61d
......@@ -104,7 +104,7 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
bizAgentApplicationInfoEntity.setPublishTime(new Date());
if (null == bizAgentApplicationInfoService.update(bizAgentApplicationInfoEntity)) {
logger.error("update and publish agent error , bizAgentApplicationInfoEntity:{}", bizAgentApplicationInfoEntity);
throw new I18nMessageException("发布失败");
throw new I18nMessageException("exception/publication.failed");
}
//发布应用
......
......@@ -200,8 +200,8 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
public boolean updateAndPublish(AgentApplicationInfoDto dto) throws Exception {
Assert.notNull(dto);
Assert.notNull(dto.getBaseInfo());
Assert.notNull(dto.getBaseInfo().getAgentId(), "id不能为空");
Assert.notNull(dto.getBaseInfo().getAgentTitle(), "应用名称不能为空");
Assert.notNull(dto.getBaseInfo().getAgentId());
Assert.notNull(dto.getBaseInfo().getAgentTitle());
Assert.notNull(dto.getCommConfig());
Assert.notNull(dto.getCommModelConfig());
Assert.notNull(dto.getKnowledgeConfig());
......@@ -301,7 +301,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
bizAgentApplicationLargeModelListEntity.setModelNickName(query);
List<BizAgentApplicationLargeModelListEntity> entities = bizAgentApplicationLargeModelListService.findByExample(bizAgentApplicationLargeModelListEntity, null);
if (CollectionUtils.isEmpty(entities)) {
throw new I18nMessageException("模型不存在");
throw new I18nMessageException("exception/model.not.exist");
}
BizAgentApplicationLargeModelListEntity entity = entities.get(0);
BizAgentApplicationLargeModelListDto result = new BizAgentApplicationLargeModelListDto();
......@@ -313,7 +313,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
@Override
public void createAgentSystem(AgentApplicationGCDto dto, HttpServletResponse response) throws Exception {
Assert.notNull(dto.getInput(), "输入不能为空");
Assert.notNull(dto.getInput());
agentApplicationInfoService.createAgentSystem(dto.getInput(), response);
}
......@@ -329,13 +329,13 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
@Override
public String createAgentApplicationAvatar(AgentApplicationGCDto dto) throws Exception {
Assert.isTrue(StringUtils.isNotBlank(dto.getAgentDesc()) || StringUtils.isNotBlank(dto.getAgentTitle()), "请输入标题或者描述再生成应用头像");
Assert.isTrue(StringUtils.isNotBlank(dto.getAgentDesc()) || StringUtils.isNotBlank(dto.getAgentTitle()));
return agentApplicationInfoService.createAgentIcon(dto.getAgentTitle(), dto.getAgentDesc());
}
@Override
public AgentApplicationGCDto createAgentTitleAndDesc(AgentApplicationGCDto dto) throws Exception {
Assert.notNull(dto.getInput(), "输入不能为空");
Assert.notNull(dto.getInput());
CreateAgentTitleAndDescEntity entity = agentApplicationInfoService.createAgentTitleAndDesc(dto.getInput());
if (null == entity) {
throw new I18nMessageException("exception/generation.failed.please.try.again.later");
......
......@@ -56,7 +56,7 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
Assert.notNull(dto.getIsCopy());
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.get(dto.getAgentPublishId());
if (publishEntity == null) {
throw new I18nMessageException("exception/");
throw new I18nMessageException("exception/publication.failed");
}
dto.setIsSale(CommonConstant.IsDeleted.Y);
// 判断当前应用之前是否上架了
......
......@@ -38,7 +38,7 @@ public class SpeechToTextThreadPoolExecutor {
try {
THREAD_POOL_EXECUTOR.execute(task);
} catch (Exception e) {
throw new I18nMessageException("当前任务过多,请稍后重试");
throw new I18nMessageException("exception/there.are.too.many.tasks.currently.please.try.again.later");
}
}
......
......@@ -34,7 +34,7 @@ public class SmsServiceImpl implements SmsService {
// 如果成功发送,则把验证码存入redis当中,并设置五分钟的过期时间
redisService.set(phone, code, 300);
} else {
throw new I18nMessageException("验证码发送失败!请重试");
throw new I18nMessageException("exception/verification.code.sending.failed.please.try.again");
}
}
......
......@@ -84,10 +84,10 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Override
public void callAgentApplication(AgentApplicationDto dto, HttpServletResponse httpServletResponse) throws IOException {
Assert.notNull(dto, "参数不能为空");
Assert.notBlank(dto.getInput(), "输入不能为空");
Assert.notNull(dto.getAgentId(), "应用ID不能为空");
Assert.notNull(dto.getDialogsId(), "对话ID不能为空");
Assert.notNull(dto);
Assert.notBlank(dto.getInput());
Assert.notNull(dto.getAgentId());
Assert.notNull(dto.getDialogsId());
try {
agentApplicationService.callAgentApplication(dto.getAgentId(), dto.getDialogsId(), dto.getInput(), httpServletResponse);
} catch (Exception e) {
......@@ -115,7 +115,7 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Override
public BizAgentApplicationPublishDto getInfo(String agentId) throws Exception {
Assert.notBlank(agentId, "应用ID不能为空");
Assert.notBlank(agentId);
BizAgentApplicationPublishEntity entity = bizAgentApplicationPublishService.getByAgentId(agentId);
if (entity == null) {
throw new I18nMessageException("exception/application.does.not.exist");
......@@ -147,13 +147,13 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Override
public void unPublish(String agentId) throws Exception {
Assert.notBlank(agentId, "应用ID不能为空");
Assert.notBlank(agentId);
agentApplicationInfoService.unPublish(agentId);
}
@Override
public List<String> createContinueQuestions(AgentApplicationCreateContinueQuesDto dto) throws Exception {
cn.com.poc.common.utils.Assert.notNull(dto.getInput(), "input不能为空");
Assert.notNull(dto.getInput());
return agentApplicationService.createContinueQuestions(dto.getInput());
}
......@@ -180,7 +180,7 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Override
public void closeDialogues(String dialogueId) throws Exception {
Assert.notBlank(dialogueId, "对话ID不能为空");
Assert.notBlank(dialogueId);
BizAgentApplicationDialoguesRecordEntity recordEntity = new BizAgentApplicationDialoguesRecordEntity();
recordEntity.setDialogsId(dialogueId);
recordEntity.setIsDeleted(CommonConstant.IsDeleted.N);
......@@ -199,7 +199,7 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Override
public List<DialoguesContextDto> getDialogueContext(String dialogueId) {
Assert.notBlank(dialogueId, "对话ID不能为空");
Assert.notBlank(dialogueId);
List<AgentApplicationDialoguesRecordQueryItem> items = bizAgentApplicationDialoguesRecordService.getDialogueRecord(dialogueId, null);
if (CollectionUtils.isNotEmpty(items)) {
return items.stream().map(value -> {
......
......@@ -81,18 +81,18 @@ public class KnowledgeServiceImpl implements KnowledgeService {
long fileSizeInBytes = file.length();
double fileSizeInMB = (double) fileSizeInBytes / (1024 * 1024);
if (fileSizeInMB > 10) {
throw new I18nMessageException("上传的文件不能超过10M,文件名:" + documentName);
throw new I18nMessageException("exception/upload.more.than.10m");
}
String fileContent = DocumentLoad.documentToText(file).replaceAll(StringUtils.LF, StringUtils.EMPTY).replaceAll(StringUtils.CR, StringUtils.EMPTY);//文件内容
if (StringUtils.isBlank(fileContent)) {
throw new I18nMessageException("错误的文件,文件内容不能为空,文件名: " + documentName);
throw new I18nMessageException("exception/error.file.content.is.null");
}
//获取文件字符数
long charCount = fileContent.length();
//文件字符数不能超过100w
if (charCount > 100 * 10000) {
throw new I18nMessageException("文件内容字符数不能超过100w,文件名: " + documentName);
throw new I18nMessageException("exception/file.content.more.than.100w");
}
//文件上传
......
......@@ -21,7 +21,7 @@ public class ThirdPlatformAuthServiceBuilder implements ApplicationContextAware
return applicationContext.getBean(IBTAuthService.class);
}
throw new I18nMessageException("第三方授权渠道异常!");
throw new I18nMessageException("exception/third.party.authorization.channel.abnormal");
}
@Override
......
......@@ -58,9 +58,13 @@ failed.to.obtain.token=Failed to obtain token
re-verify.the.user.identity=Please re verify the user's identity
user.cannot.be.found=The user cannot be found
verification.code.is.incorrect.please.re-enter=The verification code is incorrect, please re-enter
user.does.not.exist=The logged in user does not exist
user.does.not.exist=The login user does not exist
password.error.please.re-enter=Password error, please re-enter
unable.find.user.association.relationship=Unable to find user's association relationship
account.has.already=This account has already been registered, please replace it
not.support.lang=not support this lang
call.failure=Call failure
\ No newline at end of file
call.failure=Call failure
model.not.exist=Model not exist
upload.more.than.10m=The uploaded file cannot exceed 10M file name
error.file.content.is.null=Incorrect file, file contents cannot be empty, file name
file.content.more.than.100w=The number of characters in a file cannot exceed 100w
\ No newline at end of file
......@@ -63,4 +63,8 @@ password.error.please.re-enter=密码错误,请重新输入
unable.find.user.association.relationship=找不到用户的关联关系
account.has.already=该账号已经被注册,请更换一个
not.support.lang=不支持该语音
call.failure=调用失败
\ No newline at end of file
call.failure=调用失败
model.not.exist=模型不存在
upload.more.than.10m=上传的文件不能超过10M,文件名
error.file.content.is.null=错误的文件,文件内容不能为空,文件名
file.content.more.than.100w=文件内容字符数不能超过100w,文件名
\ No newline at end of file
......@@ -63,4 +63,8 @@ password.error.please.re-enter=密碼錯誤,請重新輸入
unable.find.user.association.relationship=找不到用戶的關聯關係
account.has.already=該賬號已經被註冊,請更換一個
not.support.lang=不支持該語言
call.failure=調用失敗
\ No newline at end of file
call.failure=調用失敗
model.not.exist=模型不存在
upload.more.than.10m=上傳文件不可超過10M
error.file.content.is.null=錯誤的文件,内容不能爲空
file.content.more.than.100w=文件内容不可超100w字符
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment