Commit 020b9b29 authored by alex yao's avatar alex yao

fix: 【POE】-【应用创建】没有填写角色指令,发送提问报错“Expected content-type to be...

fix: 【POE】-【应用创建】没有填写角色指令,发送提问报错“Expected content-type to be text/event-stream, Actual: text/html; charset=utf-8”  --bug:1009072
parent b2c451a8
...@@ -145,7 +145,6 @@ public class AgentApplicationInfoConvert { ...@@ -145,7 +145,6 @@ public class AgentApplicationInfoConvert {
if (ObjectUtil.isNotEmpty(dto.getCommConfig())) { if (ObjectUtil.isNotEmpty(dto.getCommConfig())) {
entity.setPreamble(dto.getCommConfig().getPreamble()); entity.setPreamble(dto.getCommConfig().getPreamble());
entity.setFeaturedQuestions(dto.getCommConfig().getFeaturedQuestions()); entity.setFeaturedQuestions(dto.getCommConfig().getFeaturedQuestions());
entity.setCommunicationTurn(dto.getCommConfig().getContinuousQuestionTurn());
entity.setContinuousQuestionStatus(dto.getCommConfig().getContinuousQuestionStatus()); entity.setContinuousQuestionStatus(dto.getCommConfig().getContinuousQuestionStatus());
entity.setContinuousQuestionSystem(dto.getCommConfig().getContinuousQuestionSystem()); entity.setContinuousQuestionSystem(dto.getCommConfig().getContinuousQuestionSystem());
entity.setContinuousQuestionTurn(dto.getCommConfig().getContinuousQuestionTurn()); entity.setContinuousQuestionTurn(dto.getCommConfig().getContinuousQuestionTurn());
...@@ -158,6 +157,7 @@ public class AgentApplicationInfoConvert { ...@@ -158,6 +157,7 @@ public class AgentApplicationInfoConvert {
if (ObjectUtil.isNotEmpty(dto.getCommModelConfig())) { if (ObjectUtil.isNotEmpty(dto.getCommModelConfig())) {
entity.setLargeModel(dto.getCommModelConfig().getLargeModel()); entity.setLargeModel(dto.getCommModelConfig().getLargeModel());
entity.setTopP(dto.getCommModelConfig().getTopP()); entity.setTopP(dto.getCommModelConfig().getTopP());
entity.setCommunicationTurn(dto.getCommModelConfig().getCommunicationTurn());
} }
entity.setUnitIds(dto.getUnitIds()); entity.setUnitIds(dto.getUnitIds());
......
...@@ -130,7 +130,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest { ...@@ -130,7 +130,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
} catch (Exception e) { } catch (Exception e) {
httpServletResponse.setContentType("text/event-stream"); httpServletResponse.setContentType("text/event-stream");
PrintWriter writer = httpServletResponse.getWriter(); PrintWriter writer = httpServletResponse.getWriter();
writer.write("data: {\"code\":-1,\"message\":\"" + e.getMessage() + "\"} \n\n"); writer.write("data: {\"code\":-1,\"message\":\"" + e.getLocalizedMessage() + "\"} \n\n");
writer.write("data: [DONE]\n\n"); writer.write("data: [DONE]\n\n");
writer.flush(); writer.flush();
} }
......
...@@ -150,55 +150,33 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl ...@@ -150,55 +150,33 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
* @param model * @param model
*/ */
private void paramVerificationAndConvert(BizAgentApplicationInfoEntity entity, BizAgentApplicationInfoModel model) { private void paramVerificationAndConvert(BizAgentApplicationInfoEntity entity, BizAgentApplicationInfoModel model) {
if (entity.getMemberId() != null) {
model.setMemberId(entity.getMemberId()); model.setMemberId(entity.getMemberId());
}
if (StringUtils.isNotBlank(entity.getAgentTitle())) {
model.setAgentTitle(entity.getAgentTitle()); model.setAgentTitle(entity.getAgentTitle());
}
if (StringUtils.isNotBlank(entity.getAgentDesc())) {
model.setAgentDesc(entity.getAgentDesc()); model.setAgentDesc(entity.getAgentDesc());
}
if (StringUtils.isNotBlank(entity.getAgentSystem())) {
model.setAgentSystem(entity.getAgentSystem()); model.setAgentSystem(entity.getAgentSystem());
}
if (StringUtils.isNotBlank(entity.getAgentAvatar())) {
model.setAgentAvatar(entity.getAgentAvatar()); model.setAgentAvatar(entity.getAgentAvatar());
}
if (StringUtils.isNotBlank(entity.getAgentPublishStatus())) { if (StringUtils.isNotBlank(entity.getAgentPublishStatus())) {
Assert.isTrue(AgentApplicationConstants.AGENT_PUBLISH_STATUS.isPublishStatus(entity.getAgentPublishStatus()), "Agent publish status is error"); Assert.isTrue(AgentApplicationConstants.AGENT_PUBLISH_STATUS.isPublishStatus(entity.getAgentPublishStatus()), "Agent publish status is error");
model.setAgentPublishStatus(entity.getAgentPublishStatus());
} }
if (StringUtils.isNotBlank(entity.getPreamble())) { model.setAgentPublishStatus(entity.getAgentPublishStatus());
model.setPreamble(entity.getPreamble()); model.setPreamble(entity.getPreamble());
}
if (ArrayUtils.isNotEmpty(entity.getFeaturedQuestions())) {
model.setFeaturedQuestions(JsonUtils.serialize(entity.getFeaturedQuestions())); model.setFeaturedQuestions(JsonUtils.serialize(entity.getFeaturedQuestions()));
}
if (entity.getCommunicationTurn() != null) { if (entity.getCommunicationTurn() != null) {
Assert.isTrue(entity.getCommunicationTurn() >= 0 && entity.getCommunicationTurn() <= 100, "communication turn is error,must more than 0 and less than 100"); Assert.isTrue(entity.getCommunicationTurn() >= 0 && entity.getCommunicationTurn() <= 100, "communication turn is error,must more than 0 and less than 100");
model.setCommunicationTurn(entity.getCommunicationTurn());
} }
model.setCommunicationTurn(entity.getCommunicationTurn());
if (StringUtils.isNotBlank(entity.getContinuousQuestionStatus())) { if (StringUtils.isNotBlank(entity.getContinuousQuestionStatus())) {
Assert.isTrue(AgentApplicationConstants.CONTINUOUS_QUESTION_STATUS.isQuestionStatus(entity.getContinuousQuestionStatus()) Assert.isTrue(AgentApplicationConstants.CONTINUOUS_QUESTION_STATUS.isQuestionStatus(entity.getContinuousQuestionStatus())
, "continuous question status is error , must in default , customizable and close."); , "continuous question status is error , must in default , customizable and close.");
model.setContinuousQuestionStatus(entity.getContinuousQuestionStatus());
if (AgentApplicationConstants.CONTINUOUS_QUESTION_STATUS.CUSTOMIZABLE.equals(entity.getContinuousQuestionStatus()) && entity.getContinuousQuestionTurn() != null) {
Assert.isTrue(entity.getContinuousQuestionTurn() >= 1 && entity.getContinuousQuestionTurn() <= 5, "continuous question turn is error,must more than 1 and less than 5");
model.setContinuousQuestionTurn(entity.getContinuousQuestionTurn());
} }
if (entity.getTopP() != null) {
Assert.isTrue(entity.getTopP() >= 0 && entity.getTopP() <= 1.00, "top p is error,must more than 0 and less than 1.0");
} }
if (StringUtils.isNotBlank(entity.getContinuousQuestionSystem())) { model.setTopP(entity.getTopP());
model.setContinuousQuestionStatus(entity.getContinuousQuestionStatus());
model.setContinuousQuestionSystem(entity.getContinuousQuestionSystem()); model.setContinuousQuestionSystem(entity.getContinuousQuestionSystem());
}
if (ArrayUtils.isNotEmpty(entity.getKnowledgeIds())) {
model.setKnowledgeIds(JsonUtils.serialize(entity.getKnowledgeIds())); model.setKnowledgeIds(JsonUtils.serialize(entity.getKnowledgeIds()));
}
if (StringUtils.isNotBlank(entity.getLargeModel())) {
model.setLargeModel(entity.getLargeModel()); model.setLargeModel(entity.getLargeModel());
}
if (ArrayUtils.isNotEmpty(entity.getUnitIds())) {
model.setUnitIds(JsonUtils.serialize(entity.getUnitIds())); model.setUnitIds(JsonUtils.serialize(entity.getUnitIds()));
} }
}
} }
\ 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