Commit 0f0d2481 authored by alex yao's avatar alex yao

feat: 优化角色指令生成

parent 2b741d07
......@@ -75,11 +75,12 @@ public interface AgentApplicationService {
/**
* 角色指令AI生成
*
* @param input 用户输入内容
* @param input 用户输入内容
* @param optimizationSuggestions 优化建议
* @param httpServletResponse
* @return
*/
void createAgentSystem(String input, HttpServletResponse httpServletResponse) throws Exception;
void createAgentSystem(String input, String optimizationSuggestions, HttpServletResponse httpServletResponse) throws Exception;
/**
* 开场白AI生成
......
......@@ -229,7 +229,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
@Override
public void createAgentSystem(String input, HttpServletResponse httpServletResponse) throws Exception {
public void createAgentSystem(String input, String optimizationSuggestions, HttpServletResponse httpServletResponse) throws Exception {
BizAgentApplicationGcConfigEntity configEntity = bizAgentApplicationGcConfigService.getByConfigCode(AgentApplicationGCConfigConstants.AGENT_SYSTEM);
if (null == configEntity || StringUtils.isBlank(configEntity.getConfigSystem())) {
throw new I18nMessageException("exception/create.[role.instruction].configuration.does.not.exist");
......@@ -238,8 +238,12 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
systemMessage.setContent(configEntity.getConfigSystem());
systemMessage.setRole(LLMRoleEnum.SYSTEM.getRole());
String content = "[\" + input + \"]";
if (StringUtils.isNotBlank(optimizationSuggestions)) {
content = content + "\n 优化建议:[" + optimizationSuggestions + "]";
}
Message message = new Message();
message.setContent("[" + input + "]");
message.setContent(content);
message.setRole(LLMRoleEnum.USER.getRole());
List<Message> messages = new ArrayList<Message>() {{
add(systemMessage);
......
......@@ -12,6 +12,8 @@ public class AgentApplicationGCDto implements Serializable {
private String agentSystem;
private String optimizationSuggestions;
public String getInput() {
return input;
}
......@@ -20,6 +22,13 @@ public class AgentApplicationGCDto implements Serializable {
this.input = input;
}
public String getOptimizationSuggestions() {
return optimizationSuggestions;
}
public void setOptimizationSuggestions(String optimizationSuggestions) {
this.optimizationSuggestions = optimizationSuggestions;
}
public String getAgentTitle() {
return agentTitle;
......
......@@ -411,7 +411,7 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
@Override
public void createAgentSystem(AgentApplicationGCDto dto, HttpServletResponse response) throws Exception {
Assert.notNull(dto.getInput());
agentApplicationService.createAgentSystem(dto.getInput(), response);
agentApplicationService.createAgentSystem(dto.getInput(), dto.getOptimizationSuggestions(), response);
}
@Override
......
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