mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-05-05 13:22:37 +02:00
Feature/group state cli (#505)
This commit is contained in:
parent
5867f45c3a
commit
266454e75f
3 changed files with 33 additions and 10 deletions
|
|
@ -56,9 +56,9 @@ class TestSetToolStructuredQuery:
|
||||||
collection="sales_data",
|
collection="sales_data",
|
||||||
template=None,
|
template=None,
|
||||||
arguments=[],
|
arguments=[],
|
||||||
group=[],
|
group=None,
|
||||||
state=None,
|
state=None,
|
||||||
applicable_states=[]
|
applicable_states=None
|
||||||
)
|
)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
|
|
@ -93,9 +93,9 @@ class TestSetToolStructuredQuery:
|
||||||
collection=None, # No collection specified
|
collection=None, # No collection specified
|
||||||
template=None,
|
template=None,
|
||||||
arguments=[],
|
arguments=[],
|
||||||
group=[],
|
group=None,
|
||||||
state=None,
|
state=None,
|
||||||
applicable_states=[]
|
applicable_states=None
|
||||||
)
|
)
|
||||||
|
|
||||||
captured = capsys.readouterr()
|
captured = capsys.readouterr()
|
||||||
|
|
@ -133,9 +133,9 @@ class TestSetToolStructuredQuery:
|
||||||
collection='sales_data',
|
collection='sales_data',
|
||||||
template=None,
|
template=None,
|
||||||
arguments=[],
|
arguments=[],
|
||||||
group=[],
|
group=None,
|
||||||
state=None,
|
state=None,
|
||||||
applicable_states=[]
|
applicable_states=None
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_set_main_structured_query_no_arguments_needed(self):
|
def test_set_main_structured_query_no_arguments_needed(self):
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,11 @@ def set_tool(
|
||||||
for a in arguments
|
for a in arguments
|
||||||
]
|
]
|
||||||
|
|
||||||
if group: object["group"] = group
|
if group is not None: object["group"] = group
|
||||||
|
|
||||||
if state: object["state"] = state
|
if state: object["state"] = state
|
||||||
|
|
||||||
if applicable_states: object["applicable-states"] = applicable_states
|
if applicable_states is not None: object["applicable-states"] = applicable_states
|
||||||
|
|
||||||
values = api.put([
|
values = api.put([
|
||||||
ConfigValue(
|
ConfigValue(
|
||||||
|
|
@ -254,9 +254,9 @@ def main():
|
||||||
collection=args.collection,
|
collection=args.collection,
|
||||||
template=args.template,
|
template=args.template,
|
||||||
arguments=arguments,
|
arguments=arguments,
|
||||||
group=args.group or [],
|
group=args.group,
|
||||||
state=args.state,
|
state=args.state,
|
||||||
applicable_states=getattr(args, 'applicable_states', None) or [],
|
applicable_states=args.applicable_states,
|
||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,29 @@ def show_config(url):
|
||||||
f"arg {n}",
|
f"arg {n}",
|
||||||
f"{arg['name']}: {arg['type']}\n{arg['description']}"
|
f"{arg['name']}: {arg['type']}\n{arg['description']}"
|
||||||
))
|
))
|
||||||
|
|
||||||
|
# Display group information
|
||||||
|
if "group" in data:
|
||||||
|
groups = data["group"]
|
||||||
|
if groups:
|
||||||
|
table.append(("groups", ", ".join(groups)))
|
||||||
|
else:
|
||||||
|
table.append(("groups", "(empty - no groups)"))
|
||||||
|
|
||||||
|
# Display state transition information
|
||||||
|
if "state" in data:
|
||||||
|
table.append(("next state", data["state"]))
|
||||||
|
|
||||||
|
# Display applicable states
|
||||||
|
if "applicable-states" in data:
|
||||||
|
states = data["applicable-states"]
|
||||||
|
if states:
|
||||||
|
if "*" in states:
|
||||||
|
table.append(("available in", "all states"))
|
||||||
|
else:
|
||||||
|
table.append(("available in", ", ".join(states)))
|
||||||
|
else:
|
||||||
|
table.append(("available in", "(empty - never available)"))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue