diff --git a/src/PluginBase/AiAgentEntityWrapper.php b/src/PluginBase/AiAgentEntityWrapper.php index 6b4752aa1db65d201199b0b367318005ce489ac8..cdf598e3e69ac46a5c23f038706cfabfb15238b5 100644 --- a/src/PluginBase/AiAgentEntityWrapper.php +++ b/src/PluginBase/AiAgentEntityWrapper.php @@ -732,15 +732,21 @@ class AiAgentEntityWrapper implements PluginInterfacesAiAgentInterface, ConfigAi if ($limit['action']) { $values = array_map( fn ($value) => $this->applyTokens($value), - array_filter($limit['values'] ?? []), + array_filter( + $limit['values'] ?? [], + fn ($value) => $value !== NULL && $value !== '', + ), ); // Apply restrictions based on the action. switch ($limit['action']) { // Set constant value (forced value). case 'force_value': - $context_definition->addConstraint('FixedValue', $values[0]); - $context_definition->setDefaultValue($values[0]); + if (isset($values[0])) { + $context_value = $context_definition->getDataType() === 'list' ? $values : $values[0]; + $context_definition->addConstraint('FixedValue', $context_value); + $context_definition->setDefaultValue($context_value); + } $context_definition->setRequired(FALSE); break;