AI rule node: add force ack configuration option to rule node
This commit is contained in:
parent
5abbe9ec02
commit
eb52e7c767
@ -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();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user