Commit 60fc45ac authored by alex yao's avatar alex yao

feat:预览应用,多模型聊天

parent 82b99f01
...@@ -9,10 +9,40 @@ public class AgentApplicationPreviewDto implements Serializable { ...@@ -9,10 +9,40 @@ public class AgentApplicationPreviewDto implements Serializable {
private String modelNickName; private String modelNickName;
private Float topP;
private Float temperature;
private String agentSystem;
private String agentId; private String agentId;
private List<Message> messages; private List<Message> messages;
public Float getTopP() {
return topP;
}
public void setTopP(Float topP) {
this.topP = topP;
}
public Float getTemperature() {
return temperature;
}
public void setTemperature(Float temperature) {
this.temperature = temperature;
}
public String getAgentSystem() {
return agentSystem;
}
public void setAgentSystem(String agentSystem) {
this.agentSystem = agentSystem;
}
public String getModelNickName() { public String getModelNickName() {
return modelNickName; return modelNickName;
} }
......
...@@ -149,25 +149,28 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest { ...@@ -149,25 +149,28 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
List<Tool> tools = new ArrayList<>(); List<Tool> tools = new ArrayList<>();
//开启对话变量 //开启对话变量
if (ArrayUtils.isNotEmpty(infoEntity.getVariableStructure())) { if (ArrayUtils.isNotEmpty(infoEntity.getVariableStructure())) {
String functionName = "set_value_memory"; String functionName = LargeModelFunctionEnum.set_value_memory.name();
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getVariableStructureLLMConfig(infoEntity.getVariableStructure()).get(0); String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getVariableStructureLLMConfig(infoEntity.getVariableStructure()).get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class); Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool); tools.add(tool);
} }
//开启长期记忆 //开启长期记忆
if (CommonConstant.YOrN.Y.equals(infoEntity.getIsLongMemory())) { if (CommonConstant.YOrN.Y.equals(infoEntity.getIsLongMemory())) {
String functionName = "set_long_memory"; String functionName = LargeModelFunctionEnum.set_long_memory.name();
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getLLMConfig().get(0); String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getLLMConfig().get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class); Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool); tools.add(tool);
} }
//获取模型 //对话大模型配置
String model = StringUtils.isNotBlank(dto.getModelNickName()) ? dto.getModelNickName() : infoEntity.getLargeModel(); String model = StringUtils.isNotBlank(dto.getModelNickName()) ? dto.getModelNickName() : infoEntity.getLargeModel();
Float topP = dto.getTopP() == null ? infoEntity.getTopP() : dto.getTopP();
Float temperature = dto.getTemperature() == null ? infoEntity.getTemperature() : dto.getTemperature();
String agentSystem = StringUtils.isBlank(dto.getAgentSystem()) ? infoEntity.getAgentSystem() : dto.getAgentSystem();
//调用应用服务 //调用应用服务
agentApplicationInfoService.callAgentApplication(agentId, model, infoEntity.getUnitIds() agentApplicationInfoService.callAgentApplication(agentId, model, infoEntity.getUnitIds()
, infoEntity.getAgentSystem(), kdIds.toArray(new Integer[0]), infoEntity.getCommunicationTurn(), infoEntity.getTopP(), infoEntity.getTemperature() , agentSystem, kdIds.toArray(new Integer[0]), infoEntity.getCommunicationTurn(), topP, temperature
, dto.getMessages(), tools, httpServletResponse); , dto.getMessages(), tools, httpServletResponse);
} catch (Exception e) { } catch (Exception e) {
httpServletResponse.setContentType("text/event-stream"); httpServletResponse.setContentType("text/event-stream");
......
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