mirror of
https://github.com/slhaf/Partner.git
synced 2026-10-25 10:53:50 +00:00
推进核心服务与模块注册机制
- 完善Agent流程执行框架 - Api包下新增flow流程包,该部分对应模块的执行流程 - 明确ModuleFactory与CapabilityFactory以及ModuleHook的共同运作流程 - 调整了Hook注解名称
This commit is contained in:
Generated
+2
-1
@@ -1,9 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
<list size="2">
|
<list size="3">
|
||||||
<item index="0" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CapabilityMethod" />
|
<item index="0" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CapabilityMethod" />
|
||||||
<item index="1" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CoordinateManager" />
|
<item index="1" class="java.lang.String" itemvalue="work.slhaf.partner.api.capability.annotation.CoordinateManager" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="work.slhaf.partner.api.register.capability.annotation.Capability" />
|
||||||
</list>
|
</list>
|
||||||
</component>
|
</component>
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
|||||||
@@ -1,7 +1,17 @@
|
|||||||
package work.slhaf.partner.api;
|
package work.slhaf.partner.api;
|
||||||
|
|
||||||
public class Agent {
|
import work.slhaf.partner.api.entity.AgentContext;
|
||||||
public static void run(Class<?> clazz) {
|
import work.slhaf.partner.api.factory.AgentRegisterFactory;
|
||||||
|
import work.slhaf.partner.api.flow.AgentInteraction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent启动类
|
||||||
|
*/
|
||||||
|
public class Agent {
|
||||||
|
|
||||||
|
public static void run(Class<?> clazz) {
|
||||||
|
AgentContext context = AgentRegisterFactory.launch(clazz.getPackage().getName());
|
||||||
|
AgentInteraction.launch(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
package work.slhaf.partner.api;
|
|
||||||
|
|
||||||
import work.slhaf.partner.api.common.entity.AgentRegisterContext;
|
|
||||||
|
|
||||||
public class AgentRegisterFactory {
|
|
||||||
|
|
||||||
private AgentRegisterContext context = new AgentRegisterContext();
|
|
||||||
|
|
||||||
private AgentRegisterFactory(){}
|
|
||||||
|
|
||||||
public static void launch(){
|
|
||||||
//TODO 通过调用module与capability的注册逻辑,完成完整的注册过程,需要考虑hook机制
|
|
||||||
AgentRegisterFactory factory = new AgentRegisterFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
+6
-6
@@ -1,15 +1,15 @@
|
|||||||
package work.slhaf.partner.common.chat;
|
package work.slhaf.partner.api.common.chat;
|
||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatBody;
|
import work.slhaf.partner.api.common.chat.pojo.ChatBody;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.PrimaryChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.PrimaryChatResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
+1
-8
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.common.chat.constant;
|
package work.slhaf.partner.api.common.chat.constant;
|
||||||
|
|
||||||
public class ChatConstant {
|
public class ChatConstant {
|
||||||
|
|
||||||
@@ -7,13 +7,6 @@ public class ChatConstant {
|
|||||||
public static final String SYSTEM = "system";
|
public static final String SYSTEM = "system";
|
||||||
public static final String ASSISTANT = "assistant";
|
public static final String ASSISTANT = "assistant";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Model {
|
|
||||||
public static final String DEEP_SEEK_CHAT = "deepseek-chat";
|
|
||||||
public static final String GLM_4_FLASH = "glm-4_flash";
|
|
||||||
public static final String GLM_4_PLUS = "glm-4_plus";
|
|
||||||
public static final String GLM_4_0520 = "glm-4_0520";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Response {
|
public static class Response {
|
||||||
public static final String SUCCESS = "success";
|
public static final String SUCCESS = "success";
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.common.chat.pojo;
|
package work.slhaf.partner.api.common.chat.pojo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.common.chat.pojo;
|
package work.slhaf.partner.api.common.chat.pojo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package work.slhaf.partner.common.chat.pojo;
|
package work.slhaf.partner.api.common.chat.pojo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
package work.slhaf.partner.common.chat.pojo;
|
package work.slhaf.partner.api.common.chat.pojo;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.common.chat.pojo;
|
package work.slhaf.partner.api.common.chat.pojo;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
-10
@@ -1,10 +0,0 @@
|
|||||||
package work.slhaf.partner.api.common.entity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import org.reflections.Reflections;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class AgentRegisterContext {
|
|
||||||
//TODO 抽取出必要的注册工厂共用的上下文
|
|
||||||
private Reflections reflections;
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.common.serialize;
|
package work.slhaf.partner.api.common.entity;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package work.slhaf.partner.api.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AgentContext {
|
||||||
|
private HashMap<String, Function<Object[], Object>> methodsRouterTable;
|
||||||
|
private HashMap<String, Function<Object[], Object>> coordinatedMethodsRouterTable;
|
||||||
|
private HashMap<Class<?>, Object> capabilityCoreInstances;
|
||||||
|
private HashMap<Class<?>, Object> capabilityHolderInstances;
|
||||||
|
private Set<Class<?>> cores;
|
||||||
|
private Set<Class<?>> capabilities;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package work.slhaf.partner.api.factory;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import work.slhaf.partner.api.entity.AgentContext;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
|
import work.slhaf.partner.api.factory.capability.CapabilityCheckFactory;
|
||||||
|
import work.slhaf.partner.api.factory.capability.CapabilityRegisterFactory;
|
||||||
|
import work.slhaf.partner.api.factory.module.ModuleCheckFactory;
|
||||||
|
import work.slhaf.partner.api.factory.module.ModuleRegisterFactory;
|
||||||
|
|
||||||
|
public class AgentRegisterFactory {
|
||||||
|
|
||||||
|
private AgentRegisterFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AgentContext launch(String path) {
|
||||||
|
AgentRegisterContext registerContext = new AgentRegisterContext(path);
|
||||||
|
//流程
|
||||||
|
//1. 执行register和check逻辑
|
||||||
|
new CapabilityRegisterFactory().execute(registerContext);
|
||||||
|
new CapabilityCheckFactory().execute(registerContext);
|
||||||
|
new ModuleRegisterFactory().execute(registerContext);
|
||||||
|
new ModuleCheckFactory().execute(registerContext);
|
||||||
|
|
||||||
|
//2. 为module通过动态代理添加后hook逻辑并进行实例化
|
||||||
|
|
||||||
|
//3. 先一步注入Capability,避免因前hook逻辑存在针对能力的引用而报错
|
||||||
|
|
||||||
|
//4. 执行前hook逻辑
|
||||||
|
|
||||||
|
|
||||||
|
AgentContext agentContext = new AgentContext();
|
||||||
|
BeanUtil.copyProperties(registerContext,agentContext);
|
||||||
|
return agentContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+18
-180
@@ -1,178 +1,41 @@
|
|||||||
package work.slhaf.partner.api.capability;
|
package work.slhaf.partner.api.factory.capability;
|
||||||
|
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
import org.reflections.scanners.Scanners;
|
import work.slhaf.partner.api.factory.entity.AgentBaseFactory;
|
||||||
import org.reflections.util.ClasspathHelper;
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
import org.reflections.util.ConfigurationBuilder;
|
|
||||||
import work.slhaf.partner.api.capability.annotation.*;
|
|
||||||
import work.slhaf.partner.api.capability.exception.*;
|
|
||||||
import work.slhaf.partner.api.common.util.AgentUtil;
|
import work.slhaf.partner.api.common.util.AgentUtil;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.*;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.DuplicateCapabilityException;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.UnMatchedCapabilityException;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.UnMatchedCapabilityMethodException;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.UnMatchedCoordinatedMethodException;
|
||||||
|
|
||||||
import java.lang.reflect.*;
|
import java.lang.reflect.Method;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static work.slhaf.partner.api.common.util.AgentUtil.methodSignature;
|
import static work.slhaf.partner.api.common.util.AgentUtil.methodSignature;
|
||||||
|
|
||||||
|
public class CapabilityCheckFactory extends AgentBaseFactory {
|
||||||
public final class CapabilityRegisterFactory {
|
|
||||||
|
|
||||||
private Reflections reflections;
|
private Reflections reflections;
|
||||||
private final HashMap<String, Function<Object[], Object>> methodsRouterTable = new HashMap<>();
|
|
||||||
private final HashMap<String, Function<Object[], Object>> coordinatedMethodsRouterTable = new HashMap<>();
|
|
||||||
private final HashMap<Class<?>, Object> capabilityCoreInstances = new HashMap<>();
|
|
||||||
private final HashMap<Class<?>, Object> capabilityHolderInstances = new HashMap<>();
|
|
||||||
private Set<Class<?>> cores;
|
private Set<Class<?>> cores;
|
||||||
private Set<Class<?>> capabilities;
|
private Set<Class<?>> capabilities;
|
||||||
|
|
||||||
private CapabilityRegisterFactory() {
|
|
||||||
|
@Override
|
||||||
|
protected void setVariables(AgentRegisterContext context) {
|
||||||
|
reflections = context.getReflections();
|
||||||
|
cores = context.getCores();
|
||||||
|
capabilities = context.getCapabilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO 需决定是否分离检查与路由表生成、注入逻辑,如果分离,可进一步添加hook点,但目前似乎并非必要
|
@Override
|
||||||
public void registerCapabilities(String scannerPath) {
|
protected void run() {
|
||||||
setBasicVariable(scannerPath);
|
|
||||||
//检查可注册能力是否正常
|
|
||||||
statusCheck();
|
|
||||||
//扫描现有Capability, value为键,返回函数路由表, 函数路由表内部通过反射调用对应core的方法
|
|
||||||
generateRouterTable();
|
|
||||||
//通过动态代理注入能力
|
|
||||||
injectCapability();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateRouterTable() {
|
|
||||||
generateMethodsRouterTable();
|
|
||||||
generateCoordinatedMethodsRouterTable();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateCoordinatedMethodsRouterTable() {
|
|
||||||
Set<Method> methodsAnnotatedWith = reflections.getMethodsAnnotatedWith(Coordinated.class);
|
|
||||||
if (methodsAnnotatedWith.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
//获取所有CM实例
|
|
||||||
HashMap<String, Object> cognationManagerInstances = getCognationManagerInstances();
|
|
||||||
methodsAnnotatedWith.forEach(method -> {
|
|
||||||
String key = method.getAnnotation(Coordinated.class).capability() + "." + methodSignature(method);
|
|
||||||
Function<Object[], Object> function = args -> {
|
|
||||||
try {
|
|
||||||
return method.invoke(cognationManagerInstances.get(key), args);
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
coordinatedMethodsRouterTable.put(key, function);
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new FactoryExecuteFailedException("创建协调方法路由表出错", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private HashMap<String, Object> getCognationManagerInstances() throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
|
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
|
||||||
for (Class<?> c : reflections.getTypesAnnotatedWith(CoordinateManager.class)) {
|
|
||||||
Constructor<?> constructor = c.getDeclaredConstructor();
|
|
||||||
Object instance = constructor.newInstance();
|
|
||||||
|
|
||||||
Arrays.stream(c.getMethods())
|
|
||||||
.filter(method -> method.isAnnotationPresent(Coordinated.class))
|
|
||||||
.forEach(method -> {
|
|
||||||
String key = method.getAnnotation(Coordinated.class).capability() + "." + methodSignature(method);
|
|
||||||
map.put(key, instance);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setBasicVariable(String scannerPath) {
|
|
||||||
setReflections(scannerPath);
|
|
||||||
setAnnotatedClasses();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setAnnotatedClasses() {
|
|
||||||
cores = reflections.getTypesAnnotatedWith(CapabilityCore.class);
|
|
||||||
capabilities = reflections.getTypesAnnotatedWith(Capability.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setReflections(String scannerPath) {
|
|
||||||
//后续可替换为根据传入的启动类获取路径
|
|
||||||
Collection<URL> urls = ClasspathHelper.forPackage(scannerPath);
|
|
||||||
reflections = new Reflections(
|
|
||||||
new ConfigurationBuilder()
|
|
||||||
.setUrls(urls)
|
|
||||||
.setScanners(
|
|
||||||
Scanners.TypesAnnotated,
|
|
||||||
Scanners.MethodsAnnotated,
|
|
||||||
Scanners.SubTypes,
|
|
||||||
Scanners.FieldsAnnotated
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void generateMethodsRouterTable() {
|
|
||||||
//扫描`@Capability`与`@CapabilityMethod`注解的类与方法
|
|
||||||
//将`capabilityValue.methodSignature`作为key,函数对象为通过反射拿到的core实例对应的方法
|
|
||||||
cores.forEach(core -> Arrays.stream(core.getMethods())
|
|
||||||
.filter(method -> method.isAnnotationPresent(CapabilityMethod.class))
|
|
||||||
.forEach(method -> {
|
|
||||||
Function<Object[], Object> function = args -> {
|
|
||||||
try {
|
|
||||||
return method.invoke(capabilityCoreInstances.get(core), args);
|
|
||||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
String key = core.getAnnotation(CapabilityCore.class).value() + "." + methodSignature(method);
|
|
||||||
if (methodsRouterTable.containsKey(key)) {
|
|
||||||
throw new DuplicateMethodException("重复注册能力方法: " + core.getPackage().getName() + "." + core.getSimpleName() + "#" + method.getName());
|
|
||||||
}
|
|
||||||
methodsRouterTable.put(key, function);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void injectCapability() {
|
|
||||||
//获取现有的`@InjectCapability`注解所在字段,并获取对应的类,通过动态代理注入对象
|
|
||||||
Set<Field> fields = reflections.getFieldsAnnotatedWith(InjectCapability.class);
|
|
||||||
//在动态代理内部,通过函数路由表调用对应的方法
|
|
||||||
createProxy(fields);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createProxy(Set<Field> fields) {
|
|
||||||
try {
|
|
||||||
for (Field field : fields) {
|
|
||||||
field.setAccessible(true);
|
|
||||||
Class<?> fieldType = field.getType();
|
|
||||||
Object instance = Proxy.newProxyInstance(
|
|
||||||
fieldType.getClassLoader(),
|
|
||||||
new Class[]{fieldType},
|
|
||||||
(proxy, method, objects) -> {
|
|
||||||
if (method.isAnnotationPresent(ToCoordinated.class)) {
|
|
||||||
String key = method.getDeclaringClass().getAnnotation(Capability.class).value() + "." + methodSignature(method);
|
|
||||||
return coordinatedMethodsRouterTable.get(key).apply(objects);
|
|
||||||
}
|
|
||||||
String key = fieldType.getAnnotation(Capability.class).value() + "." + methodSignature(method);
|
|
||||||
return methodsRouterTable.get(key).apply(objects);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
field.set(capabilityHolderInstances.get(field.getDeclaringClass()), instance);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new ProxySetFailedException("代理设置失败", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void statusCheck() {
|
|
||||||
capabilityHolderCheck();
|
|
||||||
checkCountAndCapabilities();
|
checkCountAndCapabilities();
|
||||||
checkCapabilityMethods();
|
checkCapabilityMethods();
|
||||||
checkCoordinatedMethods();
|
checkCoordinatedMethods();
|
||||||
checkInjectCapability();
|
checkInjectCapability();
|
||||||
//检查完毕,设置core的实例类
|
|
||||||
setCapabilityCoreInstances();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkInjectCapability() {
|
private void checkInjectCapability() {
|
||||||
@@ -183,25 +46,6 @@ public final class CapabilityRegisterFactory {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void capabilityHolderCheck() {
|
|
||||||
if (capabilityHolderInstances.isEmpty()) {
|
|
||||||
throw new EmptyCapabilityHolderException("Capability 持有者实例为空");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setCapabilityCoreInstances() {
|
|
||||||
try {
|
|
||||||
for (Class<?> core : cores) {
|
|
||||||
Constructor<?> constructor = core.getDeclaredConstructor();
|
|
||||||
constructor.setAccessible(true);
|
|
||||||
capabilityCoreInstances.put(core, constructor.newInstance());
|
|
||||||
}
|
|
||||||
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException |
|
|
||||||
IllegalAccessException e) {
|
|
||||||
throw new CoreInstancesCreateFailedException("core实例创建失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkCoordinatedMethods() {
|
private void checkCoordinatedMethods() {
|
||||||
//检查各个capability中是否含有ToCoordinated注解
|
//检查各个capability中是否含有ToCoordinated注解
|
||||||
//如果含有,则需要查找AbstractCognationManager的子类,看这里是否有对应的Coordinated注解所在方法
|
//如果含有,则需要查找AbstractCognationManager的子类,看这里是否有对应的Coordinated注解所在方法
|
||||||
@@ -249,7 +93,6 @@ public final class CapabilityRegisterFactory {
|
|||||||
return methodsCoordinated;
|
return methodsCoordinated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void checkCapabilityMethods() {
|
private void checkCapabilityMethods() {
|
||||||
HashMap<String, List<Method>> capabilitiesMethods = getCapabilityMethods(capabilities);
|
HashMap<String, List<Method>> capabilitiesMethods = getCapabilityMethods(capabilities);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -317,7 +160,6 @@ public final class CapabilityRegisterFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean checkValuesMatched(Set<Class<?>> cores, Set<Class<?>> capabilities) {
|
private boolean checkValuesMatched(Set<Class<?>> cores, Set<Class<?>> capabilities) {
|
||||||
Set<String> coresValues = new HashSet<>();
|
Set<String> coresValues = new HashSet<>();
|
||||||
Set<String> capabilitiesValues = new HashSet<>();
|
Set<String> capabilitiesValues = new HashSet<>();
|
||||||
@@ -342,10 +184,6 @@ public final class CapabilityRegisterFactory {
|
|||||||
return coresValues.equals(capabilitiesValues);
|
return coresValues.equals(capabilitiesValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerModule(CapabilityHolder capabilityHolder) {
|
|
||||||
capabilityHolderInstances.put(capabilityHolder.getClass(), capabilityHolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
record LackRecord(List<String> coreLack, List<String> capLack) {
|
record LackRecord(List<String> coreLack, List<String> capLack) {
|
||||||
public boolean hasNotEmptyRecord() {
|
public boolean hasNotEmptyRecord() {
|
||||||
return !coreLack.isEmpty() || !capLack.isEmpty();
|
return !coreLack.isEmpty() || !capLack.isEmpty();
|
||||||
+67
@@ -0,0 +1,67 @@
|
|||||||
|
package work.slhaf.partner.api.factory.capability;
|
||||||
|
|
||||||
|
import org.reflections.Reflections;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentBaseFactory;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.Capability;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.ToCoordinated;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.ProxySetFailedException;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Proxy;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static work.slhaf.partner.api.common.util.AgentUtil.methodSignature;
|
||||||
|
|
||||||
|
public class CapabilityInjectFactory extends AgentBaseFactory {
|
||||||
|
|
||||||
|
private Reflections reflections;
|
||||||
|
private HashMap<String, Function<Object[], Object>> coordinatedMethodsRouterTable;
|
||||||
|
private HashMap<String, Function<Object[], Object>> methodsRouterTable;
|
||||||
|
private HashMap<Class<?>, Object> capabilityHolderInstances;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setVariables(AgentRegisterContext context) {
|
||||||
|
reflections = context.getReflections();
|
||||||
|
coordinatedMethodsRouterTable = context.getCoordinatedMethodsRouterTable();
|
||||||
|
methodsRouterTable = context.getMethodsRouterTable();
|
||||||
|
capabilityHolderInstances = context.getCapabilityHolderInstances();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void run() {
|
||||||
|
//获取现有的`@InjectCapability`注解所在字段,并获取对应的类,通过动态代理注入对象
|
||||||
|
Set<Field> fields = reflections.getFieldsAnnotatedWith(InjectCapability.class);
|
||||||
|
//在动态代理内部,通过函数路由表调用对应的方法
|
||||||
|
createProxy(fields);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createProxy(Set<Field> fields) {
|
||||||
|
try {
|
||||||
|
for (Field field : fields) {
|
||||||
|
field.setAccessible(true);
|
||||||
|
Class<?> fieldType = field.getType();
|
||||||
|
Object instance = Proxy.newProxyInstance(
|
||||||
|
fieldType.getClassLoader(),
|
||||||
|
new Class[]{fieldType},
|
||||||
|
(proxy, method, objects) -> {
|
||||||
|
if (method.isAnnotationPresent(ToCoordinated.class)) {
|
||||||
|
String key = method.getDeclaringClass().getAnnotation(Capability.class).value() + "." + methodSignature(method);
|
||||||
|
return coordinatedMethodsRouterTable.get(key).apply(objects);
|
||||||
|
}
|
||||||
|
String key = fieldType.getAnnotation(Capability.class).value() + "." + methodSignature(method);
|
||||||
|
return methodsRouterTable.get(key).apply(objects);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
field.set(capabilityHolderInstances.get(field.getDeclaringClass()), instance);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ProxySetFailedException("代理设置失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+142
@@ -0,0 +1,142 @@
|
|||||||
|
package work.slhaf.partner.api.factory.capability;
|
||||||
|
|
||||||
|
import org.reflections.Reflections;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentBaseFactory;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.*;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.CoreInstancesCreateFailedException;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.DuplicateMethodException;
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.FactoryExecuteFailedException;
|
||||||
|
|
||||||
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import static work.slhaf.partner.api.common.util.AgentUtil.methodSignature;
|
||||||
|
|
||||||
|
|
||||||
|
public final class CapabilityRegisterFactory extends AgentBaseFactory {
|
||||||
|
|
||||||
|
private Reflections reflections;
|
||||||
|
private HashMap<String, Function<Object[], Object>> methodsRouterTable;
|
||||||
|
private HashMap<String, Function<Object[], Object>> coordinatedMethodsRouterTable;
|
||||||
|
private HashMap<Class<?>, Object> capabilityCoreInstances;
|
||||||
|
private HashMap<Class<?>, Object> capabilityHolderInstances;
|
||||||
|
private Set<Class<?>> cores;
|
||||||
|
private Set<Class<?>> capabilities;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setVariables(AgentRegisterContext context) {
|
||||||
|
reflections = context.getReflections();
|
||||||
|
methodsRouterTable = context.getMethodsRouterTable();
|
||||||
|
coordinatedMethodsRouterTable = context.getCoordinatedMethodsRouterTable();
|
||||||
|
capabilityCoreInstances = context.getCapabilityCoreInstances();
|
||||||
|
capabilityHolderInstances = context.getCapabilityHolderInstances();
|
||||||
|
cores = context.getCores();
|
||||||
|
capabilities = context.getCapabilities();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void run() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||||
|
setCapabilityCoreInstances();
|
||||||
|
setAnnotatedClasses();
|
||||||
|
generateRouterTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAnnotatedClasses() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||||
|
cores.addAll(reflections.getTypesAnnotatedWith(CapabilityCore.class));
|
||||||
|
capabilities.addAll(reflections.getTypesAnnotatedWith(Capability.class));
|
||||||
|
setCapabilityHolderInstances();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCapabilityHolderInstances() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
|
||||||
|
for (Class<?> clazz : reflections.getTypesAnnotatedWith(CapabilityHolder.class)) {
|
||||||
|
Object o = clazz.getDeclaredConstructor().newInstance();
|
||||||
|
capabilityHolderInstances.put(clazz, o);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateRouterTable() {
|
||||||
|
generateMethodsRouterTable();
|
||||||
|
generateCoordinatedMethodsRouterTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateCoordinatedMethodsRouterTable() {
|
||||||
|
Set<Method> methodsAnnotatedWith = reflections.getMethodsAnnotatedWith(Coordinated.class);
|
||||||
|
if (methodsAnnotatedWith.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
//获取所有CM实例
|
||||||
|
HashMap<String, Object> coordinateManagerInstances = getCoordinateManagerInstances();
|
||||||
|
methodsAnnotatedWith.forEach(method -> {
|
||||||
|
String key = method.getAnnotation(Coordinated.class).capability() + "." + methodSignature(method);
|
||||||
|
Function<Object[], Object> function = args -> {
|
||||||
|
try {
|
||||||
|
return method.invoke(coordinateManagerInstances.get(key), args);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
coordinatedMethodsRouterTable.put(key, function);
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FactoryExecuteFailedException("创建协调方法路由表出错", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private HashMap<String, Object> getCoordinateManagerInstances() throws InvocationTargetException, InstantiationException, IllegalAccessException, NoSuchMethodException {
|
||||||
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
for (Class<?> c : reflections.getTypesAnnotatedWith(CoordinateManager.class)) {
|
||||||
|
Constructor<?> constructor = c.getDeclaredConstructor();
|
||||||
|
Object instance = constructor.newInstance();
|
||||||
|
|
||||||
|
Arrays.stream(c.getMethods())
|
||||||
|
.filter(method -> method.isAnnotationPresent(Coordinated.class))
|
||||||
|
.forEach(method -> {
|
||||||
|
String key = method.getAnnotation(Coordinated.class).capability() + "." + methodSignature(method);
|
||||||
|
map.put(key, instance);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void generateMethodsRouterTable() {
|
||||||
|
//扫描`@Capability`与`@CapabilityMethod`注解的类与方法
|
||||||
|
//将`capabilityValue.methodSignature`作为key,函数对象为通过反射拿到的core实例对应的方法
|
||||||
|
cores.forEach(core -> Arrays.stream(core.getMethods())
|
||||||
|
.filter(method -> method.isAnnotationPresent(CapabilityMethod.class))
|
||||||
|
.forEach(method -> {
|
||||||
|
Function<Object[], Object> function = args -> {
|
||||||
|
try {
|
||||||
|
return method.invoke(capabilityCoreInstances.get(core), args);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
String key = core.getAnnotation(CapabilityCore.class).value() + "." + methodSignature(method);
|
||||||
|
if (methodsRouterTable.containsKey(key)) {
|
||||||
|
throw new DuplicateMethodException("重复注册能力方法: " + core.getPackage().getName() + "." + core.getSimpleName() + "#" + method.getName());
|
||||||
|
}
|
||||||
|
methodsRouterTable.put(key, function);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setCapabilityCoreInstances() {
|
||||||
|
try {
|
||||||
|
for (Class<?> core : cores) {
|
||||||
|
Constructor<?> constructor = core.getDeclaredConstructor();
|
||||||
|
constructor.setAccessible(true);
|
||||||
|
capabilityCoreInstances.put(core, constructor.newInstance());
|
||||||
|
}
|
||||||
|
} catch (InvocationTargetException | NoSuchMethodException | InstantiationException |
|
||||||
|
IllegalAccessException e) {
|
||||||
|
throw new CoreInstancesCreateFailedException("core实例创建失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.annotation;
|
package work.slhaf.partner.api.factory.capability.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class CapabilityCheckFailedException extends RuntimeException {
|
public class CapabilityCheckFailedException extends RuntimeException {
|
||||||
public CapabilityCheckFailedException(String message) {
|
public CapabilityCheckFailedException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class CoreInstancesCreateFailedException extends FactoryExecuteFailedException {
|
public class CoreInstancesCreateFailedException extends FactoryExecuteFailedException {
|
||||||
public CoreInstancesCreateFailedException(String message) {
|
public CoreInstancesCreateFailedException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class DuplicateCapabilityException extends CapabilityCheckFailedException {
|
public class DuplicateCapabilityException extends CapabilityCheckFailedException {
|
||||||
public DuplicateCapabilityException(String message) {
|
public DuplicateCapabilityException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class DuplicateMethodException extends CapabilityCheckFailedException{
|
public class DuplicateMethodException extends CapabilityCheckFailedException{
|
||||||
public DuplicateMethodException(String message) {
|
public DuplicateMethodException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class EmptyCapabilityHolderException extends CapabilityCheckFailedException{
|
public class EmptyCapabilityHolderException extends CapabilityCheckFailedException{
|
||||||
public EmptyCapabilityHolderException(String message) {
|
public EmptyCapabilityHolderException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class FactoryExecuteFailedException extends RuntimeException {
|
public class FactoryExecuteFailedException extends RuntimeException {
|
||||||
public FactoryExecuteFailedException(String message) {
|
public FactoryExecuteFailedException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class ProxySetFailedException extends FactoryExecuteFailedException{
|
public class ProxySetFailedException extends FactoryExecuteFailedException{
|
||||||
public ProxySetFailedException(String message) {
|
public ProxySetFailedException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class UnMatchedCapabilityException extends CapabilityCheckFailedException{
|
public class UnMatchedCapabilityException extends CapabilityCheckFailedException{
|
||||||
public UnMatchedCapabilityException(String message) {
|
public UnMatchedCapabilityException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class UnMatchedCapabilityMethodException extends CapabilityCheckFailedException {
|
public class UnMatchedCapabilityMethodException extends CapabilityCheckFailedException {
|
||||||
public UnMatchedCapabilityMethodException(String message) {
|
public UnMatchedCapabilityMethodException(String message) {
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package work.slhaf.partner.api.capability.exception;
|
package work.slhaf.partner.api.factory.capability.exception;
|
||||||
|
|
||||||
public class UnMatchedCoordinatedMethodException extends CapabilityCheckFailedException {
|
public class UnMatchedCoordinatedMethodException extends CapabilityCheckFailedException {
|
||||||
public UnMatchedCoordinatedMethodException(String message) {
|
public UnMatchedCoordinatedMethodException(String message) {
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package work.slhaf.partner.api.factory.entity;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.factory.capability.exception.FactoryExecuteFailedException;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
|
public abstract class AgentBaseFactory {
|
||||||
|
public void execute(AgentRegisterContext context) {
|
||||||
|
try {
|
||||||
|
setVariables(context);
|
||||||
|
run();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FactoryExecuteFailedException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void setVariables(AgentRegisterContext context);
|
||||||
|
|
||||||
|
protected abstract void run() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException;
|
||||||
|
}
|
||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package work.slhaf.partner.api.factory.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AgentRegisterContext {
|
||||||
|
private Reflections reflections;
|
||||||
|
private final HashMap<String, Function<Object[], Object>> methodsRouterTable = new HashMap<>();
|
||||||
|
private final HashMap<String, Function<Object[], Object>> coordinatedMethodsRouterTable = new HashMap<>();
|
||||||
|
private final HashMap<Class<?>, Object> capabilityCoreInstances = new HashMap<>();
|
||||||
|
private final HashMap<Class<?>, Object> capabilityHolderInstances = new HashMap<>();
|
||||||
|
private Set<Class<?>> cores;
|
||||||
|
private Set<Class<?>> capabilities;
|
||||||
|
|
||||||
|
public AgentRegisterContext(String path) {
|
||||||
|
reflections = new Reflections(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentBaseFactory;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
|
|
||||||
|
public class ModuleCheckFactory extends AgentBaseFactory {
|
||||||
|
@Override
|
||||||
|
protected void setVariables(AgentRegisterContext context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void run() {
|
||||||
|
//检查注解AgentModule所在类是否继承了AgentInteractionModule
|
||||||
|
//检查hook注解所在方法是否位于AgentInteractionModule子类/AgentInteractionSubModule子类/ActivateModel子类
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module;
|
||||||
|
|
||||||
|
public class ModuleHookExecutor {
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module;
|
||||||
|
|
||||||
|
import org.reflections.Reflections;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentBaseFactory;
|
||||||
|
import work.slhaf.partner.api.factory.entity.AgentRegisterContext;
|
||||||
|
|
||||||
|
public class ModuleRegisterFactory extends AgentBaseFactory {
|
||||||
|
|
||||||
|
private Reflections reflections;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setVariables(AgentRegisterContext context) {
|
||||||
|
reflections = context.getReflections();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void run() {
|
||||||
|
//反射扫描获取InteractionModule所在类与hook注解所在方法
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module.annotation;
|
||||||
|
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface After {
|
||||||
|
int order() default 0;
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用于注解执行模块
|
||||||
|
*/
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface AgentModule {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块名称
|
||||||
|
*/
|
||||||
|
String name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块执行顺序,数字越小执行越靠前
|
||||||
|
*/
|
||||||
|
int order();
|
||||||
|
}
|
||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
package work.slhaf.partner.api.factory.module.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Before {
|
||||||
|
int order() default 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package work.slhaf.partner.api.flow;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.entity.AgentContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Agent执行流程
|
||||||
|
*/
|
||||||
|
public class AgentInteraction {
|
||||||
|
|
||||||
|
private AgentInteraction(){}
|
||||||
|
|
||||||
|
public static void launch(AgentContext context){
|
||||||
|
//流程执行启动,需考虑模块热插拔,可结合http调整模块启用情况,并序列化至本地或数据库中
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package work.slhaf.partner.api.flow.abstracts;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.common.chat.ChatClient;
|
||||||
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
import work.slhaf.partner.api.factory.module.annotation.Before;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ActivateModel {
|
||||||
|
|
||||||
|
|
||||||
|
@Before
|
||||||
|
default void modelSettings() {
|
||||||
|
// Model model = new Model();
|
||||||
|
// ModelConfig modelConfig = ModelConfig.load(modelKey());
|
||||||
|
// model.setBaseMessages(withAwareness() ? ResourcesUtil.Prompt.loadPromptWithSelfAwareness(modelKey(), promptModule()) : ResourcesUtil.Prompt.loadPrompt(modelKey(), promptModule()));
|
||||||
|
// model.setChatClient(new ChatClient(modelConfig.getBaseUrl(), modelConfig.getApikey(), modelConfig.getModel()));
|
||||||
|
}
|
||||||
|
|
||||||
|
default ChatResponse chat() {
|
||||||
|
Model model = getModel();
|
||||||
|
List<Message> temp = new ArrayList<>();
|
||||||
|
temp.addAll(model.getBaseMessages());
|
||||||
|
temp.addAll(model.getChatMessages());
|
||||||
|
return model.getChatClient().runChat(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
default ChatResponse singleChat(String input) {
|
||||||
|
Model model = getModel();
|
||||||
|
List<Message> temp = new ArrayList<>(model.getBaseMessages());
|
||||||
|
temp.add(new Message(ChatConstant.Character.USER, input));
|
||||||
|
return model.getChatClient().runChat(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
default void updateChatClientSettings() {
|
||||||
|
Model model = getModel();
|
||||||
|
model.getChatClient().setTemperature(0.4);
|
||||||
|
model.getChatClient().setTop_p(0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<Message> chatMessages() {
|
||||||
|
return getModel().getChatMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
default List<Message> baseMessages() {
|
||||||
|
return getModel().getBaseMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
default ChatClient chatClient() {
|
||||||
|
return getModel().getChatClient();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅适用Module子类,否则需要重写
|
||||||
|
*
|
||||||
|
* @return 持有的model实例
|
||||||
|
*/
|
||||||
|
default Model getModel() {
|
||||||
|
return ((Module) this).getModel();
|
||||||
|
}
|
||||||
|
|
||||||
|
default void setModel(Model model) {
|
||||||
|
((Module) this).setModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
String modelKey();
|
||||||
|
|
||||||
|
boolean withAwareness();
|
||||||
|
|
||||||
|
String promptModule();
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package work.slhaf.partner.api.flow.abstracts;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.flow.entity.InteractionFlowContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程执行模块基类
|
||||||
|
*/
|
||||||
|
public abstract class AgentInteractionModule extends Module {
|
||||||
|
public abstract void execute(InteractionFlowContext context);
|
||||||
|
}
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
package work.slhaf.partner.api.flow.abstracts;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程子模块基类
|
||||||
|
* @param <I> 输入类型
|
||||||
|
* @param <O> 输出类型
|
||||||
|
*/
|
||||||
|
public abstract class AgentInteractionSubModule<I, O> extends Module {
|
||||||
|
|
||||||
|
public abstract O execute(I data);
|
||||||
|
|
||||||
|
}
|
||||||
+3
-3
@@ -1,8 +1,8 @@
|
|||||||
package work.slhaf.partner.module.common.model;
|
package work.slhaf.partner.api.flow.abstracts;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.ChatClient;
|
import work.slhaf.partner.api.common.chat.ChatClient;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package work.slhaf.partner.api.flow.abstracts;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityHolder;
|
||||||
|
|
||||||
|
@CapabilityHolder
|
||||||
|
public abstract class Module {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
protected Model model = new Model();
|
||||||
|
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package work.slhaf.partner.api.flow.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 流程上下文
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class InteractionFlowContext {
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package work.slhaf.partner.api.module;
|
|
||||||
|
|
||||||
public class ModuleRegisterFactory {
|
|
||||||
}
|
|
||||||
@@ -12,21 +12,6 @@
|
|||||||
<artifactId>Partner-Main</artifactId>
|
<artifactId>Partner-Main</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba</groupId>
|
|
||||||
<artifactId>fastjson</artifactId>
|
|
||||||
<version>2.0.56</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-io</groupId>
|
|
||||||
<artifactId>commons-io</artifactId>
|
|
||||||
<version>2.18.0</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>cn.hutool</groupId>
|
|
||||||
<artifactId>hutool-all</artifactId>
|
|
||||||
<version>5.8.36</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.java-websocket</groupId>
|
<groupId>org.java-websocket</groupId>
|
||||||
<artifactId>Java-WebSocket</artifactId>
|
<artifactId>Java-WebSocket</artifactId>
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ public class Config {
|
|||||||
new ModuleConfig(CoreModel.class.getName(), ModuleConfig.Constant.INTERNAL, null),
|
new ModuleConfig(CoreModel.class.getName(), ModuleConfig.Constant.INTERNAL, null),
|
||||||
new ModuleConfig(PostprocessExecutor.class.getName(),ModuleConfig.Constant.INTERNAL,null),
|
new ModuleConfig(PostprocessExecutor.class.getName(),ModuleConfig.Constant.INTERNAL,null),
|
||||||
new ModuleConfig(MemoryUpdater.class.getName(), ModuleConfig.Constant.INTERNAL, null)
|
new ModuleConfig(MemoryUpdater.class.getName(), ModuleConfig.Constant.INTERNAL, null)
|
||||||
// new ModuleConfig(TaskScheduler.class.getName(), ModuleConfig.Constant.INTERNAL, null)
|
|
||||||
);
|
);
|
||||||
config.setModuleConfigList(moduleConfigList);
|
config.setModuleConfigList(moduleConfigList);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.common.exception_handler.pojo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCore;
|
import work.slhaf.partner.core.cognation.cognation.CognationCore;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
import work.slhaf.partner.core.session.SessionManager;
|
import work.slhaf.partner.core.session.SessionManager;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package work.slhaf.partner.common.util;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSONArray;
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
import work.slhaf.partner.Agent;
|
import work.slhaf.partner.Agent;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@ package work.slhaf.partner.core.cognation;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.CoordinateManager;
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
import work.slhaf.partner.api.capability.annotation.Coordinated;
|
import work.slhaf.partner.api.factory.capability.annotation.CoordinateManager;
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
import work.slhaf.partner.api.factory.capability.annotation.Coordinated;
|
||||||
import work.slhaf.partner.common.exception_handler.GlobalExceptionHandler;
|
import work.slhaf.partner.common.exception_handler.GlobalExceptionHandler;
|
||||||
import work.slhaf.partner.common.exception_handler.pojo.GlobalException;
|
import work.slhaf.partner.common.exception_handler.pojo.GlobalException;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCore;
|
import work.slhaf.partner.core.cognation.cognation.CognationCore;
|
||||||
|
|||||||
+4
-4
@@ -1,9 +1,9 @@
|
|||||||
package work.slhaf.partner.core.cognation.cognation;
|
package work.slhaf.partner.core.cognation.cognation;
|
||||||
|
|
||||||
import work.slhaf.partner.api.capability.annotation.Capability;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityMethod;
|
import work.slhaf.partner.api.factory.capability.annotation.Capability;
|
||||||
import work.slhaf.partner.api.capability.annotation.ToCoordinated;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityMethod;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.factory.capability.annotation.ToCoordinated;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
+3
-3
@@ -4,9 +4,9 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityCore;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityCore;
|
||||||
import work.slhaf.partner.core.cognation.cognation.pojo.ActiveData;
|
import work.slhaf.partner.core.cognation.cognation.pojo.ActiveData;
|
||||||
import work.slhaf.partner.core.cognation.submodule.cache.CacheCore;
|
import work.slhaf.partner.core.cognation.submodule.cache.CacheCore;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.MemoryCore;
|
import work.slhaf.partner.core.cognation.submodule.memory.MemoryCore;
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.core.cognation.common.pojo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.cognation.common.pojo;
|
|||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package work.slhaf.partner.core.cognation.submodule.cache;
|
package work.slhaf.partner.core.cognation.submodule.cache;
|
||||||
|
|
||||||
import work.slhaf.partner.api.capability.annotation.Capability;
|
import work.slhaf.partner.api.factory.capability.annotation.Capability;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
Vendored
+3
-3
@@ -3,9 +3,9 @@ package work.slhaf.partner.core.cognation.submodule.cache;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityCore;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityMethod;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityCore;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityMethod;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package work.slhaf.partner.core.cognation.submodule.dispatch;
|
package work.slhaf.partner.core.cognation.submodule.dispatch;
|
||||||
|
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.cognation.submodule.dispatch.pojo.DispatchData;
|
import work.slhaf.partner.core.cognation.submodule.dispatch.pojo.DispatchData;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
package work.slhaf.partner.core.cognation.submodule.memory;
|
package work.slhaf.partner.core.cognation.submodule.memory;
|
||||||
|
|
||||||
import work.slhaf.partner.api.capability.annotation.Capability;
|
import work.slhaf.partner.api.factory.capability.annotation.Capability;
|
||||||
import work.slhaf.partner.api.capability.annotation.ToCoordinated;
|
import work.slhaf.partner.api.factory.capability.annotation.ToCoordinated;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@ package work.slhaf.partner.core.cognation.submodule.memory;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityCore;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityMethod;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityCore;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityMethod;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemorySliceResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemorySliceResult;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.exception.UnExistedDateIndexException;
|
import work.slhaf.partner.core.cognation.submodule.memory.exception.UnExistedDateIndexException;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.cognation.submodule.memory.pojo;
|
|||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|||||||
+2
-2
@@ -3,8 +3,8 @@ package work.slhaf.partner.core.cognation.submodule.memory.pojo;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.cognation.submodule.memory.pojo.node;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.exception.NullSliceListException;
|
import work.slhaf.partner.core.cognation.submodule.memory.exception.NullSliceListException;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.core.cognation.submodule.memory.pojo.node;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
package work.slhaf.partner.core.cognation.submodule.perceive;
|
package work.slhaf.partner.core.cognation.submodule.perceive;
|
||||||
|
|
||||||
import work.slhaf.partner.api.capability.annotation.Capability;
|
import work.slhaf.partner.api.factory.capability.annotation.Capability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
||||||
|
|
||||||
@Capability(value = "perceive")
|
@Capability(value = "perceive")
|
||||||
|
|||||||
+3
-3
@@ -2,9 +2,9 @@ package work.slhaf.partner.core.cognation.submodule.perceive;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityCore;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityMethod;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityCore;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.factory.capability.annotation.CapabilityMethod;
|
||||||
import work.slhaf.partner.core.cognation.cognation.exception.UserNotExistsException;
|
import work.slhaf.partner.core.cognation.cognation.exception.UserNotExistsException;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.core.cognation.submodule.perceive.pojo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.interaction.data.context;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.core.interaction.data.context.subcontext.CoreContext;
|
import work.slhaf.partner.core.interaction.data.context.subcontext.CoreContext;
|
||||||
import work.slhaf.partner.core.interaction.data.context.subcontext.ModuleContext;
|
import work.slhaf.partner.core.interaction.data.context.subcontext.ModuleContext;
|
||||||
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.interaction.data.context.subcontext;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.core.interaction.data.context.subcontext;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.MetaMessage;
|
import work.slhaf.partner.api.common.chat.pojo.MetaMessage;
|
||||||
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
import work.slhaf.partner.common.config.Config;
|
import work.slhaf.partner.common.config.Config;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.common.entity;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.serialize.PersistableObject;
|
import work.slhaf.partner.api.common.entity.PersistableObject;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
package work.slhaf.partner.module.common.model;
|
|
||||||
|
|
||||||
import work.slhaf.partner.common.chat.ChatClient;
|
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
|
||||||
import work.slhaf.partner.common.config.ModelConfig;
|
|
||||||
import work.slhaf.partner.common.util.ResourcesUtil;
|
|
||||||
import work.slhaf.partner.module.common.module.Module;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface ActivateModel {
|
|
||||||
|
|
||||||
default void modelSettings() {
|
|
||||||
Model model = new Model();
|
|
||||||
ModelConfig modelConfig = ModelConfig.load(modelKey());
|
|
||||||
model.setBaseMessages(withAwareness() ? ResourcesUtil.Prompt.loadPromptWithSelfAwareness(modelKey(), promptModule()) : ResourcesUtil.Prompt.loadPrompt(modelKey(), promptModule()));
|
|
||||||
model.setChatClient(new ChatClient(modelConfig.getBaseUrl(), modelConfig.getApikey(), modelConfig.getModel()));
|
|
||||||
}
|
|
||||||
|
|
||||||
default ChatResponse chat() {
|
|
||||||
Model model = getModel();
|
|
||||||
List<Message> temp = new ArrayList<>();
|
|
||||||
temp.addAll(model.baseMessages);
|
|
||||||
temp.addAll(model.chatMessages);
|
|
||||||
return model.chatClient.runChat(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
default ChatResponse singleChat(String input) {
|
|
||||||
Model model = getModel();
|
|
||||||
List<Message> temp = new ArrayList<>(model.baseMessages);
|
|
||||||
temp.add(new Message(ChatConstant.Character.USER, input));
|
|
||||||
return model.chatClient.runChat(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
default void updateChatClientSettings() {
|
|
||||||
Model model = getModel();
|
|
||||||
model.chatClient.setTemperature(0.4);
|
|
||||||
model.chatClient.setTop_p(0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<Message> chatMessages() {
|
|
||||||
return getModel().getChatMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
default List<Message> baseMessages() {
|
|
||||||
return getModel().getBaseMessages();
|
|
||||||
}
|
|
||||||
|
|
||||||
default ChatClient chatClient() {
|
|
||||||
return getModel().getChatClient();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 仅适用Module子类,否则需要重写
|
|
||||||
*
|
|
||||||
* @return 持有的model实例
|
|
||||||
*/
|
|
||||||
default Model getModel() {
|
|
||||||
return ((Module) this).getModel();
|
|
||||||
}
|
|
||||||
|
|
||||||
default void setModel(Model model) {
|
|
||||||
((Module) this).setModel(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
String modelKey();
|
|
||||||
|
|
||||||
boolean withAwareness();
|
|
||||||
|
|
||||||
String promptModule();
|
|
||||||
|
|
||||||
}
|
|
||||||
+1
-1
@@ -2,6 +2,6 @@ package work.slhaf.partner.module.common.module;
|
|||||||
|
|
||||||
import work.slhaf.partner.core.interaction.module.InteractionFlow;
|
import work.slhaf.partner.core.interaction.module.InteractionFlow;
|
||||||
|
|
||||||
public abstract class InteractionModule extends Module implements InteractionFlow {
|
public abstract class InteractionModule/* extends Module*/ implements InteractionFlow {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
package work.slhaf.partner.module.common.module;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import work.slhaf.partner.api.capability.annotation.CapabilityHolder;
|
|
||||||
import work.slhaf.partner.module.common.model.Model;
|
|
||||||
|
|
||||||
@CapabilityHolder
|
|
||||||
public abstract class Module {
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
protected Model model;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
package work.slhaf.partner.module.common.module;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 子模块基类
|
|
||||||
* @param <I> 输入类型
|
|
||||||
* @param <O> 输出类型
|
|
||||||
*/
|
|
||||||
public abstract class SubModule<I, O> extends Module {
|
|
||||||
|
|
||||||
public abstract O execute(I data);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,16 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.MetaMessage;
|
||||||
import work.slhaf.partner.common.chat.pojo.MetaMessage;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
import work.slhaf.partner.core.session.SessionManager;
|
import work.slhaf.partner.core.session.SessionManager;
|
||||||
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
import work.slhaf.partner.module.common.entity.AppendPromptData;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.CoreModule;
|
import work.slhaf.partner.module.common.module.CoreModule;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class CoreModel extends CoreModule implements ActivateModel {
|
|||||||
synchronized (CoreModel.class) {
|
synchronized (CoreModel.class) {
|
||||||
if (coreModel == null) {
|
if (coreModel == null) {
|
||||||
coreModel = new CoreModel();
|
coreModel = new CoreModel();
|
||||||
coreModel.model.setChatMessages(coreModel.cognationCapability.getChatMessages());
|
coreModel.getModel().setChatMessages(coreModel.cognationCapability.getChatMessages());
|
||||||
coreModel.appendedMessages = new ArrayList<>();
|
coreModel.appendedMessages = new ArrayList<>();
|
||||||
coreModel.sessionManager = SessionManager.getInstance();
|
coreModel.sessionManager = SessionManager.getInstance();
|
||||||
coreModel.updateChatClientSettings();
|
coreModel.updateChatClientSettings();
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
import work.slhaf.partner.core.cognation.submodule.cache.CacheCapability;
|
import work.slhaf.partner.core.cognation.submodule.cache.CacheCapability;
|
||||||
|
|||||||
+3
-3
@@ -6,14 +6,14 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemorySliceResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemorySliceResult;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.MemorySlice;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorBatchInput;
|
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorBatchInput;
|
||||||
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorInput;
|
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorInput;
|
||||||
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorResult;
|
import work.slhaf.partner.module.modules.memory.selector.evaluator.data.EvaluatorResult;
|
||||||
@@ -31,7 +31,7 @@ import static work.slhaf.partner.common.util.ExtractUtil.extractJson;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class SliceSelectEvaluator extends SubModule<EvaluatorInput, List<EvaluatedSlice>> implements ActivateModel {
|
public class SliceSelectEvaluator extends AgentInteractionSubModule<EvaluatorInput, List<EvaluatedSlice>> implements ActivateModel {
|
||||||
private static volatile SliceSelectEvaluator sliceSelectEvaluator;
|
private static volatile SliceSelectEvaluator sliceSelectEvaluator;
|
||||||
private InteractionThreadPoolExecutor executor;
|
private InteractionThreadPoolExecutor executor;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.memory.selector.evaluator.data;
|
|||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.memory.selector.evaluator.data;
|
|||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
import work.slhaf.partner.core.cognation.common.pojo.MemoryResult;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
+6
-6
@@ -5,9 +5,11 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.MetaMessage;
|
||||||
import work.slhaf.partner.common.chat.pojo.MetaMessage;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.common.exception_handler.GlobalExceptionHandler;
|
import work.slhaf.partner.common.exception_handler.GlobalExceptionHandler;
|
||||||
import work.slhaf.partner.common.exception_handler.pojo.GlobalException;
|
import work.slhaf.partner.common.exception_handler.pojo.GlobalException;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
@@ -15,9 +17,7 @@ import work.slhaf.partner.core.cognation.submodule.memory.MemoryCapability;
|
|||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
import work.slhaf.partner.core.session.SessionManager;
|
import work.slhaf.partner.core.session.SessionManager;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorInput;
|
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorInput;
|
||||||
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorMatchData;
|
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorMatchData;
|
||||||
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorResult;
|
import work.slhaf.partner.module.modules.memory.selector.extractor.data.ExtractorResult;
|
||||||
@@ -32,7 +32,7 @@ import static work.slhaf.partner.common.util.ExtractUtil.fixTopicPath;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MemorySelectExtractor extends SubModule<InteractionContext, ExtractorResult> implements ActivateModel {
|
public class MemorySelectExtractor extends AgentInteractionSubModule<InteractionContext, ExtractorResult> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile MemorySelectExtractor memorySelectExtractor;
|
private static volatile MemorySelectExtractor memorySelectExtractor;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.memory.selector.extractor.data;
|
|||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
import work.slhaf.partner.core.cognation.submodule.memory.pojo.EvaluatedSlice;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|||||||
+3
-3
@@ -4,9 +4,9 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.cache.CacheCapability;
|
import work.slhaf.partner.core.cognation.submodule.cache.CacheCapability;
|
||||||
|
|||||||
+2
-2
@@ -3,8 +3,8 @@ package work.slhaf.partner.module.modules.memory.updater.summarizer;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeInput;
|
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeInput;
|
||||||
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeResult;
|
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeResult;
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ import java.util.HashMap;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MemorySummarizer extends SubModule<SummarizeInput,SummarizeResult> {
|
public class MemorySummarizer extends AgentInteractionSubModule<SummarizeInput,SummarizeResult> {
|
||||||
|
|
||||||
private static volatile MemorySummarizer memorySummarizer;
|
private static volatile MemorySummarizer memorySummarizer;
|
||||||
public static final String MODEL_KEY = "memory_summarizer";
|
public static final String MODEL_KEY = "memory_summarizer";
|
||||||
|
|||||||
+4
-4
@@ -5,10 +5,10 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeInput;
|
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeInput;
|
||||||
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeResult;
|
import work.slhaf.partner.module.modules.memory.updater.summarizer.data.SummarizeResult;
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ import static work.slhaf.partner.common.util.ExtractUtil.fixTopicPath;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class MultiSummarizer extends SubModule<SummarizeInput, SummarizeResult> implements ActivateModel {
|
public class MultiSummarizer extends AgentInteractionSubModule<SummarizeInput, SummarizeResult> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile MultiSummarizer multiSummarizer;
|
private static volatile MultiSummarizer multiSummarizer;
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -4,13 +4,13 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.common.chat.constant.ChatConstant;
|
import work.slhaf.partner.api.common.chat.constant.ChatConstant;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -21,7 +21,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Data
|
@Data
|
||||||
public class SingleSummarizer extends SubModule<List<Message>,Void> implements ActivateModel {
|
public class SingleSummarizer extends AgentInteractionSubModule<List<Message>,Void> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile SingleSummarizer singleSummarizer;
|
private static volatile SingleSummarizer singleSummarizer;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -5,10 +5,10 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ import static work.slhaf.partner.common.util.ExtractUtil.extractJson;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TotalSummarizer extends SubModule<HashMap<String, String>, String> implements ActivateModel {
|
public class TotalSummarizer extends AgentInteractionSubModule<HashMap<String, String>, String> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile TotalSummarizer totalSummarizer;
|
private static volatile TotalSummarizer totalSummarizer;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.memory.updater.summarizer.data;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.perceive.selector;
|
|||||||
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ package work.slhaf.partner.module.modules.perceive.updater;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
import work.slhaf.partner.common.thread.InteractionThreadPoolExecutor;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
||||||
|
|||||||
+5
-5
@@ -3,15 +3,15 @@ package work.slhaf.partner.module.modules.perceive.updater.relation_extractor;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
import work.slhaf.partner.core.cognation.submodule.perceive.pojo.User;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo.RelationExtractInput;
|
import work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo.RelationExtractInput;
|
||||||
import work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo.RelationExtractResult;
|
import work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo.RelationExtractResult;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class RelationExtractor extends SubModule<InteractionContext, RelationExtractResult> implements ActivateModel {
|
public class RelationExtractor extends AgentInteractionSubModule<InteractionContext, RelationExtractResult> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile RelationExtractor relationExtractor;
|
private static volatile RelationExtractor relationExtractor;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
package work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo;
|
package work.slhaf.partner.module.modules.perceive.updater.relation_extractor.pojo;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|||||||
+5
-5
@@ -4,14 +4,14 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import work.slhaf.partner.api.capability.annotation.InjectCapability;
|
import work.slhaf.partner.api.common.chat.pojo.ChatResponse;
|
||||||
import work.slhaf.partner.common.chat.pojo.ChatResponse;
|
import work.slhaf.partner.api.factory.capability.annotation.InjectCapability;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.flow.abstracts.AgentInteractionSubModule;
|
||||||
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
import work.slhaf.partner.core.cognation.cognation.CognationCapability;
|
||||||
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
import work.slhaf.partner.core.cognation.submodule.perceive.PerceiveCapability;
|
||||||
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
import work.slhaf.partner.core.interaction.data.context.InteractionContext;
|
||||||
import work.slhaf.partner.module.common.model.ActivateModel;
|
|
||||||
import work.slhaf.partner.module.common.model.ModelConstant;
|
import work.slhaf.partner.module.common.model.ModelConstant;
|
||||||
import work.slhaf.partner.module.common.module.SubModule;
|
|
||||||
import work.slhaf.partner.module.modules.perceive.updater.static_extractor.data.StaticMemoryExtractInput;
|
import work.slhaf.partner.module.modules.perceive.updater.static_extractor.data.StaticMemoryExtractInput;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -19,7 +19,7 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class StaticMemoryExtractor extends SubModule<InteractionContext, HashMap<String, String>> implements ActivateModel {
|
public class StaticMemoryExtractor extends AgentInteractionSubModule<InteractionContext, HashMap<String, String>> implements ActivateModel {
|
||||||
|
|
||||||
private static volatile StaticMemoryExtractor staticMemoryExtractor;
|
private static volatile StaticMemoryExtractor staticMemoryExtractor;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ package work.slhaf.partner.module.modules.perceive.updater.static_extractor.data
|
|||||||
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import work.slhaf.partner.common.chat.pojo.Message;
|
import work.slhaf.partner.api.common.chat.pojo.Message;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user