Apply learned mask reviews by local cue and highlight the reviewed mention.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3f7c0d71a5
commit
f7ffd28332
10 files changed
+413
-36
No files matched your search
@@ -1,3 +1,28 @@
|
||||
function HighlightedExcerpt({ excerpt, highlightStart, highlightEnd, label }) {
|
||||
if (!excerpt) return null
|
||||
const start = Number(highlightStart)
|
||||
const end = Number(highlightEnd)
|
||||
if (Number.isInteger(start) && Number.isInteger(end) && start >= 0 && end <= excerpt.length && end > start) {
|
||||
return (
|
||||
<p className="mask-excerpt">
|
||||
{excerpt.slice(0, start)}
|
||||
<mark>{excerpt.slice(start, end)}</mark>
|
||||
{excerpt.slice(end)}
|
||||
</p>
|
||||
)
|
||||
}
|
||||
const needle = label || ''
|
||||
const at = needle ? excerpt.toLowerCase().indexOf(needle.toLowerCase()) : -1
|
||||
if (at < 0) return <p className="mask-excerpt">{excerpt}</p>
|
||||
return (
|
||||
<p className="mask-excerpt">
|
||||
{excerpt.slice(0, at)}
|
||||
<mark>{excerpt.slice(at, at + needle.length)}</mark>
|
||||
{excerpt.slice(at + needle.length)}
|
||||
</p>
|
||||
)
|
||||
}
|
||||
|
||||
export default function MaskReviewPanel({ review, busy, onSubmit }) {
|
||||
if (!review?.candidates?.length) return null
|
||||
return (
|
||||
@@ -7,7 +32,7 @@ export default function MaskReviewPanel({ review, busy, onSubmit }) {
|
||||
<div>
|
||||
<h2 id="mask-review-title">Maskierung prüfen</h2>
|
||||
<p className="runlog-status">
|
||||
Lernmodus: nur diese Nennung. Bestätigen legt die Bezeichnung lokal ab.
|
||||
Lernmodus: nur die gelb markierte Nennung. Bestätigen legt die Bezeichnung lokal ab.
|
||||
„Nicht schützenswert“ verhindert die Maskierung. Beides bei demselben Wort markiert es als mehrdeutig.
|
||||
</p>
|
||||
</div>
|
||||
@@ -30,7 +55,12 @@ export default function MaskReviewPanel({ review, busy, onSubmit }) {
|
||||
<div>
|
||||
<strong>{item.text}</strong>
|
||||
<span className="muted"> · {item.entity_type}{item.ambiguous ? ' · mehrdeutig' : ''}</span>
|
||||
{item.excerpt && <p className="muted">{item.excerpt}</p>}
|
||||
<HighlightedExcerpt
|
||||
excerpt={item.excerpt}
|
||||
highlightStart={item.highlight_start}
|
||||
highlightEnd={item.highlight_end}
|
||||
label={item.text}
|
||||
/>
|
||||
</div>
|
||||
<fieldset className="row-actions">
|
||||
<label className="check">
|
||||
|
||||
Reference in new issue
Block a user