czat: P3 do modelu tylko pytane okno, bez rodzeństwa z tej samej rodziny
Rekord, którego grupę list pytanie nazywa, wycina ze źródeł rekordy tej samej rodziny klucza z grupami, których pytanie nie nazywa (30/60/90 dni). Dziennik aktywności tylko przy pytaniu o aktywność wymaga rozpoznania brzmienia pytania: zostaje na P11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016uwxqFNnaMueKrFn1ogB8u
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8a0c6bda29
commit
63f64d06b7
@@ -139,3 +139,13 @@ def test_p2_overdue_items_head_the_urgent_list_also_this_week() -> None:
|
||||
assert [r[3] for r in got["rows"]][:3] == ["2026-11-07", "2026-11-10", "2026-11-11"] # oldest first
|
||||
assert "Poza tym" not in got["text"]
|
||||
assert "krótko" in got["hint"] and "1-4 zdania" not in got["hint"]
|
||||
|
||||
|
||||
def test_p3_only_the_window_asked_about_goes_to_the_model() -> None:
|
||||
# Given the 30-, 60- and 90-day windows at once for "w ciągu 60 dni", both models answered from the wrong
|
||||
# one (q-60-dni, 14 of 16, 9.11).
|
||||
got = _run("""const s = session(['W ciągu 60 dni kończą się 2 umowy [1].']);
|
||||
const a = await s.ask('Które umowy wygasają w ciągu najbliższych 60 dni?');
|
||||
return a.refs.map((r) => r.key);""")
|
||||
assert "compass:wygasajace:60" in got
|
||||
assert "compass:wygasajace:30" not in got and "compass:wygasajace:90" not in got
|
||||
|
||||
+11
-2
@@ -3850,11 +3850,20 @@ async function chatTurn({ model, question, turns, index, answer = { role: 'assis
|
||||
const pick = review.length || law.length || topic.length || named.length || resolved.length || back.length || card ? null : chatPick(question, index);
|
||||
if (pick && !pick.table.rows.length) return done(pick.empty, { coded: 'pick', refs: [], verify: [] });
|
||||
// The entity's card right after law and topic; a one-record link card behind its record, so [1] stays the record.
|
||||
const sources = [...(pick ? [pick.rec] : []), ...review, ...law, ...topic, ...lawGraph.near,
|
||||
const pool = [...(pick ? [pick.rec] : []), ...review, ...law, ...topic, ...lawGraph.near,
|
||||
...(card && card.rec.kind === 'karta' ? [card.rec] : []), ...named, ...resolved,
|
||||
...(card && card.rec.kind !== 'karta' ? [card.rec] : []), ...backSum, ...back, ...clauses, ...lawGraph.clauses, ...chatCarry(prev, index),
|
||||
...(card ? card.lead : []), ...found]
|
||||
.filter((r) => !seen.has(r.key) && seen.add(r.key)).slice(0, CHAT_TOP + law.length + review.length + topic.length + clauses.length + lawGraph.near.length + lawGraph.clauses.length);
|
||||
.filter((r) => !seen.has(r.key) && seen.add(r.key));
|
||||
// The group the question names, without its siblings: given the 30-, 60- and 90-day windows at once for "w
|
||||
// ciągu 60 dni", both models answered from the wrong one (q-60-dni, 14 of 16, 9.11). A record whose `list`
|
||||
// group the question names drops the records of its family (its key up to the last ":") that have groups the
|
||||
// question does not name; which family it is, code does not need to know.
|
||||
const fam = (r) => r.key.slice(0, r.key.lastIndexOf(':'));
|
||||
const listHit = (r) => (r.list || []).some((g) => g.re && g.re.test(question));
|
||||
const hitFams = new Set(pool.filter(listHit).map(fam));
|
||||
const sources = pool.filter((r) => !(r.list && hitFams.has(fam(r))) || listHit(r))
|
||||
.slice(0, CHAT_TOP + law.length + review.length + topic.length + clauses.length + lawGraph.near.length + lawGraph.clauses.length);
|
||||
const name = (slug) => (chatModules().find((m) => m.slug === slug) || { name: slug }).name;
|
||||
const toRef = (r, i) => ({ n: i + 1, key: r.key, kind: r.kind, slug: r.slug, module: name(r.slug), title: r.title, text: r.text,
|
||||
data: !['przepis', 'akt', 'orzeczenie'].includes(r.kind), inner: r.inner, url: r.url });
|
||||
|
||||
Reference in New Issue
Block a user