mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
行动干预足以抽离为新的前置模块,但仍属于‘行动’语义,大致框架已确立。后续实现时并发控制、各种干预的协调与触发时机需要注意。
This commit is contained in:
@@ -1,8 +1,11 @@
|
|||||||
package work.slhaf.partner.module.modules.action.identifier;
|
package work.slhaf.partner.module.modules.action.identifier;
|
||||||
|
|
||||||
import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule;
|
import work.slhaf.partner.api.agent.factory.module.annotation.AgentModule;
|
||||||
|
import work.slhaf.partner.api.agent.factory.module.annotation.InjectModule;
|
||||||
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel;
|
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel;
|
||||||
import work.slhaf.partner.module.common.module.PreRunningModule;
|
import work.slhaf.partner.module.common.module.PreRunningModule;
|
||||||
|
import work.slhaf.partner.module.modules.action.identifier.evaluator.InterventionEvaluator;
|
||||||
|
import work.slhaf.partner.module.modules.action.identifier.recognizer.InterventionRecognizer;
|
||||||
import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext;
|
import work.slhaf.partner.runtime.interaction.data.context.PartnerRunningFlowContext;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -11,21 +14,27 @@ import java.util.HashMap;
|
|||||||
* 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容
|
* 负责识别潜在的行动干预信息,作用于正在进行或已存在的行动池中内容
|
||||||
*/
|
*/
|
||||||
@AgentModule(name = "action_identifier", order = 2)
|
@AgentModule(name = "action_identifier", order = 2)
|
||||||
public class ActionIdentifier extends PreRunningModule implements ActivateModel {
|
public class ActionInterventor extends PreRunningModule implements ActivateModel {
|
||||||
|
|
||||||
|
@InjectModule
|
||||||
|
private InterventionRecognizer interventionRecognizer;
|
||||||
|
@InjectModule
|
||||||
|
private InterventionEvaluator interventionEvaluator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void doExecute(PartnerRunningFlowContext context) {
|
protected void doExecute(PartnerRunningFlowContext context) {
|
||||||
|
//综合当前正在进行的行动链信息、用户交互历史、激活的记忆切片,尝试识别出是否存在行动干预意图
|
||||||
|
//首先通过recognizer进行快速意图识别,识别成功则步入评估阶段,评估成功则直接作用于目标行动链
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String modelKey() {
|
public String modelKey() {
|
||||||
return "";
|
return "action_identifier";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean withBasicPrompt() {
|
public boolean withBasicPrompt() {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,6 +44,6 @@ public class ActionIdentifier extends PreRunningModule implements ActivateModel
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String moduleName() {
|
protected String moduleName() {
|
||||||
return "";
|
return "[行动干预识别模块]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package work.slhaf.partner.module.modules.action.identifier.evaluator;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule;
|
||||||
|
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule;
|
||||||
|
import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorInput;
|
||||||
|
import work.slhaf.partner.module.modules.action.identifier.evaluator.entity.EvaluatorResult;
|
||||||
|
|
||||||
|
@AgentSubModule
|
||||||
|
public class InterventionEvaluator extends AgentRunningSubModule<EvaluatorInput, EvaluatorResult> implements ActivateModel {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EvaluatorResult execute(EvaluatorInput data) {
|
||||||
|
//基于干预意图、记忆切片、交互上下文、已有行动程序综合评估,尝试选取出合适的行动程序,对目标行动链做出调整
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String modelKey() {
|
||||||
|
return "intervention_evaluator";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean withBasicPrompt() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package work.slhaf.partner.module.modules.action.identifier.evaluator.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EvaluatorInput {
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package work.slhaf.partner.module.modules.action.identifier.evaluator.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class EvaluatorResult {
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package work.slhaf.partner.module.modules.action.identifier.recognizer;
|
||||||
|
|
||||||
|
import work.slhaf.partner.api.agent.factory.module.annotation.AgentSubModule;
|
||||||
|
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.ActivateModel;
|
||||||
|
import work.slhaf.partner.api.agent.runtime.interaction.flow.abstracts.AgentRunningSubModule;
|
||||||
|
import work.slhaf.partner.module.modules.action.identifier.recognizer.entity.InterventionResult;
|
||||||
|
|
||||||
|
@AgentSubModule
|
||||||
|
public class InterventionRecognizer extends AgentRunningSubModule<String, InterventionResult> implements ActivateModel {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InterventionResult execute(String data) {
|
||||||
|
//使用LLM进行快速意图识别
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String modelKey() {
|
||||||
|
return "intervention_recognizer";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean withBasicPrompt() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package work.slhaf.partner.module.modules.action.identifier.recognizer.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class InterventionResult {
|
||||||
|
private boolean result;
|
||||||
|
private String interventionTendency;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user