Rebuild the agent form as the fetch gate, the feed order, the cut and summarise, and name fetch text and the overrides as built
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fbc0f16c4a
commit
61aadff681
7 files changed
+185
-198
No files matched your search
+72
-96
@@ -5,18 +5,24 @@
|
||||
* switch, its prompts, its gates in words, its weights, and a link to the
|
||||
* Roles tab in its order. The prompts are the body, since fit is measured
|
||||
* against the one a role fits best; the weights only share out the terms.
|
||||
* The form edits the prompts as rows, and the gates as a Where block, a
|
||||
* short list of lines a role passes by matching any one of, over a row per
|
||||
* remaining rule under Advanced; a gate Where cannot say lands in a row, so
|
||||
* a load and a save lose nothing. Edit turns a card
|
||||
* The form edits the prompts as rows, and the fetch gate in three parts: the
|
||||
* region (the scope select), the place (a short list of lines a role passes by
|
||||
* matching any one of: countries, towns, remote) and the role (the fetch terms
|
||||
* and the titles to leave out), over a row per remaining rule under Advanced;
|
||||
* a gate the three parts cannot say lands in a row, so a load and a save lose
|
||||
* nothing. A gate is a field, values and a mode (must, one of, not), with no
|
||||
* weight. After it come the feed order (the four weights of the final score and
|
||||
* the CV match weights), the cut (the best N by fit and the best M by CV
|
||||
* closeness, each with a minimum level) and the size of summarise. Edit turns a card
|
||||
* into the form from the page's `<template>`, in place, and New agent puts a
|
||||
* blank card on top in the same state. One card edits at a time, so the
|
||||
* form's ids stay unique. Votes, liked companies and scores are the agent's,
|
||||
* so a delete takes them with it, and the confirm says so.
|
||||
*
|
||||
* The fetch terms are chips of free text, as the towns are: words that
|
||||
* narrow what big boards read with the wide reach send (app/jobs/reach.py).
|
||||
* The card says them in a line of their own, or that boards send every role.
|
||||
* The fetch terms are chips of free text, as the towns are: words a big board
|
||||
* (300 roles or more) whose host takes a query must match before it sends a
|
||||
* role (app/jobs/reach.py). The card says them in a line of their own, or that
|
||||
* boards send every role.
|
||||
*
|
||||
* The CV fieldset holds what the judge stage reads a role against: the CV as
|
||||
* text (typed, or read from a .md/.txt file by the browser), the languages it
|
||||
@@ -40,14 +46,14 @@
|
||||
|
||||
const DEFAULT_WEIGHTS = { fit: 0.6, recency: 0.2, affinity: 0.2, taste: 0.2,
|
||||
cv_skills: 30, cv_experience: 25, cv_career: 30 };
|
||||
// What the model reads after a pull, per agent: the best `extract_top`
|
||||
// roles scoring at least `extract_min` get their gate columns filled, the
|
||||
// best `summarise_top` at `summarise_min` or more a summary, and so does any
|
||||
// role that is saved or liked, whatever its score. The judge reads the best
|
||||
// `judge_top` at `judge_min` or more and the `judge_cv_top` ungated roles
|
||||
// closest to the CV that those leave out.
|
||||
const DEFAULT_LIMITS = { extract_top: 500, extract_min: 0.55, summarise_top: 30, summarise_min: 0.65,
|
||||
judge_top: 150, judge_min: 0.55, judge_cv_top: 50 };
|
||||
// What the models read after a pull, per agent (`app.models.Limits`): the
|
||||
// cut is the best `cut_fit_top` roles by fit at `cut_fit_min` or more, then
|
||||
// the best `cut_cv_top` by CV closeness at `cut_cv_min` or more that the
|
||||
// first list leaves out, and every role liked or saved. Fetch text, extract
|
||||
// and judge read the cut; summarise reads the top `summarise_top` of the
|
||||
// feed and the roles liked or saved.
|
||||
const DEFAULT_LIMITS = { cut_fit_top: 500, cut_fit_min: 0.6, cut_cv_top: 150, cut_cv_min: 0.6,
|
||||
summarise_top: 50 };
|
||||
// The levels of a language, the order of the server's ladder, and how big a
|
||||
// CV file the browser reads into the box.
|
||||
const LEVELS = ["basic", "conversational", "professional", "fluent", "native"];
|
||||
@@ -57,13 +63,12 @@
|
||||
const EUROPE = rh.EUROPE;
|
||||
const FIELDS = ["place", "country", "remote", "remote_from", "seniority", "function", "salary_min",
|
||||
"currency", "permit", "languages", "company", "title"];
|
||||
const MODES = [["require", "must"], ["any", "one of"], ["prefer", "prefer"], ["exclude", "not"]];
|
||||
const HYBRID_WEIGHT = 0.05;
|
||||
const MODES = [["require", "must"], ["any", "one of"], ["exclude", "not"]];
|
||||
|
||||
/** @type {object[]} every agent, as the server lists them */
|
||||
let agents = [];
|
||||
/** @type {Object<string, boolean>} whether extract, summarise and judge run, from
|
||||
* `/api/stages`; empty when that did not answer, and then a card says
|
||||
/** @type {Object<string, boolean>} whether extract, summarise, judge and
|
||||
* fetch_text run, from `/api/stages`; empty when that did not answer, and then a card says
|
||||
* nothing about them */
|
||||
let stageOn = {};
|
||||
/** @type {number | "new" | null} the card in edit mode: an agent's id, NEW
|
||||
@@ -249,7 +254,7 @@
|
||||
return `with ${gate.field.replace("_", " ")} ${values.join(", ")}`;
|
||||
}
|
||||
|
||||
// The scope of the Where block in words: "Within Europe", "Within Denmark or
|
||||
// The region in words: "Within Europe", "Within Denmark or
|
||||
// Sweden", "Everywhere".
|
||||
function scopeWords(scope) {
|
||||
if (scope.kind === "everywhere") return "Everywhere";
|
||||
@@ -257,7 +262,7 @@
|
||||
return `Within ${phrase({ field: "country", values: scope.values }).replace(/^in /, "")}`;
|
||||
}
|
||||
|
||||
// The Where block in words, one sentence led by its scope, then the lines a
|
||||
// The region and place in words, one sentence led by the region, then the lines a
|
||||
// role may match, with the one-of rows among them since they are the same
|
||||
// group: "Within Europe: keeps roles anywhere in Denmark, in Malmö, Lund or
|
||||
// Helsingborg, or remote, and leaves out the rest." The lines add up, which
|
||||
@@ -276,50 +281,51 @@
|
||||
return `${scopeWords(where.scope)}: keeps roles ${list}, and leaves out the rest.`;
|
||||
}
|
||||
|
||||
// The gates in words: where a role may be, then what it must meet, then
|
||||
// what lifts it. "Within Europe: keeps roles anywhere in Denmark, or remote,
|
||||
// and leaves out the rest. Only roles with seniority senior. Prefers
|
||||
// hybrid."
|
||||
// The gates in words: the region and the places a role may be, then what
|
||||
// it must meet, then what is left out. "Within Europe: keeps roles anywhere
|
||||
// in Denmark, or remote, and leaves out the rest. Only roles with seniority
|
||||
// senior. Leaves out titles with “sales”."
|
||||
function rulesLine(gates) {
|
||||
const { where, rest } = rh.distribute(gates);
|
||||
const of = (mode) => rest.filter((g) => g.mode === mode);
|
||||
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(" ");
|
||||
}
|
||||
|
||||
// What the model reads after a pull, one clause per stage. A stage that is
|
||||
// off says so, with a link to its switch under Runs: the numbers are only
|
||||
// what it would read once it is on.
|
||||
// What the models read after a pull: the cut, then the stages that read
|
||||
// it, then summarise's own size. A stage that is off says so, with a link to
|
||||
// its switch under Runs: the numbers are only what it would read once it is
|
||||
// on. The stage names are those of `/api/stages`.
|
||||
function limitsLine(row) {
|
||||
const l = Object.assign({}, DEFAULT_LIMITS, row.limits);
|
||||
const p = el("p", "agent-limits");
|
||||
const judged = `${l.judge_top} at ${l.judge_min}`
|
||||
+ (l.judge_cv_top ? ` and the ${l.judge_cv_top} closest to the CV` : "");
|
||||
const clauses = [
|
||||
["extract", `reads ${l.extract_top} at ${l.extract_min}`, `${l.extract_top} at ${l.extract_min}`],
|
||||
["summarise", `summarises ${l.summarise_top} at ${l.summarise_min}`, `${l.summarise_top} at ${l.summarise_min}`],
|
||||
["judge", `judges ${judged}`, judged],
|
||||
];
|
||||
clauses.forEach(([name, on, would], i) => {
|
||||
if (i) p.append(" · ");
|
||||
if (stageOn[name] === false) {
|
||||
const off = link("/settings/sources#stages", `${name} is off`);
|
||||
off.title = "Switch it on under Runs, What the model reads.";
|
||||
p.append(off, ` (${would})`);
|
||||
} else {
|
||||
p.append(on);
|
||||
}
|
||||
});
|
||||
const lists = [];
|
||||
if (l.cut_fit_top) lists.push(`the best ${l.cut_fit_top} by fit at ${l.cut_fit_min} or more`);
|
||||
if (l.cut_cv_top) lists.push(`the best ${l.cut_cv_top} by closeness to the CV at ${l.cut_cv_min} or more`);
|
||||
const cut = lists.length ? `${orList(lists)}, and liked and saved roles` : "liked and saved roles only";
|
||||
p.append(`The cut: ${cut}.`);
|
||||
const off = (name, would) => {
|
||||
const a = link("/settings/sources#stages", `${name} is off`);
|
||||
a.title = "Switch it on under Runs.";
|
||||
p.append(" · ", a, ` (${would})`);
|
||||
};
|
||||
const reads = [["fetch_text", "fetch text"], ["extract", "extract"], ["judge", "judge"]];
|
||||
const on = reads.filter(([key]) => stageOn[key] !== false).map(([, name]) => name);
|
||||
if (on.length) {
|
||||
const said = on.length < 2 ? on[0] : `${on.slice(0, -1).join(", ")} and ${on[on.length - 1]}`;
|
||||
p.append(` ${said[0].toUpperCase()}${said.slice(1)} ${on.length > 1 ? "read" : "reads"} it`);
|
||||
}
|
||||
for (const [key, name] of reads) if (stageOn[key] === false) off(name, "reads the cut");
|
||||
const summarised = `the top ${l.summarise_top} of the feed and liked and saved roles`;
|
||||
if (stageOn.summarise === false) off("summarise", `summarises ${summarised}`);
|
||||
else p.append(` · summarises ${summarised}`);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -504,7 +510,7 @@
|
||||
function termsLine(row) {
|
||||
const terms = row.fetch_terms || [];
|
||||
return el("p", "agent-terms", terms.length
|
||||
? `Big boards read across Europe send only roles matching ${orList(terms.map((t) => `“${t}”`))}.`
|
||||
? `Boards of 300 or more roles whose host takes a query send only roles matching ${orList(terms.map((t) => `“${t}”`))}.`
|
||||
: "Big boards send every role: no fetch terms.");
|
||||
}
|
||||
|
||||
@@ -578,8 +584,7 @@
|
||||
return { node: row, read: () => ({ language: code.value.trim().toLowerCase(), level: level.value }) };
|
||||
}
|
||||
|
||||
// A gate as a row: field, mode, values, the weight while it is prefer, and
|
||||
// Remove. Values untouched since the load are sent as they came, so a
|
||||
// A gate as a row: field, mode, values and Remove. Values untouched since the load are sent as they came, so a
|
||||
// value with a comma in it survives a save.
|
||||
function ruleRow(gate, remove) {
|
||||
const row = el("div", "rule-row");
|
||||
@@ -593,31 +598,16 @@
|
||||
values.value = gate.values.join(", ");
|
||||
values.setAttribute("aria-label", "Values, separated by commas");
|
||||
const loaded = values.value;
|
||||
const weight = el("input");
|
||||
weight.type = "number";
|
||||
weight.min = "0";
|
||||
weight.step = "0.05";
|
||||
weight.value = gate.mode === "prefer" && gate.weight !== undefined ? gate.weight : HYBRID_WEIGHT;
|
||||
weight.setAttribute("aria-label", "Weight");
|
||||
weight.title = "What a role that meets it gains.";
|
||||
// A must or one-of gate carries a weight nobody reads; kept as it came.
|
||||
const kept = gate.mode === "prefer" ? undefined : gate.weight;
|
||||
const drop = linky("Remove");
|
||||
drop.addEventListener("click", () => remove(row));
|
||||
const shown = () => { weight.hidden = mode.value !== "prefer"; };
|
||||
mode.addEventListener("change", shown);
|
||||
shown();
|
||||
row.append(field, mode, values, weight, drop);
|
||||
row.append(field, mode, values, drop);
|
||||
|
||||
function read() {
|
||||
const parts = values.value === loaded
|
||||
? gate.values
|
||||
: values.value.split(",").map((v) => v.trim()).filter(Boolean)
|
||||
.map((v) => (field.value === "salary_min" ? Number(v) : v));
|
||||
const out = { field: field.value, values: parts, mode: mode.value };
|
||||
if (mode.value === "prefer") out.weight = Number(weight.value);
|
||||
else if (kept !== undefined && kept !== 1) out.weight = kept;
|
||||
return out;
|
||||
return { field: field.value, values: parts, mode: mode.value };
|
||||
}
|
||||
return { node: row, read };
|
||||
}
|
||||
@@ -720,12 +710,6 @@
|
||||
remoteFrom.node.hidden = remoteMode.value !== "from";
|
||||
};
|
||||
offer();
|
||||
// The hybrid weight shows only when it is not the default; either way it
|
||||
// is sent back as it came.
|
||||
const hybridWeight = where.hybrid && where.hybrid.weight !== undefined ? where.hybrid.weight : HYBRID_WEIGHT;
|
||||
$("#a-hybrid", f).checked = Boolean(where.hybrid);
|
||||
$("#a-hybrid-weight", f).value = hybridWeight;
|
||||
$("#a-hybrid-weight-line", f).hidden = hybridWeight === HYBRID_WEIGHT;
|
||||
$("details.advanced", f).open = rest.length > 0;
|
||||
|
||||
const rules = [];
|
||||
@@ -742,13 +726,12 @@
|
||||
};
|
||||
rest.forEach(addRule);
|
||||
$("#a-add-rule", f).addEventListener("click", () => {
|
||||
$("select", addRule({ field: "seniority", values: [], mode: "prefer", weight: HYBRID_WEIGHT }).node).focus();
|
||||
$("select", addRule({ field: "seniority", values: [], mode: "require" }).node).focus();
|
||||
changed(f);
|
||||
});
|
||||
|
||||
// The gates the Where block says, in the order the starter agents have
|
||||
// them: the scope, the lines, then hybrid; and the titles left out, the
|
||||
// block under it.
|
||||
// The gates the fetch gate's three parts say, in the order the starter
|
||||
// agents have them: the region, the place lines, and the titles left out.
|
||||
function whereGates() {
|
||||
const out = [];
|
||||
const within = countries.values();
|
||||
@@ -762,20 +745,17 @@
|
||||
if (remoteMode.value === "scope") out.push({ field: "remote", values: ["remote"], mode: "any" });
|
||||
if (remoteMode.value === "from" && from.length) out.push({ field: "remote_from", values: from, mode: "any" });
|
||||
if (towns.length) out.push({ field: "place", values: towns, mode: "any" });
|
||||
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
|
||||
// under Where says them all, as the card will, rows included.
|
||||
// The gates Save sends: the fetch gate's, then the rows. The sentence
|
||||
// under it says them all, as the card will, rows included.
|
||||
const gates = () => whereGates().concat(rules.map((r) => r.read()));
|
||||
const view = () => {
|
||||
offer();
|
||||
$("#a-gates", f).value = JSON.stringify(gates(), null, 2);
|
||||
$("#a-where-sum", f).textContent = rulesLine(gates()) || "Keeps roles anywhere.";
|
||||
$("#a-where-sum", f).textContent = rulesLine(gates()) || "Passes every role.";
|
||||
};
|
||||
view();
|
||||
|
||||
@@ -786,13 +766,11 @@
|
||||
$("#a-cv-skills", f).value = weights.cv_skills;
|
||||
$("#a-cv-experience", f).value = weights.cv_experience;
|
||||
$("#a-cv-career", f).value = weights.cv_career;
|
||||
$("#a-extract-top", f).value = limits.extract_top;
|
||||
$("#a-extract-min", f).value = limits.extract_min;
|
||||
$("#a-cut-fit-top", f).value = limits.cut_fit_top;
|
||||
$("#a-cut-fit-min", f).value = limits.cut_fit_min;
|
||||
$("#a-cut-cv-top", f).value = limits.cut_cv_top;
|
||||
$("#a-cut-cv-min", f).value = limits.cut_cv_min;
|
||||
$("#a-summarise-top", f).value = limits.summarise_top;
|
||||
$("#a-summarise-min", f).value = limits.summarise_min;
|
||||
$("#a-judge-top", f).value = limits.judge_top;
|
||||
$("#a-judge-min", f).value = limits.judge_min;
|
||||
$("#a-judge-cv-top", f).value = limits.judge_cv_top;
|
||||
$("#a-delete", f).hidden = !row;
|
||||
f.addEventListener("input", () => { f.dataset.dirty = "true"; view(); });
|
||||
f.addEventListener("change", view);
|
||||
@@ -898,13 +876,11 @@
|
||||
cv_career: Number($("#a-cv-career", f).value),
|
||||
},
|
||||
limits: {
|
||||
extract_top: Number($("#a-extract-top", f).value),
|
||||
extract_min: Number($("#a-extract-min", f).value),
|
||||
cut_fit_top: Number($("#a-cut-fit-top", f).value),
|
||||
cut_fit_min: Number($("#a-cut-fit-min", f).value),
|
||||
cut_cv_top: Number($("#a-cut-cv-top", f).value),
|
||||
cut_cv_min: Number($("#a-cut-cv-min", f).value),
|
||||
summarise_top: Number($("#a-summarise-top", f).value),
|
||||
summarise_min: Number($("#a-summarise-min", f).value),
|
||||
judge_top: Number($("#a-judge-top", f).value),
|
||||
judge_min: Number($("#a-judge-min", f).value),
|
||||
judge_cv_top: Number($("#a-judge-cv-top", f).value),
|
||||
},
|
||||
fetch_terms: read.terms(),
|
||||
cv_text: $("#a-cv-text", f).value,
|
||||
|
||||
+27
-31
@@ -188,38 +188,34 @@
|
||||
|
||||
/* The two fetch overrides, one more pair of toggles in the affinity
|
||||
buttons' fragment beside them, in a group of their own since they are
|
||||
global rather than an agent's stance (app/jobs/reach.py). Fetching has
|
||||
two filters, and by default a company follows the agents on both:
|
||||
- All countries reads its big boards (300 roles or more) with the
|
||||
agents' wide reach, Europe today, rather than their places.
|
||||
- All roles reads them with no role-type narrowing: none of the agents'
|
||||
fetch terms, which only apply with the wide reach, and none of the
|
||||
role filters that may come later.
|
||||
On queues a pull on the server, as the other reopening switches do; off
|
||||
asks nothing, since no role closes until the next pull reads the board
|
||||
with its filters again. `company` is the shared list's row;
|
||||
`onChange` runs after the server accepted a switch, with the company it
|
||||
answered. */
|
||||
global rather than an agent's stance (app/jobs/reach.py). The fetch gate
|
||||
has three parts, region, place and role, and a company follows every
|
||||
agent's on all three unless it is set to:
|
||||
- All countries: the place part is skipped. The company's roles are
|
||||
fetched and kept from the whole region (Europe), not only the agents'
|
||||
places, for every agent. The region itself still holds.
|
||||
- All roles: the role part is skipped: no fetch terms and no titles to
|
||||
leave out.
|
||||
Turning either on or off queues a rescore on the server, as the other
|
||||
switches that change what passes do, and a pull reads the board anew.
|
||||
`company` is the shared list's row; `onChange` runs after the server
|
||||
accepted a switch, with the company it answered. */
|
||||
const OVERRIDES = [
|
||||
{ value: "countries", field: "all_countries", path: "all-countries", text: "All countries",
|
||||
on: "All countries is on: this company's big boards are read across the agents' wide "
|
||||
+ "reach (Europe), not only the agents' places. The default is the agents' places. "
|
||||
+ "Boards under 300 roles are read whole either way. Turning it off asks nothing "
|
||||
+ "first: no role closes until the next pull reads the board again.",
|
||||
off: "All countries: read this company's big boards across the agents' wide reach "
|
||||
+ "(Europe) instead of the agents' places, the default. Boards under 300 roles are "
|
||||
+ "read whole already. Turning it on queues a pull.",
|
||||
said: (on) => (on ? "all countries in the agents' wide reach" : "the agents' places") },
|
||||
on: "All countries is on: this company's roles are fetched and kept from the whole "
|
||||
+ "region (Europe), not only the agents' places, for every agent. The region still "
|
||||
+ "holds. Turning it off puts the agents' places back and rescores.",
|
||||
off: "All countries: fetch and keep this company's roles from the whole region "
|
||||
+ "(Europe) instead of only the agents' places, for every agent. Turning it on "
|
||||
+ "rescores.",
|
||||
said: (on) => (on ? "all countries in the region" : "the agents' places") },
|
||||
{ value: "roles", field: "all_roles", path: "all-roles", text: "All roles",
|
||||
on: "All roles is on: this company's boards are read with no role-type narrowing, "
|
||||
+ "none of the agents' fetch terms. The default follows the terms, which only apply "
|
||||
+ "with All countries or on a host that cannot ask for each country. Turning it off "
|
||||
+ "asks nothing first.",
|
||||
off: "All roles: no role-type narrowing for this company, none of the agents' fetch "
|
||||
+ "terms, the default, nor later role filters. The terms only apply with All "
|
||||
+ "countries or on a host that cannot ask for each country, so on its own this "
|
||||
+ "changes nothing today. Turning it on queues a pull.",
|
||||
said: (on) => (on ? "every role type" : "the agents' terms") },
|
||||
on: "All roles is on: this company's roles are fetched with no fetch terms and kept "
|
||||
+ "whatever their title, for every agent. Turning it off puts the agents' fetch "
|
||||
+ "terms and titles to leave out back and rescores.",
|
||||
off: "All roles: fetch this company's roles with no fetch terms and no titles to "
|
||||
+ "leave out, for every agent. Turning it on rescores.",
|
||||
said: (on) => (on ? "every role type" : "the agents' fetch terms and titles") },
|
||||
];
|
||||
|
||||
function overridesControl(companyKey, company, onChange) {
|
||||
@@ -258,8 +254,8 @@
|
||||
company.all_roles = Boolean(updated.all_roles);
|
||||
}
|
||||
window.toast.info(on
|
||||
? `${updated.name}: ${o.said(true)}. Reading now, or with the pull right after.`
|
||||
: `${updated.name}: back to ${o.said(false)} from the next pull.`);
|
||||
? `${updated.name}: ${o.said(true)}. Rescoring now, and a pull reads the board right after.`
|
||||
: `${updated.name}: back to ${o.said(false)}. Rescoring now, and the next pull reads the board anew.`);
|
||||
if (onChange) await onChange(updated);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
* from app/jobs/reach.py), so the row shows whether the company follows the
|
||||
* agents' filters or overrides them. Its editor has a second line that sets
|
||||
* the board's own reach: the agents', or its own countries and remote,
|
||||
* posted to `/api/sources/{id}/reach`. The wide reach (Europe) and no role
|
||||
* narrowing are the company's two overrides instead, and the board's own
|
||||
* countries win over All countries.
|
||||
* posted to `/api/sources/{id}/reach`. Fetching from the whole region (All
|
||||
* countries) and no fetch terms or titles to leave out (All roles) are the
|
||||
* company's two overrides instead, and the board's own countries win over
|
||||
* All countries.
|
||||
*
|
||||
* Beside that line stands the board's size, set when it was added and
|
||||
* changed only by a Recheck ("999 roles · checked 30 Sep"). Recheck, beside
|
||||
@@ -325,11 +326,12 @@
|
||||
note.className = "muted small";
|
||||
note.textContent = [
|
||||
company.all_countries
|
||||
? "All countries is on; countries set here win over it."
|
||||
: "All countries, beside the stars, reads the agents' wide reach (Europe).",
|
||||
? "All countries is on: roles are fetched and kept from the whole region, and countries set here win over it."
|
||||
: "All countries, beside the stars, fetches and keeps this company's roles from the whole region (Europe), not only the agents' places.",
|
||||
company.all_roles
|
||||
? "All roles is on: no fetch terms."
|
||||
: "All roles drops the agents' fetch terms.",
|
||||
? "All roles is on: no fetch terms and no titles to leave out."
|
||||
: "All roles drops the fetch terms and the titles to leave out.",
|
||||
"Turning either on or off rescores.",
|
||||
].join(" ");
|
||||
form.append(mode, codes, remote, save, note);
|
||||
form.addEventListener("submit", async (event) => {
|
||||
|
||||
+18
-16
@@ -1,5 +1,6 @@
|
||||
/* The Runs section of Sources: the "Run the pull now" button, and the
|
||||
* switches for the stages of a pull: the two that ask a model and enrich.
|
||||
* switches for the stages of a pull: extract, summarise and judge, which ask a
|
||||
* model, and fetch text, which reads a role's own page and asks none.
|
||||
*
|
||||
* The switches are `/api/stages`: one row per stage, drawn as the search
|
||||
* rows above are (`.srow`, `.switch`), and a switch is a PUT that stores the
|
||||
@@ -59,12 +60,15 @@
|
||||
|
||||
// ------------------------------------------------- what the model reads
|
||||
|
||||
// `depth` is whose setting says how many roles a stage reads: every stage
|
||||
// but summarise reads each agent's cut, summarise its own size.
|
||||
const DOES = {
|
||||
extract: "fills in country, seniority, salary and the like from what the posting says",
|
||||
summarise: "writes a short summary and tags for the best roles",
|
||||
judge: "scores the best roles against a search agent's CV, for CV match",
|
||||
enrich: "reads the own page of the best roles whose list gave no text",
|
||||
extract: "fills in location, remote area, seniority, languages and the like from what the posting says, for every role in the cut",
|
||||
summarise: "writes a short summary and tags for the top of the feed, and for every role you liked or saved",
|
||||
judge: "scores every role in the cut against a search agent's CV, for CV match",
|
||||
fetch_text: "reads the own page of every role in the cut that came without text, with no model, before extract and judge",
|
||||
};
|
||||
const NAMES = { fetch_text: "Fetch text" };
|
||||
|
||||
const el = (tag, className, text) => {
|
||||
const node = document.createElement(tag);
|
||||
@@ -106,20 +110,18 @@
|
||||
const row = el("div", "srow");
|
||||
if (!stage.on) row.dataset.muted = "true";
|
||||
const name = el("span", "name");
|
||||
name.append(el("span", "", stage.name[0].toUpperCase() + stage.name.slice(1)),
|
||||
name.append(el("span", "", NAMES[stage.name] || stage.name[0].toUpperCase() + stage.name.slice(1)),
|
||||
...(stage.model ? [el("span", "badge", stage.model)] : []));
|
||||
row.append(name, stageSwitch(stage, () => renderStages(stages)));
|
||||
const sub = el("span", "sub");
|
||||
if (stage.name === "enrich") {
|
||||
/* Global, unlike the model stages: `enrich.top` and `enrich.min_score`. */
|
||||
sub.append(`${DOES[stage.name]}. How many it reads is set for every agent alike by `
|
||||
+ "enrich.top and enrich.min_score in config.yaml");
|
||||
} else {
|
||||
sub.append(`${DOES[stage.name]}. How deep it reads is set per search agent, under `);
|
||||
const agents = el("a", "", "Search agents");
|
||||
agents.href = "/settings/agents";
|
||||
sub.append(agents);
|
||||
}
|
||||
/* Depth is per search agent: the cut for fetch text, extract and judge,
|
||||
summarise's own size. Fetch text keeps per_board, per_run and
|
||||
retry_days in config.yaml, which only bound its load on a host. */
|
||||
sub.append(`${DOES[stage.name]}. How many it reads is each search agent's `
|
||||
+ `${stage.name === "summarise" ? "summarise size" : "cut"}, under `);
|
||||
const agents = el("a", "", "Search agents");
|
||||
agents.href = "/settings/agents";
|
||||
sub.append(agents);
|
||||
sub.append(stage.source === "config"
|
||||
? ". Following config.yaml until this switch is used."
|
||||
: ".");
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
{% block title %}Search agents — roledesk{% endblock %}
|
||||
|
||||
{# A card per agent: `static/agents.js` fills the list from `/api/agents`,
|
||||
newest first. A card shows the agent's prompts, its rules in words, its
|
||||
switch and its weights; Edit turns that card into the form below, in place, and New puts
|
||||
newest first. A card shows the agent's prompts, its fetch gate in words, its
|
||||
switch, its weights, its cut and its summarise size; Edit turns that card into the form below, in place, and New puts
|
||||
a blank one on top. The form is a `<template>` because only one card edits
|
||||
at a time, so its ids stay unique. #}
|
||||
{% block content %}
|
||||
<h1>Search agents</h1>
|
||||
<p class="lede">A search agent is what the Roles tab ranks by: describe each kind of role you want as a prompt, say where, weigh the terms, and it scores every open role against the prompt each fits best. Several agents rank the same roles differently, each with its own votes and liked companies; Viewing as on Roles picks one, and its votes are that agent's.</p>
|
||||
<p class="lede">A search agent is what the Roles tab ranks by: describe each kind of role you want as a prompt, set the fetch gate (where, what role), and it measures every open role against the prompt each fits best. Several agents rank the same roles differently, each with its own votes and liked companies; Viewing as on Roles picks one, and its votes are that agent's.</p>
|
||||
|
||||
<div class="agents-head">
|
||||
<p id="agents-count" class="count" role="status"></p>
|
||||
@@ -27,8 +27,9 @@
|
||||
<span class="hint">A prompt is one kind of role in your own words: the work, the level, the setting. A role is ranked by the prompt it fits best, so three kinds of role are three prompts, not one blended paragraph. Votes and liked companies count for the whole agent.</span>
|
||||
</fieldset>
|
||||
<fieldset class="where">
|
||||
<legend>Where can the role be?</legend>
|
||||
<span class="hint">Each line adds places. A role is kept when it fits at least one line, so a line more means more roles, never fewer. With every line empty a role can be anywhere. A role whose location is not known yet ranks until extract reads the posting.</span>
|
||||
<legend>The fetch gate</legend>
|
||||
<span class="hint">Hard rules, a yes or no per role, applied at every stage: at the host where it can filter, before anything is scored, again after extract has read the posting, and in the feed. A role that fails is never read by a model and never shown. A rule rejects on evidence only: a role whose location is not known yet passes until extract reads it. A company set to All countries skips the place part and one set to All roles skips the role part, for every agent; both are switched under Sources.</span>
|
||||
<h3>Region</h3>
|
||||
<div class="where-line">
|
||||
<span>Only roles in:</span>
|
||||
<select id="a-scope" aria-label="Only roles in">
|
||||
@@ -38,7 +39,9 @@
|
||||
</select>
|
||||
<div id="a-scope-countries"></div>
|
||||
</div>
|
||||
<span class="hint">Every role must be in this, whatever the lines below add. A company set to All countries is read within this.</span>
|
||||
<span class="hint">Every role must be in this, and no company switch lifts it. A company set to All countries is fetched and kept from the whole region.</span>
|
||||
<h3>Place</h3>
|
||||
<span class="hint">A role passes when it matches at least one line: a country, a town or remote, so a line more means more roles. With every line empty a role can be anywhere in the region.</span>
|
||||
<div class="where-line">
|
||||
<span>Anywhere in</span>
|
||||
<div id="a-countries"></div>
|
||||
@@ -47,36 +50,29 @@
|
||||
<span>or in the towns</span>
|
||||
<div id="a-towns"></div>
|
||||
</div>
|
||||
<span class="hint">Towns are for places outside the countries above: with Denmark above, Malmö here adds Malmö to all of Denmark. A town inside a country above changes nothing, since the whole country is in already.</span>
|
||||
<span class="hint">Towns are for places outside the countries above: with Denmark above, Malmö here adds Malmö to all of Denmark. A town inside a country above changes nothing.</span>
|
||||
<div class="where-line">
|
||||
<span>Remote:</span>
|
||||
<select id="a-remote" aria-label="Remote">
|
||||
<option value="none">no</option>
|
||||
<option value="scope">anywhere within the scope</option>
|
||||
<option value="scope">anywhere within the region</option>
|
||||
<option value="from">only when open to someone in:</option>
|
||||
</select>
|
||||
<div id="a-remote-from"></div>
|
||||
</div>
|
||||
<span class="hint">Remote roles are kept on top of the lines above. A remote role whose area is not stated yet ranks until extract reads the posting.</span>
|
||||
<label class="inline where-rank"><input type="checkbox" id="a-hybrid"> Prefer hybrid<span id="a-hybrid-weight-line">, adding <input type="number" id="a-hybrid-weight" min="0" step="0.05" value="0.05" aria-label="Weight of hybrid"></span></label>
|
||||
<span class="hint">This one ranks rather than filters: a hybrid role gains a little.</span>
|
||||
<p id="a-where-sum" class="where-sum" role="status"></p>
|
||||
</fieldset>
|
||||
<fieldset class="titles">
|
||||
<legend>Which titles to leave out?</legend>
|
||||
<div class="where-line">
|
||||
<span>Leave out titles with</span>
|
||||
<div id="a-titles"></div>
|
||||
</div>
|
||||
<span class="hint">Separate phrases with a comma or Enter. A phrase matches whole words anywhere in the title, whatever the case: <code>account executive</code> takes "Enterprise Account Executive, UK", and <code>data engineer</code> leaves "Data Engineering Manager" alone. A shorter phrase takes more: <code>sales</code> takes Sales Engineer too. It applies to liked companies as well. A role left out keeps its row, and Show gated on Roles lists it with the phrase that took it.</span>
|
||||
</fieldset>
|
||||
<fieldset class="terms">
|
||||
<legend>What big boards send</legend>
|
||||
<span class="hint">A remote role passes on top of the lines above. A remote role whose area is not stated yet passes until extract reads the posting.</span>
|
||||
<h3>Role</h3>
|
||||
<div class="where-line">
|
||||
<span>Only roles matching</span>
|
||||
<div id="a-terms"></div>
|
||||
</div>
|
||||
<span class="hint">Separate terms with a comma or Enter: <code>machine learning, data science</code> is two terms, and <code>machine learning</code> is searched as one. A board then sends only roles with one of the terms anywhere in the ad, not only the title. Only applies to big boards read across Europe (All countries). Empty means no narrowing.</span>
|
||||
<span class="hint">Fetch terms, separated by a comma or Enter: <code>machine learning, data science</code> is two terms, and <code>machine learning</code> is searched as one. They are asked of the host, which then sends only roles with one of the terms anywhere in the ad, not only the title. They apply on boards of 300 or more roles whose host takes a query, and only there; smaller boards and other hosts are read whole. Empty means no narrowing.</span>
|
||||
<div class="where-line">
|
||||
<span>Leave out titles with</span>
|
||||
<div id="a-titles"></div>
|
||||
</div>
|
||||
<span class="hint">Phrases, separated by a comma or Enter. A phrase matches whole words anywhere in the title, whatever the case: <code>account executive</code> takes "Enterprise Account Executive, UK", and <code>data engineer</code> leaves "Data Engineering Manager" alone. A shorter phrase takes more: <code>sales</code> takes Sales Engineer too. A host cannot be asked this, so it applies once the roles are in, to liked companies as well. A role left out keeps its row, and Show gated on Roles lists it with the phrase that took it.</span>
|
||||
<p id="a-where-sum" class="where-sum" role="status"></p>
|
||||
</fieldset>
|
||||
<fieldset class="terms cv">
|
||||
<legend>Your CV</legend>
|
||||
@@ -97,15 +93,16 @@
|
||||
<textarea id="a-like-text" rows="4" placeholder="Building a team from scratch, close work with the product side, small companies, a say in the roadmap"></textarea></label>
|
||||
<label>What I don't like
|
||||
<textarea id="a-avoid-text" rows="4" placeholder="Constant on-call, sales targets, large consultancies, open-plan offices"></textarea></label>
|
||||
<span class="hint">The work, the workplace, situations; read by the CV match for the career score. Rules that must hold go under Where or Other rules instead.</span>
|
||||
<span class="hint">The work, the workplace, situations; read by the CV match for the career score. Rules that must hold go under the fetch gate or Other rules instead.</span>
|
||||
</fieldset>
|
||||
<fieldset class="weights">
|
||||
<legend>How much each counts</legend>
|
||||
<label>Fit to the text <input type="number" id="a-fit" min="0" step="0.05" value="0.6"></label>
|
||||
<legend>The feed order</legend>
|
||||
<label>Fit to the prompts <input type="number" id="a-fit" min="0" step="0.05" value="0.6"></label>
|
||||
<label>Newness <input type="number" id="a-recency" min="0" step="0.05" value="0.2"></label>
|
||||
<label>Companies you like <input type="number" id="a-affinity" min="0" step="0.05" value="0.2"></label>
|
||||
<label>Roles you liked <input type="number" id="a-taste" min="0" step="0.05" value="0.2"></label>
|
||||
</fieldset>
|
||||
<span class="hint">The final score, which orders What I'm looking for on Roles: the weighted sum of the four over the sum of the weights. Newness halves every 14 days; Roles you liked is a role's closeness to the roles you liked, away from those you passed. Changing the weights re-sorts and reads nothing.</span>
|
||||
<fieldset class="weights">
|
||||
<legend>How much each counts in the CV match</legend>
|
||||
<label>Skills <input type="number" id="a-cv-skills" min="0" step="5" value="30"></label>
|
||||
@@ -114,16 +111,18 @@
|
||||
</fieldset>
|
||||
<span class="hint">The judge's three numbers are averaged with these shares into the CV match. Changing them re-sorts at once and asks the model for nothing; 0 leaves a number out, all three 0 means no CV match.</span>
|
||||
<fieldset class="weights limits">
|
||||
<legend>What the model reads</legend>
|
||||
<label>Extract the best <input type="number" id="a-extract-top" min="0" step="10" value="500"></label>
|
||||
<label>down to a score of <input type="number" id="a-extract-min" min="0" max="1" step="0.05" value="0.55"></label>
|
||||
<label>Summarise the best <input type="number" id="a-summarise-top" min="0" step="5" value="30"></label>
|
||||
<label>down to a score of <input type="number" id="a-summarise-min" min="0" max="1" step="0.05" value="0.65"></label>
|
||||
<label>Judge against the CV the best <input type="number" id="a-judge-top" min="0" step="10" value="150"></label>
|
||||
<label>down to a score of <input type="number" id="a-judge-min" min="0" max="1" step="0.05" value="0.55"></label>
|
||||
<label>and the closest to the CV <input type="number" id="a-judge-cv-top" min="0" step="10" value="50"></label>
|
||||
<legend>The cut</legend>
|
||||
<label>Fit to the prompts: the best <input type="number" id="a-cut-fit-top" min="0" step="10" value="500"></label>
|
||||
<label>each at least <input type="number" id="a-cut-fit-min" min="0" max="1" step="0.05" value="0.6"></label>
|
||||
<label>Closeness to the CV: the best <input type="number" id="a-cut-cv-top" min="0" step="10" value="150"></label>
|
||||
<label>not already in, each at least <input type="number" id="a-cut-cv-min" min="0" max="1" step="0.05" value="0.6"></label>
|
||||
</fieldset>
|
||||
<span class="hint">Every pull scores every open role for free; these bound what the model then reads, per agent. The count is the backstop, the score the real stop. Fit is a level, the same in every run: a new role with the worst fit scores about 0.27, a perfect one about 0.87. Roles you saved or liked are summarised too, whatever their score. The judge also reads that many of the roles closest to the CV which the score leaves out, so a role the prompts rank low but the CV fits still gets read; closeness is a free local measure and no part of the score. An agent with no prompt feeds neither extract nor summarise, and one with no CV feeds not the judge.</span>
|
||||
<span class="hint">Of the roles that pass the fetch gate, the cut holds the best by fit and, of the rest, the best by closeness to the CV. Liked and saved roles are always in, whatever their levels. The cut gets fetch text, extract and judge, so it sets what the models read. Both are levels from 0 to 1, the same in every run and free to compute; a liked company adds about 0.05 to them and a favourite about 0.1. For a broad agent the count stops a list, for a narrow one the minimum does, so roles that do not fit are not read to fill the count. An agent with no prompt has no fit list, and one with no CV no closeness list.</span>
|
||||
<fieldset class="weights limits">
|
||||
<legend>After the ranking</legend>
|
||||
<label>Summarise the top <input type="number" id="a-summarise-top" min="0" step="5" value="50"></label>
|
||||
</fieldset>
|
||||
<span class="hint">Summarise writes a short summary and tags for the top of the feed by the final score, and for every role you liked or saved, whatever its score. It is no part of any score.</span>
|
||||
<details class="advanced">
|
||||
<summary>Advanced</summary>
|
||||
<div class="advanced-body">
|
||||
@@ -131,11 +130,11 @@
|
||||
<legend>Other rules</legend>
|
||||
<div id="a-rules" class="rule-rows"></div>
|
||||
<button type="button" id="a-add-rule" class="secondary">Add rule</button>
|
||||
<span class="hint">Must: a role must meet it. One of: a role must meet one of these or a Where line. Prefer: a role that meets it gains the weight. Values are separated by commas; salary is a number.</span>
|
||||
<span class="hint">Must: a role must meet it. One of: a role must meet one of these or a Place line. Not: a role that meets it is left out. Values are separated by commas; salary is a number.</span>
|
||||
</fieldset>
|
||||
<label>Rules as sent
|
||||
<textarea id="a-gates" class="code" rows="6" spellcheck="false" readonly>[]</textarea>
|
||||
<span class="hint">Read only: what Save sends as the agent's gates, from Where and Other rules.</span></label>
|
||||
<span class="hint">Read only: what Save sends as the agent's gates, from the fetch gate and Other rules.</span></label>
|
||||
</div>
|
||||
</details>
|
||||
<div class="agent-actions">
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
|
||||
<section class="card" id="company-boards" data-section>
|
||||
<h2>Company boards</h2>
|
||||
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored, and favourite or like lifts one instead, in Agent match.</p>
|
||||
<p class="lede">Every company roledesk has seen, and how many of its roles are open. Switching a board off stops reading it and closes its roles; hiding a company keeps reading it but leaves its roles out of the list and unscored. Like or favourite raises a company's roles a little in the cut and in the feed order, in each search agent's own ranking (a liked company about 0.05, a favourite about 0.1), and passes nothing the fetch gate rejects. All countries and All roles are for every agent: the first skips the place part of the fetch gate, the second the fetch terms and the titles to leave out.</p>
|
||||
|
||||
<form id="board-form" class="agent-form source-form" autocomplete="off">
|
||||
<h3>Follow a company</h3>
|
||||
@@ -174,12 +174,12 @@
|
||||
<h2>Runs</h2>
|
||||
<button type="button" id="pull-now" class="secondary">Run the pull now</button>
|
||||
</div>
|
||||
<p class="lede">On the schedule below the pull reads every board, embed and score rank every role, extract fills in what the best postings say, score runs again with what it filled, summarise writes the summaries, and judge scores the best roles against each search agent's CV.</p>
|
||||
<p class="lede">On the schedule below the pull reads every board and every search, embed and score rank every role and fix each agent's cut, fetch text reads the own page of the cut roles that came without text, extract fills in what the cut postings say, score runs again with what it filled, judge scores the cut against each search agent's CV, and summarise writes the summaries for the top of the feed.</p>
|
||||
|
||||
{# The three stages that ask a model, switched here rather than in config.yaml
|
||||
{# The stages with a switch, switched here rather than in config.yaml
|
||||
(`GET /api/stages`); jobs.js draws the rows into #stages-list. #}
|
||||
<h3 id="stages">What the model reads</h3>
|
||||
<p class="lede">Extract, summarise and judge ask a model, which costs tokens on the API. Turning one on starts nothing: the next pull runs it, and Run the pull now does so at once. How deep each reads is set per search agent, under <a href="/settings/agents">Search agents</a>.</p>
|
||||
<h3 id="stages">What the pull reads</h3>
|
||||
<p class="lede">Extract, summarise and judge ask a model, which costs tokens on the API; fetch text asks none. Turning one on starts nothing: the next pull runs it, and Run the pull now does so at once. How deep each reads is set per search agent, under <a href="/settings/agents">Search agents</a>: fetch text, extract and judge read the agent's cut, and summarise reads its own size.</p>
|
||||
<div id="stages-list" class="srows"></div>
|
||||
<p id="stages-answer" class="count" role="status"></p>
|
||||
|
||||
|
||||
+17
-5
@@ -966,12 +966,24 @@ def test_the_agents_page_lists_and_edits_search_agents(client: TestClient) -> No
|
||||
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
|
||||
# What the model reads after a pull: a count and a score floor per stage.
|
||||
assert "<legend>What the model reads</legend>" in template
|
||||
for limit in ("a-extract-top", "a-extract-min", "a-summarise-top", "a-summarise-min"):
|
||||
# The fetch gate in three parts, and no hybrid prefer control.
|
||||
assert "<legend>The fetch gate</legend>" in template
|
||||
for part in ("<h3>Region</h3>", "<h3>Place</h3>", "<h3>Role</h3>"):
|
||||
assert part in template
|
||||
for field in ("a-scope", "a-countries", "a-towns", "a-remote", "a-terms", "a-titles"):
|
||||
assert f'id="{field}"' in template
|
||||
assert "a-hybrid" not in page and "prefer" not in template.lower()
|
||||
# The cut, and summarise after the ranking: the keys of `Limits`.
|
||||
assert "<legend>The cut</legend>" in template and "<legend>After the ranking</legend>" in template
|
||||
for limit in ("a-cut-fit-top", "a-cut-fit-min", "a-cut-cv-top", "a-cut-cv-min", "a-summarise-top"):
|
||||
assert f'id="{limit}"' in template
|
||||
assert 'id="a-extract-top" min="0" step="10" value="500"' in page
|
||||
assert 'id="a-summarise-min" min="0" max="1" step="0.05" value="0.65"' in page
|
||||
assert 'id="a-cut-fit-top" min="0" step="10" value="500"' in page
|
||||
assert 'id="a-cut-fit-min" min="0" max="1" step="0.05" value="0.6"' in page
|
||||
assert 'id="a-cut-cv-top" min="0" step="10" value="150"' in page
|
||||
assert 'id="a-summarise-top" min="0" step="5" value="50"' in page
|
||||
for gone in ("a-extract-top", "a-extract-min", "a-summarise-min", "a-judge-top", "a-judge-min",
|
||||
"a-judge-cv-top"):
|
||||
assert f'id="{gone}"' not in page
|
||||
assert 'id="a-new"' in page and 'id="a-delete"' in page
|
||||
assert "Save and score" in page
|
||||
|
||||
|
||||
Reference in new issue
Block a user