L9 Lotse – KI-Assistent: Transkription, Berichtsentwurf, Vollständigkeitsprüfung, Freigabeprinzip (Services)

- OpenAI-kompatible Transkription + Processor transcription (done/failed/disabled, AiGeneration, Notiz aus Sprachnotiz)
- Claude-Lotse (strukturierte Ausgabe, Refusal/Fallback), Datenminimierung, Vorschläge in content.lotse
- Vollständigkeitsprüfung (Regeln + KI-Hinweise mit Deep-Link), Einstellungen, KI-Protokoll
- Freigabeprinzip: Submit eines Lotse-Entwurfs nur mit Prüfbestätigung (serverseitig)
- Migration lotse_address_form (TenantSettings)

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-14 17:19:38 +02:00
co-authored by Claude Opus 5
parent d5c1221ab5
commit ff5c57f276
39 changed files with 1815 additions and 7 deletions
+25
View File
@@ -0,0 +1,25 @@
import { ZodError } from "zod";
import { LOTSE_ERROR_CODES, type LotseActionErrorCode, type LotseActionState } from "@/lib/lotse/action-state";
import { ServiceError } from "@/server/services/context";
import { ForbiddenError } from "@/server/rbac";
import { ModuleDisabledError } from "@/server/modules";
/** Map thrown errors of Lotse actions to a displayable state (plain-language message key, no internals). */
export function lotseErrorState(err: unknown): LotseActionState {
const at = Date.now();
if (err instanceof ServiceError) {
const reason = (err.details as { reason?: string } | undefined)?.reason;
const code = reason && (LOTSE_ERROR_CODES as readonly string[]).includes(reason) ? (reason as LotseActionErrorCode) : err.code === "blocked" ? "not_editable" : err.code;
return { status: "error", code, at };
}
if (err instanceof ModuleDisabledError) return { status: "error", code: "disabled", at };
if (err instanceof ZodError) return { status: "error", code: "invalid", at };
if (err instanceof ForbiddenError) return { status: "error", code: "forbidden", at };
console.error("[actions/lotse]", err);
return { status: "error", code: "generic", at };
}
export const str = (fd: FormData, key: string): string | undefined => {
const v = fd.get(key);
return typeof v === "string" ? v : undefined;
};