Commit fc5cac7c authored by alex yao's avatar alex yao

style: 优化function call 逻辑

parent c8c7e4e6
......@@ -3,6 +3,7 @@ package cn.com.poc.agent_application.aggregate;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import cn.com.poc.agent_application.entity.CreateAgentTitleAndDescEntity;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Message;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Tool;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
......@@ -17,9 +18,9 @@ public interface AgentApplicationInfoService {
/**
* 应用预览
*/
String callAgentApplication(String largeModel, String[] unitIds, String agentSystem,
String callAgentApplication(String identifier, String largeModel, String[] unitIds, String agentSystem,
Integer[] knowledgeIds, Integer communicationTurn, Float topP,
List<Message> messages, Boolean isLongMemory, String[] variableStructure, boolean isFunction, String[] functionName, List<String> functionConfig, String useStatus, HttpServletResponse httpServletResponse) throws Exception;
List<Message> messages, List<Tool> tools, HttpServletResponse httpServletResponse) throws Exception;
/**
......
......@@ -4,9 +4,9 @@ import cn.com.poc.agent_application.domain.AgentApplicationBaseInfo;
import cn.com.poc.agent_application.domain.AgentApplicationCommConfig;
import cn.com.poc.agent_application.domain.AgentApplicationCommModelConfig;
import cn.com.poc.agent_application.domain.AgentApplicationKnowledgeConfig;
import cn.com.poc.agent_application.model.BizAgentApplicationInfoModel;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import cn.com.poc.agent_application.dto.AgentApplicationInfoDto;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import cn.com.poc.agent_application.model.BizAgentApplicationInfoModel;
import cn.com.poc.agent_application.query.AgentApplicationInfoQueryItem;
import cn.com.poc.agent_application.query.PublishAgentApplicationQueryItem;
import cn.com.poc.common.utils.JsonUtils;
......@@ -43,11 +43,7 @@ public class AgentApplicationInfoConvert {
entity.setPreamble(model.getPreamble());
entity.setPublishTime(model.getPublishTime());
entity.setIsLongMemory(model.getIsLongMemory());
entity.setIsFunction(model.getIsFunction());
if(StringUtils.isNotBlank(model.getFunctionName())) {
entity.setFunctionName(JsonUtils.deSerialize(model.getFunctionName(), String[].class));
}
if(StringUtils.isNotBlank(model.getVariableStructure())) {
if (StringUtils.isNotBlank(model.getVariableStructure())) {
entity.setVariableStructure(JsonUtils.deSerialize(model.getVariableStructure(), String[].class));
}
if (StringUtils.isNotBlank(model.getFeaturedQuestions())) {
......@@ -87,10 +83,6 @@ public class AgentApplicationInfoConvert {
model.setPreamble(entity.getPreamble());
model.setPublishTime(entity.getPublishTime());
model.setIsLongMemory(entity.getIsLongMemory());
model.setIsFunction(entity.getIsFunction());
if (ArrayUtils.isNotEmpty(entity.getFunctionName())) {
model.setFunctionName(JsonUtils.serialize(entity.getFunctionName()));
}
if (ArrayUtils.isNotEmpty(entity.getVariableStructure())) {
model.setVariableStructure(JsonUtils.serialize(entity.getVariableStructure()));
}
......@@ -137,8 +129,7 @@ public class AgentApplicationInfoConvert {
commConfig.setContinuousQuestionTurn(entity.getContinuousQuestionTurn());
commConfig.setVariableStructure(entity.getVariableStructure());
commConfig.setIsLongMemory(entity.getIsLongMemory());
commConfig.setFunctionName(entity.getFunctionName());
commConfig.setIsFunction(entity.getIsFunction());
AgentApplicationKnowledgeConfig knowledgeConfig = new AgentApplicationKnowledgeConfig();
knowledgeConfig.setKnowledgeIds(entity.getKnowledgeIds());
......@@ -184,10 +175,6 @@ public class AgentApplicationInfoConvert {
entity.setVariableStructure(dto.getCommConfig().getVariableStructure());
}
entity.setIsLongMemory(dto.getCommConfig().getIsLongMemory());
if (ObjectUtil.isNotEmpty(dto.getCommConfig().getFunctionName())) {
entity.setFunctionName(dto.getCommConfig().getFunctionName());
}
entity.setIsFunction(dto.getCommConfig().getIsFunction());
}
if (ObjectUtil.isNotEmpty(dto.getKnowledgeConfig())) {
......@@ -221,12 +208,8 @@ public class AgentApplicationInfoConvert {
entity.setPreamble(infoQueryItem.getPreamble());
entity.setPublishTime(infoQueryItem.getPublishTime());
entity.setIsLongMemory(infoQueryItem.getIsLongMemory());
entity.setIsFunction(infoQueryItem.getIsFunction());
if(StringUtils.isNotBlank(infoQueryItem.getFunctionName())) {
entity.setFunctionName(JsonUtils.deSerialize(infoQueryItem.getFunctionName(), String[].class));
}
if(StringUtils.isNotBlank(infoQueryItem.getVariableStructure())) {
if (StringUtils.isNotBlank(infoQueryItem.getVariableStructure())) {
entity.setVariableStructure(JsonUtils.deSerialize(infoQueryItem.getVariableStructure(), String[].class));
}
......
......@@ -4,9 +4,9 @@ import cn.com.poc.agent_application.domain.AgentApplicationBaseInfo;
import cn.com.poc.agent_application.domain.AgentApplicationCommConfig;
import cn.com.poc.agent_application.domain.AgentApplicationCommModelConfig;
import cn.com.poc.agent_application.domain.AgentApplicationKnowledgeConfig;
import cn.com.poc.agent_application.model.BizAgentApplicationPublishModel;
import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.dto.BizAgentApplicationPublishDto;
import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.model.BizAgentApplicationPublishModel;
import cn.com.poc.common.utils.JsonUtils;
import cn.hutool.core.util.ObjectUtil;
import com.tencent.core.utils.JsonUtil;
......@@ -16,7 +16,7 @@ import org.apache.commons.lang3.StringUtils;
public class BizAgentApplicationPublishConvert {
public static BizAgentApplicationPublishEntity modelToEntity(BizAgentApplicationPublishModel model){
public static BizAgentApplicationPublishEntity modelToEntity(BizAgentApplicationPublishModel model) {
BizAgentApplicationPublishEntity entity = new BizAgentApplicationPublishEntity();
entity.setId(model.getId());
entity.setMemberId(model.getMemberId());
......@@ -27,12 +27,11 @@ public class BizAgentApplicationPublishConvert {
entity.setAgentSystem(model.getAgentSystem());
entity.setPreamble(model.getPreamble());
entity.setIsLongMemory(model.getIsLongMemory());
entity.setIsFunction(model.getIsFunction());
if(StringUtils.isNotBlank(model.getVariableStructure())) {
if (StringUtils.isNotBlank(model.getVariableStructure())) {
entity.setVariableStructure(JsonUtils.deSerialize(model.getVariableStructure(), String[].class));
}
if(StringUtils.isNotBlank(model.getVariableStructure())) {
if (StringUtils.isNotBlank(model.getVariableStructure())) {
entity.setVariableStructure(JsonUtils.deSerialize(model.getVariableStructure(), String[].class));
}
if (StringUtils.isNotBlank(model.getFeaturedQuestions())) {
......@@ -59,7 +58,7 @@ public class BizAgentApplicationPublishConvert {
return entity;
}
public static BizAgentApplicationPublishModel entityToModel(BizAgentApplicationPublishEntity entity){
public static BizAgentApplicationPublishModel entityToModel(BizAgentApplicationPublishEntity entity) {
BizAgentApplicationPublishModel model = new BizAgentApplicationPublishModel();
model.setId(entity.getId());
model.setMemberId(entity.getMemberId());
......@@ -70,10 +69,6 @@ public class BizAgentApplicationPublishConvert {
model.setAgentSystem(entity.getAgentSystem());
model.setPreamble(entity.getPreamble());
model.setIsLongMemory(entity.getIsLongMemory());
model.setIsFunction(entity.getIsFunction());
if (ArrayUtils.isNotEmpty(entity.getFunctionName())) {
model.setFunctionName(JsonUtils.serialize(entity.getFunctionName()));
}
if (ArrayUtils.isNotEmpty(entity.getVariableStructure())) {
model.setVariableStructure(JsonUtils.serialize(entity.getVariableStructure()));
}
......@@ -101,7 +96,7 @@ public class BizAgentApplicationPublishConvert {
return model;
}
public static BizAgentApplicationPublishDto entityToDto(BizAgentApplicationPublishEntity entity){
public static BizAgentApplicationPublishDto entityToDto(BizAgentApplicationPublishEntity entity) {
BizAgentApplicationPublishDto dto = new BizAgentApplicationPublishDto();
AgentApplicationBaseInfo baseInfo = new AgentApplicationBaseInfo();
baseInfo.setMemberId(entity.getMemberId());
......@@ -121,8 +116,6 @@ public class BizAgentApplicationPublishConvert {
commConfig.setContinuousQuestionTurn(entity.getContinuousQuestionTurn());
commConfig.setVariableStructure(entity.getVariableStructure());
commConfig.setIsLongMemory(entity.getIsLongMemory());
commConfig.setIsFunction(entity.getIsFunction());
commConfig.setFunctionName(entity.getFunctionName());
AgentApplicationKnowledgeConfig knowledgeConfig = new AgentApplicationKnowledgeConfig();
knowledgeConfig.setKnowledgeIds(entity.getKnowledgeIds());
......@@ -143,7 +136,7 @@ public class BizAgentApplicationPublishConvert {
return dto;
}
public static BizAgentApplicationPublishEntity dtoToEntity(BizAgentApplicationPublishDto dto){
public static BizAgentApplicationPublishEntity dtoToEntity(BizAgentApplicationPublishDto dto) {
BizAgentApplicationPublishEntity entity = new BizAgentApplicationPublishEntity();
if (ObjectUtil.isNotEmpty(dto.getBaseInfo())) {
entity.setAgentId(dto.getBaseInfo().getAgentId());
......@@ -165,10 +158,6 @@ public class BizAgentApplicationPublishConvert {
entity.setContinuousQuestionSystem(dto.getCommConfig().getContinuousQuestionSystem());
entity.setContinuousQuestionTurn(dto.getCommConfig().getContinuousQuestionTurn());
entity.setIsLongMemory(dto.getCommConfig().getIsLongMemory());
entity.setIsFunction(dto.getCommConfig().getIsFunction());
if (ObjectUtil.isNotEmpty(dto.getCommConfig().getFunctionName())) {
entity.setFunctionName(dto.getCommConfig().getFunctionName());
}
if (ObjectUtil.isNotEmpty(dto.getCommConfig().getVariableStructure())) {
entity.setVariableStructure(dto.getCommConfig().getVariableStructure());
}
......
......@@ -75,57 +75,32 @@ public class AgentApplicationCommConfig {
this.continuousQuestionTurn = continuousQuestionTurn;
}
/** variable_structure
*变量结构
/**
* variable_structure
* 变量结构
*/
private java.lang.String[] variableStructure;
public java.lang.String[] getVariableStructure(){
public java.lang.String[] getVariableStructure() {
return this.variableStructure;
}
public void setVariableStructure(java.lang.String[] variableStructure){
public void setVariableStructure(java.lang.String[] variableStructure) {
this.variableStructure = variableStructure;
}
/** is_long_memory
*是否开启长期记忆 1、Y 是 2、N 否
/**
* is_long_memory
* 是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isLongMemory;
public java.lang.String getIsLongMemory(){
public java.lang.String getIsLongMemory() {
return this.isLongMemory;
}
public void setIsLongMemory(java.lang.String isLongMemory){
public void setIsLongMemory(java.lang.String isLongMemory) {
this.isLongMemory = isLongMemory;
}
/** function_name
*方法名
*/
private java.lang.String[] functionName;
public java.lang.String[] getFunctionName(){
return this.functionName;
}
public void setFunctionName(java.lang.String[] functionName){
this.functionName = functionName;
}
/** is_function
*是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isFunction;
public java.lang.String getIsFunction(){
return this.isFunction;
}
public void setIsFunction(java.lang.String isFunction){
this.isFunction = isFunction;
}
}
......@@ -261,32 +261,6 @@ public class BizAgentApplicationInfoEntity {
this.isLongMemory = isLongMemory;
}
/** function_name
*方法名
*/
private java.lang.String[] functionName;
public java.lang.String[] getFunctionName(){
return this.functionName;
}
public void setFunctionName(java.lang.String[] functionName){
this.functionName = functionName;
}
/** is_function
*是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isFunction;
public java.lang.String getIsFunction(){
return this.isFunction;
}
public void setIsFunction(java.lang.String isFunction){
this.isFunction = isFunction;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
......
......@@ -260,32 +260,7 @@ public class BizAgentApplicationPublishEntity {
this.isLongMemory = isLongMemory;
}
/** function_name
*方法名
*/
private java.lang.String[] functionName;
public java.lang.String[] getFunctionName(){
return this.functionName;
}
public void setFunctionName(java.lang.String[] functionName){
this.functionName = functionName;
}
/** is_function
*是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isFunction;
public java.lang.String getIsFunction(){
return this.isFunction;
}
public void setIsFunction(java.lang.String isFunction){
this.isFunction = isFunction;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
......
......@@ -359,38 +359,6 @@ public class BizAgentApplicationInfoModel extends BaseModelClass implements Seri
super.addValidField("isLongMemory");
}
/** function_name
* 方法名
*/
private java.lang.String functionName;
@Column(name = "function_name",length = 2147483647)
public java.lang.String getFunctionName(){
return this.functionName;
}
public void setFunctionName(java.lang.String functionName){
this.functionName = functionName;
super.addValidField("functionName");
}
/** is_function
*是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isFunction;
@Column(name = "is_function",length = 1)
public java.lang.String getIsFunction(){
return this.isFunction;
}
public void setIsFunction(java.lang.String isFunction){
this.isFunction = isFunction;
super.addValidField("isFunction");
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
......
......@@ -327,40 +327,6 @@ public class BizAgentApplicationPublishModel extends BaseModelClass implements S
super.addValidField("isLongMemory");
}
/** function_name
* 方法名
*/
private java.lang.String functionName;
@Column(name = "function_name",length = 2147483647)
public java.lang.String getFunctionName(){
return this.functionName;
}
public void setFunctionName(java.lang.String functionName){
this.functionName = functionName;
super.addValidField("functionName");
}
/** is_function
*是否开启长期记忆 1、Y 是 2、N 否
*/
private java.lang.String isFunction;
@Column(name = "is_function",length = 1)
public java.lang.String getIsFunction(){
return this.isFunction;
}
public void setIsFunction(java.lang.String isFunction){
this.isFunction = isFunction;
super.addValidField("isFunction");
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
......
package cn.com.poc.agent_application.rest.impl;
import cn.com.poc.agent_application.aggregate.AgentApplicationInfoService;
import cn.com.poc.agent_application.constant.AgentApplicationConstants;
import cn.com.poc.agent_application.convert.AgentApplicationInfoConvert;
import cn.com.poc.agent_application.dto.*;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
......@@ -15,15 +14,13 @@ import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.common.utils.ListUtils;
import cn.com.poc.knowledge.aggregate.KnowledgeService;
import cn.com.poc.knowledge.entity.BizKnowledgeInfoEntity;
import cn.com.poc.knowledge.service.BizKnowledgeInfoService;
import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Tool;
import cn.com.poc.thirdparty.resource.demand.ai.function.LargeModelFunctionEnum;
import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.data.model.PagingInfo;
import cn.hutool.core.collection.ListUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -32,7 +29,6 @@ import org.springframework.util.Assert;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.swing.plaf.ListUI;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
......@@ -146,10 +142,27 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
//获取知识库配置
List<Integer> kdIds = knowledgeService.getKdIdsByKnowledgeInfoIds(infoEntity.getKnowledgeIds());
//配置对话function
List<Tool> tools = new ArrayList<>();
//开启对话变量
if (ArrayUtils.isNotEmpty(infoEntity.getVariableStructure())) {
String functionName = "set_value_memory";
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getVariableStructureLLMConfig(infoEntity.getVariableStructure()).get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool);
}
//开启长期记忆
if (CommonConstant.YOrN.Y.equals(infoEntity.getIsLongMemory())) {
String functionName = "set_long_memory";
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getLLMConfig().get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool);
}
//调用应用服务
agentApplicationInfoService.callAgentApplication(infoEntity.getLargeModel(), infoEntity.getUnitIds()
agentApplicationInfoService.callAgentApplication(agentId, infoEntity.getLargeModel(), infoEntity.getUnitIds()
, infoEntity.getAgentSystem(), kdIds.toArray(new Integer[0]), infoEntity.getCommunicationTurn(), infoEntity.getTopP()
, dto.getMessages(), infoEntity.getIsLongMemory().equals(CommonConstant.IsDeleted.Y), infoEntity.getVariableStructure(), infoEntity.getIsFunction().equals(CommonConstant.IsDeleted.Y), infoEntity.getFunctionName(), null , AgentApplicationConstants.USE_AGENT_STATUS.PREVIEW,httpServletResponse);
, dto.getMessages(), tools, httpServletResponse);
} catch (Exception e) {
httpServletResponse.setContentType("text/event-stream");
PrintWriter writer = httpServletResponse.getWriter();
......
package cn.com.poc.expose.aggregate.impl;
import cn.com.poc.agent_application.aggregate.AgentApplicationInfoService;
import cn.com.poc.agent_application.constant.AgentApplicationConstants;
import cn.com.poc.agent_application.constant.AgentApplicationDialoguesRecordConstants;
import cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants;
import cn.com.poc.agent_application.entity.BizAgentApplicationDialoguesRecordEntity;
......@@ -14,16 +13,14 @@ import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.expose.aggregate.AgentApplicationService;
import cn.com.poc.expose.dto.AgentApplicationDto;
import cn.com.poc.expose.rest.AgentApplicationRest;
import cn.com.poc.knowledge.aggregate.KnowledgeService;
import cn.com.poc.knowledge.entity.BizKnowledgeInfoEntity;
import cn.com.poc.knowledge.service.BizKnowledgeInfoService;
import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Message;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.MultiContent;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Tool;
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelDemandResult;
import cn.com.poc.thirdparty.resource.demand.ai.entity.largemodel.LargeModelResponse;
import cn.com.poc.thirdparty.resource.demand.ai.function.LargeModelFunctionEnum;
import cn.com.poc.thirdparty.service.LLMService;
import cn.com.yict.framemax.core.exception.BusinessException;
import com.fasterxml.jackson.core.type.TypeReference;
......@@ -36,7 +33,6 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
......@@ -88,10 +84,26 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
List<Message> messages = new ArrayList<>();
buildMessages(dialogsId, agentId, userBaseEntity.getUserId(), messages, input);
//配置对话function
List<Tool> tools = new ArrayList<>();
//开启对话变量
if (ArrayUtils.isNotEmpty(infoEntity.getVariableStructure())) {
String functionName = "set_value_memory";
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getVariableStructureLLMConfig(infoEntity.getVariableStructure()).get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool);
}
//开启长期记忆
if (CommonConstant.YOrN.Y.equals(infoEntity.getIsLongMemory())) {
String functionName = "set_long_memory";
String llmConfig = LargeModelFunctionEnum.valueOf(functionName).getFunction().getLLMConfig().get(0);
Tool tool = JsonUtils.deSerialize(llmConfig, Tool.class);
tools.add(tool);
}
String output = agentApplicationInfoService.callAgentApplication(infoEntity.getLargeModel(), infoEntity.getUnitIds()
, infoEntity.getAgentSystem(), kdIdList.toArray(new Integer[0]), infoEntity.getCommunicationTurn(), infoEntity.getTopP()
, messages, infoEntity.getIsLongMemory().equals(CommonConstant.IsDeleted.Y), infoEntity.getVariableStructure(), infoEntity.getIsFunction().equals(CommonConstant.IsDeleted.Y), infoEntity.getFunctionName(), null, AgentApplicationConstants.USE_AGENT_STATUS.PUBLISH, httpServletResponse);
String output = agentApplicationInfoService.callAgentApplication(dialogsId, infoEntity.getLargeModel(),
infoEntity.getUnitIds(), infoEntity.getAgentSystem(), kdIdList.toArray(new Integer[0]), infoEntity.getCommunicationTurn(),
infoEntity.getTopP(), messages, tools, httpServletResponse);
//保存对话记录
......
......@@ -3,24 +3,18 @@ package cn.com.poc.thirdparty.resource.demand.ai.function;
import java.util.List;
public class AbstractLargeModelFunction {
public abstract class AbstractLargeModelFunction {
public String doFunction(String content, String key){
return null;
}
public abstract String doFunction(String content, String key);
/**
* 获取配置
*/
public List<String> getLLMConfig(){
return null;
}
public abstract List<String> getLLMConfig();
/**
* 获取有关变量的配置
*/
public List<String> getVariableStructureLLMConfig(String[] variableStructure) {
return null;
}
public abstract List<String> getVariableStructureLLMConfig(String[] variableStructure);
}
......@@ -35,6 +35,11 @@ public class SearchMemoryContentByNameFunction extends AbstractLargeModelFunctio
return result.toString();
}
@Override
public List<String> getLLMConfig() {
return null;
}
@Override
public List<String> getVariableStructureLLMConfig(String[] variableStructure) {
Map<String, Object> config = new HashMap<>();
......
......@@ -62,4 +62,9 @@ public class SearchMemoryContentFunction extends AbstractLargeModelFunction {
resultList.add(jsonString);
return resultList;
}
@Override
public List<String> getVariableStructureLLMConfig(String[] variableStructure) {
return null;
}
}
......@@ -28,7 +28,7 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
// 提取 content
String contents = jsonObject.getStr("content");
String contentKey = key + ":" + BlContext.getCurrentUserNotException().getUserId().toString() + ":" + "longMemory";
Map<Object, Object> hmget = redisService.hmget(contentKey);
Map<Object, Object> hmget = redisService.hmget(key);
Map<String, Object> result = new HashMap<>();
for (Map.Entry<Object, Object> entry : hmget.entrySet()) {
if (entry.getKey() instanceof String) {
......@@ -52,14 +52,14 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
Map<String, Object> content = new HashMap<>();
content.put("type", "string");
content.put("description","内容的详细说明");
content.put("description", "内容的详细说明");
Map<String, Object> properties = new HashMap<>();
properties.put("content", content);
Map<String, Object> parameters = new HashMap<>();
parameters.put("type", "object");
parameters.put("properties",properties);
parameters.put("properties", properties);
List<String> required = new ArrayList<>();
required.add("content");
......@@ -81,4 +81,9 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
resultList.add(jsonString);
return resultList;
}
@Override
public List<String> getVariableStructureLLMConfig(String[] variableStructure) {
return null;
}
}
......@@ -18,6 +18,7 @@ public class SetValueMemoryFunction extends AbstractLargeModelFunction {
private RedisService redisService;
@Override
//todo 保存【变量】方法重构
public String doFunction(String content, String key) {
// todo 执行保存变量的操作
// 创建 JSONObject 对象
......@@ -30,6 +31,11 @@ public class SetValueMemoryFunction extends AbstractLargeModelFunction {
return "SUCCESS";
}
@Override
public List<String> getLLMConfig() {
return null;
}
@Override
public List<String> getVariableStructureLLMConfig(String[] variableStructure) {
Map<String, Object> config = new HashMap<>();
......@@ -53,7 +59,7 @@ public class SetValueMemoryFunction extends AbstractLargeModelFunction {
properties.put("contentName", contentName);
properties.put("contentValue", contentValue);
parameters.put("properties", properties);
parameters.put("type","object");
parameters.put("type", "object");
function.put("name", "set_value_memory");
function.put("description", "用enum给定的内容名来保存用户想记录的内容值");
......
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