Separate required and optional args.

This commit is contained in:
Haiping Chen 2023-10-30 12:44:53 -05:00
parent 3caa7a5499
commit df7743e37d
3 changed files with 25 additions and 9 deletions

View file

@ -13,6 +13,9 @@ public class RoutingItem
[JsonPropertyName("description")]
public string Description { get; set; } = string.Empty;
[JsonPropertyName("fields")]
public List<ParameterPropertyDef> Fields { get; set; } = new List<ParameterPropertyDef>();
[JsonPropertyName("required_fields")]
public List<ParameterPropertyDef> RequiredFields { get; set; } = new List<ParameterPropertyDef>();
[JsonPropertyName("optional_fields")]
public List<ParameterPropertyDef> OptionalFields { get; set; } = new List<ParameterPropertyDef>();
}

View file

@ -92,7 +92,14 @@ public class RouterInstance : IRouterInstance
AgentId = x.Id,
Description = x.Description,
Name = x.Name,
Fields = x.RoutingRules
RequiredFields = x.RoutingRules
.Where(p => p.Required)
.Select(p => new ParameterPropertyDef(p.Field, p.Description, type: p.Type)
{
Required = p.Required
}).ToList(),
OptionalFields = x.RoutingRules
.Where(p => !p.Required)
.Select(p => new ParameterPropertyDef(p.Field, p.Description, type: p.Type)
{
Required = p.Required

View file

@ -19,12 +19,18 @@ Parameters:
[AGENTS]
{% for agent in routing_agents %}
* {{ agent.description}}
Agent: {{ agent.name }}
{% if agent.fields and agent.fields != empty -%}
Arguments:
{% for f in agent.fields -%}
- {{ f.name }}: {{ f.description }} (type: {{ f.type }}, required: {{f.required}}){{ "\r\n " }}
* Agent: {{ agent.name }}
{{ agent.description}}
{% if agent.required_fields and agent.required_fields != empty -%}
Required args:
{% for f in agent.required_fields -%}
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
{%- endfor %}
{%- endif %}
{% if agent.optional_fields and agent.optional_fields != empty -%}
Optional args:
{% for f in agent.optional_fields -%}
- {{ f.name }} (type: {{ f.type }}): {{ f.description }}{{ "\r\n " }}
{%- endfor %}
{%- endif %}
{% endfor %}