mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 16:53:04 +08:00
refactor(MetaActionType): redefine meta action types into MCP and ORIGIN
Context: Previously, SCRIPT and PLUGIN were treated as separate action types, but their semantics are already covered by MCP. However, a generic execution path for locally generated actions is still required, which is represented by ORIGIN.
This commit is contained in:
@@ -44,8 +44,7 @@ public class MetaAction implements Comparable<MetaAction> {
|
||||
|
||||
public void resetPath() {
|
||||
path = switch (type) {
|
||||
case PLUGIN -> Path.of(ACTION_PROGRAM, key, "action.jar");
|
||||
case SCRIPT -> Path.of(ACTION_PROGRAM, key, "action.py");
|
||||
case ORIGIN -> path;
|
||||
case MCP -> Path.of(ACTION_PROGRAM, key, "action.json");
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
package work.slhaf.partner.core.action.entity;
|
||||
|
||||
public enum MetaActionType {
|
||||
PLUGIN, MCP, SCRIPT
|
||||
/**
|
||||
* 将调用的 MCP 工具,可包括远程、本地任意服务
|
||||
*/
|
||||
MCP,
|
||||
/**
|
||||
* 适用于‘临时生成’的行动程序,在生成后根据序列化选项及执行情况,进行持久化
|
||||
*/
|
||||
ORIGIN
|
||||
}
|
||||
@@ -41,9 +41,8 @@ public class LocalRunnerClient extends RunnerClient {
|
||||
try {
|
||||
// 由于三种方式返回的内容结构变化太大,所以选择油具体执行逻辑返回真正的 Response 对象
|
||||
response = switch (metaAction.getType()) {
|
||||
case MetaActionType.SCRIPT -> doRunWithScript(metaAction);
|
||||
case MetaActionType.MCP -> doRunWithMcp(metaAction);
|
||||
case MetaActionType.PLUGIN -> doRunWithPlugin(metaAction);
|
||||
case MetaActionType.ORIGIN -> doRunWithOrigin(metaAction);
|
||||
};
|
||||
} catch (Exception e) {
|
||||
response = new RunnerResponse();
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DynamicActionGenerator extends AgentRunningSubModule<GeneratorInput
|
||||
tempAction.setParams(input.getParams());
|
||||
tempAction.setIo(true);
|
||||
tempAction.setOrder(-1);
|
||||
tempAction.setType(MetaActionType.SCRIPT);
|
||||
tempAction.setType(MetaActionType.ORIGIN);
|
||||
return tempAction;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user