mirror of
https://github.com/slhaf/Partner.git
synced 2026-05-12 08:43:02 +08:00
refactor(runner): rename method buildFileExecutionCommands in CommandExecutionService
This commit is contained in:
@@ -11,7 +11,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class CommandExecutionService {
|
public class CommandExecutionService {
|
||||||
|
|
||||||
public String[] buildCommands(String launcher, Map<String, Object> params, String absolutePath) {
|
public String[] buildFileExecutionCommands(String launcher, Map<String, Object> params, String absolutePath) {
|
||||||
int paramSize = params == null ? 0 : params.size();
|
int paramSize = params == null ? 0 : params.size();
|
||||||
String[] commands = new String[paramSize + 2];
|
String[] commands = new String[paramSize + 2];
|
||||||
commands[0] = launcher;
|
commands[0] = launcher;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class OriginExecutionService {
|
|||||||
public RunnerClient.RunnerResponse run(MetaAction metaAction) {
|
public RunnerClient.RunnerResponse run(MetaAction metaAction) {
|
||||||
RunnerClient.RunnerResponse response = new RunnerClient.RunnerResponse();
|
RunnerClient.RunnerResponse response = new RunnerClient.RunnerResponse();
|
||||||
File file = new File(metaAction.getLocation());
|
File file = new File(metaAction.getLocation());
|
||||||
String[] commands = commandExecutionService.buildCommands(metaAction.getLauncher(), metaAction.getParams(), file.getAbsolutePath());
|
String[] commands = commandExecutionService.buildFileExecutionCommands(metaAction.getLauncher(), metaAction.getParams(), file.getAbsolutePath());
|
||||||
WrappedLaunchSpec wrapped = ExecutionPolicyRegistry.INSTANCE.prepare(Arrays.stream(commands).toList());
|
WrappedLaunchSpec wrapped = ExecutionPolicyRegistry.INSTANCE.prepare(Arrays.stream(commands).toList());
|
||||||
List<String> wrappedCommands = new ArrayList<>();
|
List<String> wrappedCommands = new ArrayList<>();
|
||||||
wrappedCommands.add(wrapped.getCommand());
|
wrappedCommands.add(wrapped.getCommand());
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ public class DynamicActionMcpManager implements AutoCloseable {
|
|||||||
if (arguments == null) {
|
if (arguments == null) {
|
||||||
arguments = Map.of();
|
arguments = Map.of();
|
||||||
}
|
}
|
||||||
String[] commands = commandExecutionService.buildCommands(launcher, arguments, program.getAbsolutePath());
|
String[] commands = commandExecutionService.buildFileExecutionCommands(launcher, arguments, program.getAbsolutePath());
|
||||||
if (commands == null) {
|
if (commands == null) {
|
||||||
return Mono.just(McpSchema.CallToolResult.builder()
|
return Mono.just(McpSchema.CallToolResult.builder()
|
||||||
.addTextContent("未知文件类型: " + program.getName())
|
.addTextContent("未知文件类型: " + program.getName())
|
||||||
|
|||||||
Reference in New Issue
Block a user