From dc3f9cc91759823ce59486f19b138be4b296a0f1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期二, 28 四月 2026 09:43:28 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/ai/service/impl/AutoTuneAgentServiceImpl.java | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/zy/ai/service/impl/AutoTuneAgentServiceImpl.java b/src/main/java/com/zy/ai/service/impl/AutoTuneAgentServiceImpl.java
index 7af6821..fe0ca9b 100644
--- a/src/main/java/com/zy/ai/service/impl/AutoTuneAgentServiceImpl.java
+++ b/src/main/java/com/zy/ai/service/impl/AutoTuneAgentServiceImpl.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.zy.ai.domain.autotune.AutoTuneTriggerType;
import com.zy.ai.entity.AiPromptTemplate;
import com.zy.ai.entity.ChatCompletionRequest;
import com.zy.ai.entity.ChatCompletionResponse;
@@ -73,7 +74,7 @@
}
for (ChatCompletionRequest.ToolCall toolCall : toolCalls) {
- Object toolOutput = callMountedTool(toolCall, runState);
+ Object toolOutput = callMountedTool(toolCall, runState, normalizedTriggerType);
messages.add(buildToolMessage(toolCall, toolOutput));
}
}
@@ -116,12 +117,13 @@
return message;
}
- private Object callMountedTool(ChatCompletionRequest.ToolCall toolCall, RunState runState) {
+ private Object callMountedTool(ChatCompletionRequest.ToolCall toolCall, RunState runState, String triggerType) {
String toolName = resolveToolName(toolCall);
if (!ALLOWED_TOOL_NAMES.contains(toolName)) {
throw new IllegalArgumentException("Disallowed auto-tune MCP tool: " + toolName);
}
JSONObject arguments = parseArguments(toolCall);
+ applySchedulerTriggerType(toolName, triggerType, arguments);
try {
Object output = mcpToolManager.callTool(toolName, arguments);
runState.markToolSuccess(toolName);
@@ -132,6 +134,16 @@
}
}
+ private void applySchedulerTriggerType(String toolName, String triggerType, JSONObject arguments) {
+ if (!TOOL_APPLY_CHANGES.equals(toolName)) {
+ return;
+ }
+ if (!AutoTuneTriggerType.AUTO.getCode().equals(triggerType)) {
+ return;
+ }
+ arguments.put("triggerType", AutoTuneTriggerType.AUTO.getCode());
+ }
+
private ChatCompletionRequest.Message buildToolMessage(ChatCompletionRequest.ToolCall toolCall, Object toolOutput) {
ChatCompletionRequest.Message toolMessage = new ChatCompletionRequest.Message();
toolMessage.setRole("tool");
--
Gitblit v1.9.1