Drop Advanced › Other rules from the agent form, so an agent's gates are the fetch gate's four parts: a stored gate the parts cannot say is named in a note under the fetch gate and sent back unchanged on Save, and the card still says it in words
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
136047023e
commit
1913101061
7 files changed
+193
-125
No files matched your search
+29
-1
@@ -998,7 +998,13 @@ def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> No
|
||||
template = page[page.index('<template id="agent-form-template">'):page.index("</template>")]
|
||||
assert 'id="agent-form"' in template and 'id="a-cancel"' in template
|
||||
assert 'id="a-name"' in page and 'placeholder="My search"' in page
|
||||
assert 'id="a-prompts"' in page and "<details" in page and 'id="a-gates"' in page
|
||||
assert 'id="a-prompts"' in page
|
||||
# The gates are the four parts and nothing else: no rows of other rules,
|
||||
# only a note naming a stored rule the parts cannot say.
|
||||
for gone in ("<details", 'id="a-gates"', 'id="a-rules"', 'id="a-add-rule"', "Other rules"):
|
||||
assert gone not in template
|
||||
assert template.index('id="a-where-sum"') < template.index('id="a-kept"') \
|
||||
< template.index("</fieldset>", template.index('id="a-where-sum"'))
|
||||
for weight in ("a-fit", "a-recency", "a-affinity", "a-taste"):
|
||||
assert f'id="{weight}"' in page
|
||||
assert 'id="a-taste" min="0" step="0.05" value="0.2"' in page
|
||||
@@ -1170,6 +1176,28 @@ def test_agents_are_created_updated_listed_and_deleted(client: TestClient) -> No
|
||||
assert client.delete(f"/api/agents/{agent['id']}").status_code == 404
|
||||
|
||||
|
||||
def test_an_agents_fetch_gate_and_a_rule_the_form_cannot_say_round_trip(client: TestClient) -> None:
|
||||
"""What the form sends for the four parts, plus a stored gate on a field the
|
||||
form has no part for, is served back as sent, so a load and a save keep it."""
|
||||
europe = ["AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "DE", "GR", "HU", "IE",
|
||||
"IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE", "IS",
|
||||
"LI", "NO", "GB", "CH", "EU"]
|
||||
gates = [{"field": "country", "values": europe, "mode": "require"},
|
||||
{"field": "country", "values": ["DK"], "mode": "any"},
|
||||
{"field": "remote_from", "values": ["country:DK", "anywhere"], "mode": "any"},
|
||||
{"field": "place", "values": ["Malmö"], "mode": "any"},
|
||||
{"field": "title", "values": ["account executive"], "mode": "exclude"},
|
||||
{"field": "seniority", "values": ["senior"], "mode": "require"}]
|
||||
body = {"name": "Nordics", "prompts": [{"name": "Data", "text": "Head of Data"}],
|
||||
"gates": gates, "fetch_terms": ["data"]}
|
||||
agent = client.post("/api/agents", json=body).json()
|
||||
assert agent["gates"] == gates and agent["fetch_terms"] == ["data"]
|
||||
served = next(a for a in client.get("/api/agents").json() if a["id"] == agent["id"])
|
||||
assert served["gates"] == gates
|
||||
again = client.post("/api/agents", json={**body, "id": agent["id"], "gates": served["gates"]})
|
||||
assert again.status_code == 200 and again.json()["gates"] == gates
|
||||
|
||||
|
||||
def test_agents_take_and_serve_prompts_and_still_take_an_intent(client: TestClient) -> None:
|
||||
prompts = [{"name": "AI and data leadership", "text": "VP, Head or Director of AI"},
|
||||
{"name": "Forward deployed", "text": ""}]
|
||||
|
||||
Reference in new issue
Block a user