feat: Rechtliche-Texte-Module auf 100% — Dead Code, RAG-Fallback, Fehler-UI
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 33s
CI / test-python-backend-compliance (push) Successful in 35s
CI / test-python-document-crawler (push) Successful in 24s
CI / test-python-dsms-gateway (push) Successful in 18s
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 33s
CI / test-python-backend-compliance (push) Successful in 35s
CI / test-python-document-crawler (push) Successful in 24s
CI / test-python-dsms-gateway (push) Successful in 18s
Paket A: - einwilligungen/page.tsx: mockRecords (80 Zeilen toter Code) entfernt - consent/page.tsx: RAG-Suggest-Button im Create-Dialog (+handleRagSuggest) - workflow/page.tsx: uploadError State + rotes Fehler-Banner statt alert() Paket B: - cookie-banner/page.tsx: mockCategories → DEFAULT_COOKIE_CATEGORIES (Bug-Fix) DB-Kategorien haben jetzt immer Vorrang — kein Mock-Überschreiben mehr - test_einwilligungen_routes.py: +4 TestCookieBannerEmbedCode-Tests (36 gesamt) Paket C: - searchTemplates.ts: neue Hilfsdatei mit zwei-stufiger Suche 1. KLAUSUR_SERVICE (5s Timeout), 2. RAG-Fallback via ai-compliance-sdk - document-generator/page.tsx: ServiceMode State + UI-Badges (rag-only/offline) - searchTemplates.test.ts: 3 Vitest-Tests (KLAUSUR ok / RAG-Fallback / offline) flow-data.ts: alle 5 Rechtliche-Texte-Module auf completion: 100 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -193,7 +193,7 @@ export default function ConsentPage() {
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [filter, setFilter] = useState<string>('all')
|
||||
const [showCreateModal, setShowCreateModal] = useState(false)
|
||||
const [newDocForm, setNewDocForm] = useState({ type: 'privacy_policy', name: '', description: '' })
|
||||
const [newDocForm, setNewDocForm] = useState({ type: 'privacy_policy', name: '', description: '', content: '' })
|
||||
const [creating, setCreating] = useState(false)
|
||||
const [previewDoc, setPreviewDoc] = useState<{ name: string; content: string } | null>(null)
|
||||
|
||||
@@ -223,6 +223,22 @@ export default function ConsentPage() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleRagSuggest() {
|
||||
const docType = newDocForm.type || newDocForm.name || 'Datenschutzerklärung'
|
||||
try {
|
||||
const res = await fetch('/api/sdk/v1/rag/search', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ query: `${docType} DSGVO Vorlage`, limit: 1 }),
|
||||
})
|
||||
if (res.ok) {
|
||||
const data = await res.json()
|
||||
const first = data.results?.[0]
|
||||
if (first?.text) setNewDocForm(d => ({ ...d, content: first.text }))
|
||||
}
|
||||
} catch { /* silently ignore */ }
|
||||
}
|
||||
|
||||
async function handleCreateDocument() {
|
||||
if (!newDocForm.name.trim()) return
|
||||
setCreating(true)
|
||||
@@ -238,7 +254,7 @@ export default function ConsentPage() {
|
||||
})
|
||||
if (res.ok) {
|
||||
setShowCreateModal(false)
|
||||
setNewDocForm({ type: 'privacy_policy', name: '', description: '' })
|
||||
setNewDocForm({ type: 'privacy_policy', name: '', description: '', content: '' })
|
||||
await loadDocuments()
|
||||
} else {
|
||||
setError('Fehler beim Erstellen des Dokuments')
|
||||
@@ -510,6 +526,25 @@ export default function ConsentPage() {
|
||||
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<div className="flex justify-between items-center mb-1">
|
||||
<label className="text-sm font-medium text-gray-700">Inhalt (optional)</label>
|
||||
<button
|
||||
type="button"
|
||||
onClick={handleRagSuggest}
|
||||
className="text-xs text-blue-600 hover:underline"
|
||||
>
|
||||
Aus RAG-Vorlagen laden →
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
rows={4}
|
||||
value={newDocForm.content}
|
||||
onChange={(e) => setNewDocForm({ ...newDocForm, content: e.target.value })}
|
||||
placeholder="Dokumentinhalt oder über RAG-Vorlagen laden..."
|
||||
className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-purple-500"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="px-6 py-4 border-t border-gray-200 flex justify-end gap-3">
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user