Drop "Use default" beside a choice between alternatives
Where a file comes from (INPUT or GLOBAL) and where an MCP server comes from (CATALOG or CUSTOM) are two options to pick between, not a value to go back to. A new row still starts on INPUT or CATALOG, and blank still reads as it; only the button goes. It stays on the model parameters, where clearing a knob really does hand it back to the model's own default. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
bfbdd69c86
commit
f8cb6bd5ac
|
|
@ -18,7 +18,6 @@ import it.cnr.isti.workflow.manager.configurations.annotations.DynamicSchema;
|
|||
import it.cnr.isti.workflow.manager.configurations.annotations.AcceptsVariablePlaceholder;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.ConfigurableAsInput;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiContextKeys;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.DefaultsWhenEmpty;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.SchemaAllowedValues;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiEnabledWhen;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiOptionalGroup;
|
||||
|
|
@ -158,10 +157,9 @@ public class MCPAgentBlockConfiguration extends BlockConfiguration<MCPAgentBlock
|
|||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record MCPServerBinding(
|
||||
@JsonProperty(required = false)
|
||||
// The default lives in effectiveSourceType() below; declared here so the editor can say
|
||||
// which one an empty field is using instead of only that it is using one.
|
||||
// A new binding starts on CATALOG, and blank reads as CATALOG - see effectiveSourceType()
|
||||
// below. Not a default to go back to: CATALOG and CUSTOM are alternatives, picked alike.
|
||||
@SchemaAllowedValues(value = { "CATALOG", "CUSTOM" }, defaultValue = "CATALOG")
|
||||
@DefaultsWhenEmpty
|
||||
String sourceType,
|
||||
@JsonProperty(required = false)
|
||||
@UiEnabledWhen(field = "sourceType", equalsAny = { "CATALOG", "" })
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ import it.cnr.isti.workflow.manager.configurations.annotations.ConfigurableAsInp
|
|||
import it.cnr.isti.workflow.manager.configurations.annotations.DynamicSchema;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.FieldRetriever;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.LongText;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.DefaultsWhenEmpty;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.SchemaAllowedValues;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.Structural;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiEnabledWhen;
|
||||
|
|
@ -142,10 +141,9 @@ public class MCPAgentChatBlockConfiguration extends BlockConfiguration<MCPAgentC
|
|||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record MCPServerBinding(
|
||||
@JsonProperty(required = false)
|
||||
// Same default as effectiveSourceType() below, declared for the editor - and the same
|
||||
// one the agent block declares, so the two dialogs read alike.
|
||||
// Starts on CATALOG like the agent block's, so the two dialogs read alike; an
|
||||
// alternative to pick, not a default to go back to.
|
||||
@SchemaAllowedValues(value = { "CATALOG", "CUSTOM" }, defaultValue = "CATALOG")
|
||||
@DefaultsWhenEmpty
|
||||
String sourceType,
|
||||
@JsonProperty(required = false)
|
||||
@UiEnabledWhen(field = "sourceType", equalsAny = { "CATALOG", "" })
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.FieldRetriever;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.DefaultsWhenEmpty;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.SchemaAllowedValues;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiContextKeys;
|
||||
import it.cnr.isti.workflow.manager.configurations.annotations.UiDescription;
|
||||
|
|
@ -29,12 +28,11 @@ import jakarta.validation.constraints.Size;
|
|||
public record UploadInput(
|
||||
|
||||
/**
|
||||
* Which of the two ways this file arrives. The default lives in {@link #effectiveSource()}
|
||||
* and is declared here too, so the editor can say which one an untouched row is using rather
|
||||
* than only that it is using one.
|
||||
* Which of the two ways this file arrives. A new row starts on INPUT; blank, as an older row
|
||||
* may be, reads as INPUT too - see {@link #effectiveSource()}. Not a default to go back to:
|
||||
* the two are alternatives, and INPUT is chosen from the list like GLOBAL is.
|
||||
*/
|
||||
@SchemaAllowedValues(value = { SOURCE_INPUT, SOURCE_GLOBAL }, defaultValue = SOURCE_INPUT)
|
||||
@DefaultsWhenEmpty
|
||||
@UiLabel("File comes from")
|
||||
@UiDescription("Uploaded to an input of this step, or taken from a global input of the flow.")
|
||||
@JsonProperty(required = false) String source,
|
||||
|
|
|
|||
|
|
@ -32,4 +32,14 @@ class LLMBlockSchemaTest {
|
|||
assertEquals(java.util.List.of("name", "llmDescriptor", "prompt", "uploadInputs", "skills", "mcpServers",
|
||||
"outputs"), order.stream().filter(name -> !name.equals("type")).toList());
|
||||
}
|
||||
|
||||
@Test
|
||||
void whereAFileComesFromIsAChoiceNotADefaultToGoBackTo() {
|
||||
JsonNode schema = schemaProducer.generateSchemaNode(LLMBlockConfiguration.class);
|
||||
|
||||
JsonNode source = schema.get("definitions").get("UploadInput").get("properties").get("source");
|
||||
|
||||
assertEquals("INPUT", source.get("default").asText(), "a new row starts on INPUT");
|
||||
assertEquals(false, source.has("x-ui-defaults-when-empty"), "no Use default beside a choice of two");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -611,9 +611,9 @@ public class BlocksControllerTest {
|
|||
assertEquals(UiContextKeys.FLOW_ID,
|
||||
sharedSessionRef.path("x-retriever-depends-on").get(0).asText());
|
||||
|
||||
// The binding's sourceType has a default in Java (effectiveSourceType(): blank means
|
||||
// CATALOG) and now declares it, so the editor can say which default an empty field is
|
||||
// using instead of only that it is using one.
|
||||
// A new binding starts on CATALOG (effectiveSourceType(): blank means CATALOG too). It is
|
||||
// one of two alternatives, not a default to go back to, so the editor offers no "Use
|
||||
// default" beside it.
|
||||
// The binding is a nested record, so it lives in the definitions and mcpServers.items is a
|
||||
// $ref to it - the same shape the other nested-record assertions in this class walk.
|
||||
JsonNode definitions = schema.has("definitions") ? schema.path("definitions") : schema.path("$defs");
|
||||
|
|
@ -622,6 +622,7 @@ public class BlocksControllerTest {
|
|||
assertEquals("CATALOG", sourceType.path("default").asText());
|
||||
assertEquals("CATALOG", sourceType.path("enum").get(0).asText());
|
||||
assertEquals("CUSTOM", sourceType.path("enum").get(1).asText());
|
||||
assertFalse(sourceType.has("x-ui-defaults-when-empty"));
|
||||
assertTrue(sharedSessionRef.path("x-retriever-requires-auth").asBoolean());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue