Skip to content

Commit 7437a2b

Browse files
committed
修复iot方法调用bug
1 parent fdd8085 commit 7437a2b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/xiaozhi/dialogue/service/IotService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ private void registerMethodFunctionTools(String sessionId, ToolsSessionHolder to
288288

289289
var toolCallback = FunctionToolCallback
290290
.builder(funcName, (Map<String, Object> params, ToolContext toolContext) -> {
291-
String actFuncName = funcName.substring(4); // 原始方法调用,去掉iot_前缀
291+
String actFuncName = funcName.replace("iot_" + iotName + "_", ""); // 原始方法调用,去掉iot_iotName_前缀
292292
String response_success = (String) params.get("response_success");
293293
params.remove("response_success"); // 移除response_success参数,避免传递给设备
294294
boolean result = sendIotMessage(sessionId, iotName, actFuncName, params);

0 commit comments

Comments
 (0)