Leave out titles by phrase: an exclude gate mode and a title gate field
A role whose title holds one of the agent's phrases as whole words is gated with the phrase as its reason, a favourite's too. The agent form has a Leave out titles line under Where. function = sales could not do it, since the classifier files Solutions Engineer and pre-sales under sales. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e827665dd
commit
8c6ea0ffb6
8 files changed
+116
-21
No files matched your search
+13
-4
@@ -39,8 +39,8 @@
|
||||
"HU", "IE", "IT", "LV", "LT", "LU", "MT", "NL", "PL", "PT", "RO", "SK", "SI", "ES", "SE",
|
||||
"IS", "LI", "NO", "GB", "CH", "EU"];
|
||||
const FIELDS = ["place", "country", "remote", "seniority", "function", "salary_min",
|
||||
"currency", "permit", "languages", "company"];
|
||||
const MODES = [["require", "must"], ["any", "one of"], ["prefer", "prefer"]];
|
||||
"currency", "permit", "languages", "company", "title"];
|
||||
const MODES = [["require", "must"], ["any", "one of"], ["prefer", "prefer"], ["exclude", "not"]];
|
||||
const HYBRID_WEIGHT = 0.05;
|
||||
|
||||
/** @type {object[]} every agent, as the server lists them */
|
||||
@@ -227,11 +227,14 @@
|
||||
const must = of("require").map(phrase);
|
||||
const prefer = of("prefer").map((g) => phrase(g).replace(/^with /, ""));
|
||||
if (where.hybrid) prefer.unshift("hybrid");
|
||||
const not = of("exclude").map(phrase);
|
||||
const sentences = [];
|
||||
const any = whereSentence(where, of("any"));
|
||||
if (any) sentences.push(any);
|
||||
if (must.length) sentences.push(`Only roles ${must.join(" and ")}.`);
|
||||
if (prefer.length) sentences.push(`Prefers ${prefer.join("; ")}.`);
|
||||
if (where.titles) sentences.push(`Leaves out titles with ${orList(where.titles.values.map((t) => `“${t}”`))}.`);
|
||||
if (not.length) sentences.push(`Leaves out roles ${not.join(" or ")}.`);
|
||||
return sentences.join(" ");
|
||||
}
|
||||
|
||||
@@ -497,7 +500,7 @@
|
||||
// that is Europe and the countries line exactly, and only with Remote
|
||||
// ticked; any other must on country is a row, and Remote reads anywhere.
|
||||
function distribute(gates) {
|
||||
const where = { countries: null, places: null, remote: null, europe: null, hybrid: null };
|
||||
const where = { countries: null, places: null, remote: null, europe: null, hybrid: null, titles: null };
|
||||
const rest = [];
|
||||
const musts = [];
|
||||
const plain = (g) => g.weight === undefined || g.weight === 1;
|
||||
@@ -512,6 +515,7 @@
|
||||
else if (g.field === "remote" && g.mode === "any" && plain(g) && only(g, "remote")) slot = "remote";
|
||||
else if (g.field === "place" && g.mode === "any" && plain(g)) slot = "places";
|
||||
else if (g.field === "remote" && g.mode === "prefer" && only(g, "hybrid")) slot = "hybrid";
|
||||
else if (g.field === "title" && g.mode === "exclude" && plain(g)) slot = "titles";
|
||||
if (slot && !where[slot]) where[slot] = g;
|
||||
else rest.push(g);
|
||||
}
|
||||
@@ -561,7 +565,9 @@
|
||||
const { where, rest } = distribute(row ? row.gates : []);
|
||||
const countries = countryInput(where.countries ? where.countries.values : []);
|
||||
const places = wordInput(where.places ? where.places.values : [], "Add a town");
|
||||
const titles = wordInput(where.titles ? where.titles.values : [], "account executive");
|
||||
const terms = wordInput(row ? row.fetch_terms || [] : [], "machine learning, data science");
|
||||
$("#a-titles", f).replaceWith(titles.node);
|
||||
$("#a-terms", f).replaceWith(terms.node);
|
||||
$("#a-countries", f).replaceWith(countries.node);
|
||||
$("#a-towns", f).replaceWith(places.node);
|
||||
@@ -601,7 +607,8 @@
|
||||
});
|
||||
|
||||
// The gates the Where block says, in the order the starter agents have
|
||||
// them: the must on country, the lines, then hybrid.
|
||||
// them: the must on country, the lines, then hybrid; and the titles left
|
||||
// out, the block under it.
|
||||
function whereGates() {
|
||||
const out = [];
|
||||
const within = countries.values();
|
||||
@@ -615,6 +622,8 @@
|
||||
if ($("#a-hybrid", f).checked) {
|
||||
out.push({ field: "remote", values: ["hybrid"], mode: "prefer", weight: Number($("#a-hybrid-weight", f).value) });
|
||||
}
|
||||
const left = titles.values();
|
||||
if (left.length) out.push({ field: "title", values: left, mode: "exclude" });
|
||||
return out;
|
||||
}
|
||||
// The gates Save sends: the Where block's, then the rows. The sentence
|
||||
|
||||
+2
-1
@@ -1223,7 +1223,8 @@ table.applications td[data-label="Saved"] { white-space: nowrap; color: var(--di
|
||||
border-radius: .3rem; padding: .35rem .5rem;
|
||||
}
|
||||
/* The fieldsets that hold rows: a column, the Add button under the rows. */
|
||||
.agent-form fieldset.prompts, .agent-form fieldset.where, .agent-form fieldset.terms,
|
||||
.agent-form fieldset.prompts, .agent-form fieldset.where, .agent-form fieldset.titles,
|
||||
.agent-form fieldset.terms,
|
||||
.agent-form fieldset.rules {
|
||||
display: flex; flex-direction: column; align-items: stretch; gap: .5rem; min-width: 0;
|
||||
border: 1px solid var(--line); border-radius: .3rem;
|
||||
|
||||
Reference in new issue
Block a user