With fit as (cos + 1) / 2 the real run spanned about 0.55 to 0.79, so a prefer gate at weight 0.2 moved a score more than the whole spread of fit. fit is now the cosine min-max scaled across the roles an agent scores in that run: the closest is 1, the farthest 0, a single role 1, and a role a require gate rules out stays out of the range. The starter agents' prefer weights drop to 0.05, enough to break a tie. A regression test pins the case: two close cosines that the old mapping let a 0.05 gate reorder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.9 KiB
HTML
38 lines
1.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Agents — roledesk{% endblock %}
|
|
|
|
{% block content %}
|
|
<h1>Search agents</h1>
|
|
<p class="lede">A search agent is a named search: an intent that <code>fit</code> is measured against, gates that require or prefer a column value, and the weights of each term. Saving one rescores it; the Roles tab orders by it when it is picked there.</p>
|
|
|
|
<p id="agents-count" class="count" role="status"></p>
|
|
<ul id="agents-list" class="agents"></ul>
|
|
|
|
<form id="agent-form" class="agent-form" autocomplete="off">
|
|
<h2 id="agent-form-title">New agent</h2>
|
|
<input type="hidden" id="a-id">
|
|
<label>Name <input type="text" id="a-name" required></label>
|
|
<label>Intent <span class="hint">a CV paragraph, or what this search is for</span>
|
|
<textarea id="a-intent" rows="5"></textarea></label>
|
|
<label>Gates <span class="hint">JSON: [{"field": "place", "values": ["Berlin"], "mode": "require"}, {"field": "remote", "values": ["remote"], "mode": "prefer", "weight": 0.05}]</span>
|
|
<textarea id="a-gates" rows="5" spellcheck="false">[]</textarea></label>
|
|
<fieldset class="weights">
|
|
<legend>Weights</legend>
|
|
<label>Fit <input type="number" id="a-fit" min="0" step="0.05" value="0.6"></label>
|
|
<label>Recency <input type="number" id="a-recency" min="0" step="0.05" value="0.2"></label>
|
|
<label>Affinity <input type="number" id="a-affinity" min="0" step="0.05" value="0.2"></label>
|
|
</fieldset>
|
|
<label class="inline"><input type="checkbox" id="a-enabled" checked> Enabled</label>
|
|
<div class="agent-actions">
|
|
<button type="submit">Save and score</button>
|
|
<button type="button" id="a-new" class="secondary">New</button>
|
|
<button type="button" id="a-delete" class="secondary" hidden>Delete</button>
|
|
</div>
|
|
<p id="agent-status" class="count" role="status"></p>
|
|
</form>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{{ asset('roles.js') }}"></script>
|
|
{% endblock %}
|