feat: review text hits and release false-positive mappings

This commit is contained in:
muena
2026-10-19 06:44:21 +02:00
parent ebf78128c4
commit 03a793ad7c
20 changed files with 536 additions and 210 deletions

View File

@@ -21,7 +21,8 @@ import {
import { PseudonymizationConfirm } from "./ai-views";
import { getSelectedTextSafely } from "./selection";
import { ContextPicker, type ContextFormValues } from "./context-picker";
import { pseudonymizeInContext } from "./text-context";
import { prepareTextInContext } from "./text-context";
import { TextHitReview } from "./text-hit-review";
import {
getActiveSessionId,
listSessions,
@@ -184,46 +185,45 @@ export default function Command() {
});
try {
const { result: pseudoResult, session: updatedSession } =
await pseudonymizeInContext(values, input, values.entityTypes, true);
const prepared = await prepareTextInContext(values, input, values.entityTypes);
toast.style = Toast.Style.Success;
toast.title = "Pseudonymisiert";
toast.message = `${pseudoResult.entity_count} Zuordnungen`;
toast.title = "Treffer zur Prüfung bereit";
toast.message = `${prepared.raw.spans.length} Treffer prüfen`;
push(<TextHitReview prepared={prepared} forAi onConfirmed={async (pseudoResult, updatedSession) => {
const schema = values.schema;
const format = values.format;
const buildPrompt = (pseudonymizedText: string, instructions: string) =>
buildStructuredDataPrompt({
pseudonymizedText,
instructions,
schema,
format,
});
const schema = values.schema;
const format = values.format;
const buildPrompt = (pseudonymizedText: string, instructions: string) =>
buildStructuredDataPrompt({
pseudonymizedText,
instructions,
schema,
format,
});
push(
<PseudonymizationConfirm
session={updatedSession}
pseudonymizedText={pseudoResult.pseudonymized_text}
model={values.model}
creativity={values.creativity}
instructions={values.instructions}
buildPrompt={buildPrompt}
labels={{
pageHeading:
format === "json" ? "Strukturierte Daten (JSON)" : "Tabelle",
runningLabel:
format === "json"
? "KI extrahiert Daten (JSON) …"
: "KI extrahiert Tabelle …",
failureTitle: "Extraktion fehlgeschlagen",
copyTitle:
format === "json" ? "JSON kopieren" : "Markdown-Tabelle kopieren",
pasteTitle:
format === "json" ? "JSON einfügen" : "Tabelle einfügen",
}}
/>,
);
push(
<PseudonymizationConfirm
session={updatedSession}
pseudonymizedText={pseudoResult.pseudonymized_text}
model={values.model}
creativity={values.creativity}
instructions={values.instructions}
buildPrompt={buildPrompt}
labels={{
pageHeading:
format === "json" ? "Strukturierte Daten (JSON)" : "Tabelle",
runningLabel:
format === "json"
? "KI extrahiert Daten (JSON) …"
: "KI extrahiert Tabelle …",
failureTitle: "Extraktion fehlgeschlagen",
copyTitle:
format === "json" ? "JSON kopieren" : "Markdown-Tabelle kopieren",
pasteTitle:
format === "json" ? "JSON einfügen" : "Tabelle einfügen",
}}
/>,
);
}} />);
} catch (error) {
toast.style = Toast.Style.Failure;
toast.title = "Pseudonymisierung fehlgeschlagen";