Deep Research v2: exclude marketing site, deep-link sources, per-agent reports

Three user-flagged issues after the first real run with a 920KB sakkyndig PDF:

1. dobetternorge.no marketing-website chunks leaked into the retrieval pool.
   ClientRagPipeline::searchAll defaults include_beta_website=true; we now
   pass false for both website flags, AND defensively drop any returned
   chunk whose source_name contains "website" or title contains
   "dobetternorge.no" before it can pollute synthesis.

2. Brief returned was "just a paragraph". Bumped synthesis max_tokens
   2200→3200, raised timeout 120→180s, and rewrote the prompt to require
   400-900 words with min 4 paragraphs when source_count>=3, covering EACH
   sub-question in its own paragraph. Now also passes authority + jurisdiction
   into the sources block so the model can pinpoint statutes correctly.

3. No way to see what each "sub-question agent" researched or click through
   to the source articles. Restructured the results panel so per-sub-question
   report cards now render ABOVE the synthesised brief. Each report shows the
   question, the rationale, and the top 3 retrieved sources for that sub-Q
   with title→deep link + 1-line excerpt. Brief follows. Consolidated
   numbered sources list at the bottom, with titles as deep links too.

Deep-link construction: source_url is hydrated via dbnV6QueryDocumentMeta
in a single batched call after retrieval. For Lovdata sources with a
section_title containing §<n>, the link is path-anchored to that section
(/§43). For other hosts (HUDOC, Regjeringen, Bufdir, etc.) we link to the
document root URL.

Telemetry: trace_metadata now carries retrieval_counts {raw_corpus,
filtered_website, post_filter_corpus, raw_upload, after_dedupe, after_topk}
so future regressions are diagnosable from the metadata.jsonl log alone.
The completion status pill surfaces the corpus/website/upload split.
This commit is contained in:
2026-05-15 11:12:13 +02:00
parent a1a7f442a7
commit e130db8119
3 changed files with 351 additions and 39 deletions
+124
View File
@@ -2176,3 +2176,127 @@ p {
.dr-source-card { grid-template-columns: 32px 1fr; }
.dr-source-aside { display: none; }
}
/* Per-sub-question agent report cards (v2) */
.dr-subq-list {
display: grid;
gap: 10px;
}
.dr-subq-report {
border: 1px solid var(--line);
border-radius: 8px;
padding: 12px 13px;
background: #fbfcfe;
}
.dr-subq-report__head {
display: grid;
grid-template-columns: auto 1fr;
gap: 10px;
align-items: start;
margin-bottom: 10px;
}
.dr-subq-report__index {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 30px;
height: 24px;
padding: 0 8px;
border-radius: 999px;
background: var(--soft-teal);
color: var(--teal-dark);
font-weight: 800;
font-variant-numeric: tabular-nums;
font-size: 0.78rem;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.dr-subq-report__question {
font-weight: 700;
color: var(--ink);
line-height: 1.4;
}
.dr-subq-report__rationale {
margin-top: 4px;
color: var(--muted);
font-size: 0.86rem;
line-height: 1.45;
}
.dr-mini-source-list {
list-style: none;
padding: 0;
margin: 0;
display: grid;
gap: 6px;
}
.dr-mini-source {
display: grid;
grid-template-columns: 32px 1fr;
gap: 8px;
align-items: start;
padding: 8px 10px;
background: #fff;
border: 1px solid var(--line);
border-radius: 6px;
}
.dr-mini-source--empty {
display: block;
color: var(--muted);
padding: 8px 10px;
}
.dr-mini-source__n {
font-variant-numeric: tabular-nums;
color: var(--coral);
font-weight: 800;
font-size: 0.85rem;
}
.dr-mini-source__title {
display: inline-block;
font-weight: 700;
color: var(--ink);
text-decoration: none;
line-height: 1.35;
}
a.dr-mini-source__title:hover { color: var(--teal-dark); text-decoration: underline; }
.dr-mini-source__meta {
color: var(--muted);
font-size: 0.78rem;
margin-top: 3px;
}
.dr-mini-source__excerpt {
color: var(--muted);
font-size: 0.86rem;
line-height: 1.45;
margin-top: 5px;
}
.dr-external-link {
display: inline-block;
color: var(--teal);
font-size: 0.8em;
margin-left: 3px;
vertical-align: 1px;
}
a.dr-source-title-link {
color: var(--ink);
text-decoration: none;
}
a.dr-source-title-link:hover {
color: var(--teal-dark);
text-decoration: underline;
}