diff --git a/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockConfiguration.java b/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockConfiguration.java index 050061f..4dc1888 100644 --- a/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockConfiguration.java +++ b/src/main/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockConfiguration.java @@ -42,10 +42,12 @@ public class LLMBlockConfiguration extends BlockConfiguration { @NotNull @Valid + @UiOrder(20) @JsonProperty(required = true) LLMDescriptor llmDescriptor; @Structural + @UiOrder(30) @LongText(placeholder = "Write the prompt to execute", tip = "Use ${{}} to indicate variables, for example: What is the capital of ${{country}}? Append [] to a name to mark it as an array input, e.g. ${{scores[]}}.", acceptVariableAsPlaceholder = true) @JsonProperty(required = false) String prompt; @@ -54,6 +56,7 @@ public class LLMBlockConfiguration extends BlockConfiguration { @Valid @Size(max = SkillsCatalogService.MAX_SKILLS_PER_BLOCK) @UiUniqueItemsBy("skillId") + @UiOrder(50) @JsonProperty(required = false) List skills = List.of(); @@ -65,6 +68,7 @@ public class LLMBlockConfiguration extends BlockConfiguration { @Valid @Size(max = MCPToolServerBinding.MAX_PER_BLOCK) @UiUniqueItemsBy("serverName") + @UiOrder(60) @JsonProperty(required = false) List mcpServers = List.of(); @@ -99,7 +103,7 @@ public class LLMBlockConfiguration extends BlockConfiguration { @Valid @Size(max = 8) @UiUniqueItemsBy("name") - @UiOrder(75) + @UiOrder(40) @UiLabel("Files") @UiDescription("Images (PNG, JPEG, WebP) and PDF documents sent to the model with the prompt. A PDF is read natively where the provider can, and otherwise as its text - with its pages as images too when the model sees images.") @JsonProperty(required = false) diff --git a/src/test/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockSchemaTest.java b/src/test/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockSchemaTest.java index 9ad9a4c..eae12e7 100644 --- a/src/test/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockSchemaTest.java +++ b/src/test/java/it/cnr/isti/workflow/manager/blocks/configurations/LLMBlockSchemaTest.java @@ -30,4 +30,16 @@ class LLMBlockSchemaTest { assertEquals("mcpServers", visibleWhen.get("field").asText()); assertEquals(true, visibleWhen.get("present").asBoolean()); } + + @Test + void theFieldsReadInTheOrderANodeIsSetUp() { + // The model; what it is asked and given; what it may use; what it hands back. + JsonNode schema = schemaProducer.generateSchemaNode(LLMBlockConfiguration.class); + + java.util.List order = new java.util.ArrayList<>(); + schema.get("x-ui-property-order").forEach(name -> order.add(name.asText())); + + assertEquals(java.util.List.of("name", "llmDescriptor", "prompt", "uploadInputs", "skills", "mcpServers", + "requiredSuccessfulMcpTools", "outputs"), order.stream().filter(name -> !name.equals("type")).toList()); + } }