Browse Source
AI rule node: add force ack configuration option to rule node
pull/13371/head
Dmytro Skarzhynets
1 year ago
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF
3 changed files with
4 additions and
1 deletions
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/ai/TbAiNode.java
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/ai/TbAiNodeConfiguration.java
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/external/TbAbstractExternalNode.java
|
|
@ -98,6 +98,7 @@ public final class TbAiNode extends TbAbstractExternalNode implements TbNode { |
|
|
userPrompt = config.getUserPrompt(); |
|
|
userPrompt = config.getUserPrompt(); |
|
|
timeoutSeconds = config.getTimeoutSeconds(); |
|
|
timeoutSeconds = config.getTimeoutSeconds(); |
|
|
modelId = config.getModelId(); |
|
|
modelId = config.getModelId(); |
|
|
|
|
|
super.forceAck = config.isForceAck() || super.forceAck; // force ack if node config says so, or if env variable (super.forceAck) says so
|
|
|
|
|
|
|
|
|
Optional<AiModel> model = ctx.getAiModelService().findAiModelByTenantIdAndId(ctx.getTenantId(), modelId); |
|
|
Optional<AiModel> model = ctx.getAiModelService().findAiModelByTenantIdAndId(ctx.getTenantId(), modelId); |
|
|
if (model.isEmpty()) { |
|
|
if (model.isEmpty()) { |
|
|
|
|
|
@ -50,6 +50,8 @@ public class TbAiNodeConfiguration implements NodeConfiguration<TbAiNodeConfigur |
|
|
@Max(value = 600, message = "cannot exceed 600 seconds (10 minutes)") |
|
|
@Max(value = 600, message = "cannot exceed 600 seconds (10 minutes)") |
|
|
private int timeoutSeconds; |
|
|
private int timeoutSeconds; |
|
|
|
|
|
|
|
|
|
|
|
private boolean forceAck; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public TbAiNodeConfiguration defaultConfiguration() { |
|
|
public TbAiNodeConfiguration defaultConfiguration() { |
|
|
var configuration = new TbAiNodeConfiguration(); |
|
|
var configuration = new TbAiNodeConfiguration(); |
|
|
|
|
|
@ -22,7 +22,7 @@ import org.thingsboard.server.common.msg.TbMsg; |
|
|
|
|
|
|
|
|
public abstract class TbAbstractExternalNode implements TbNode { |
|
|
public abstract class TbAbstractExternalNode implements TbNode { |
|
|
|
|
|
|
|
|
private boolean forceAck; |
|
|
protected boolean forceAck; |
|
|
|
|
|
|
|
|
public void init(TbContext ctx) { |
|
|
public void init(TbContext ctx) { |
|
|
this.forceAck = ctx.isExternalNodeForceAck(); |
|
|
this.forceAck = ctx.isExternalNodeForceAck(); |
|
|
|