feat: KI-Agent toggle button in Dokumenten-Pruefung
Build + Deploy / build-admin-compliance (push) Successful in 3m15s
Build + Deploy / build-backend-compliance (push) Successful in 3m43s
Build + Deploy / build-ai-sdk (push) Failing after 49s
Build + Deploy / build-developer-portal (push) Successful in 1m26s
Build + Deploy / build-tts (push) Successful in 1m49s
Build + Deploy / build-document-crawler (push) Successful in 46s
Build + Deploy / build-dsms-gateway (push) Successful in 33s
Build + Deploy / build-dsms-node (push) Successful in 22s
CI / branch-name (push) Has been skipped
Build + Deploy / trigger-orca (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 22s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 3m1s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Failing after 58s
CI / test-python-backend (push) Successful in 47s
CI / test-python-document-crawler (push) Successful in 28s
CI / test-python-dsms-gateway (push) Successful in 28s
CI / validate-canonical-controls (push) Successful in 16s
Build + Deploy / build-admin-compliance (push) Successful in 3m15s
Build + Deploy / build-backend-compliance (push) Successful in 3m43s
Build + Deploy / build-ai-sdk (push) Failing after 49s
Build + Deploy / build-developer-portal (push) Successful in 1m26s
Build + Deploy / build-tts (push) Successful in 1m49s
Build + Deploy / build-document-crawler (push) Successful in 46s
Build + Deploy / build-dsms-gateway (push) Successful in 33s
Build + Deploy / build-dsms-node (push) Successful in 22s
CI / branch-name (push) Has been skipped
Build + Deploy / trigger-orca (push) Has been skipped
CI / guardrail-integrity (push) Has been skipped
CI / loc-budget (push) Failing after 22s
CI / secret-scan (push) Has been skipped
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / nodejs-build (push) Successful in 3m1s
CI / dep-audit (push) Has been skipped
CI / sbom-scan (push) Has been skipped
CI / test-go (push) Failing after 58s
CI / test-python-backend (push) Successful in 47s
CI / test-python-document-crawler (push) Successful in 28s
CI / test-python-dsms-gateway (push) Successful in 28s
CI / validate-canonical-controls (push) Successful in 16s
Green pill button: 'KI-Agent aus' / 'KI-Agent aktiv (1.874 MCs)' Toggles use_agent flag which is passed through the full chain: Frontend → DocCheckRequest → _run_doc_check → _check_single_document → check_document_with_controls(use_agent=True) → ComplianceAgent with tool calling Default: OFF (deterministic regex). User can enable per scan. Also works via env var COMPLIANCE_USE_AGENT=true for always-on. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ export function DocCheckTab() {
|
||||
try { const s = localStorage.getItem('doc-check-entries'); return s ? JSON.parse(s) : [newEntry()] } catch { return [newEntry()] }
|
||||
})
|
||||
const [checkCookieBanner, setCheckCookieBanner] = useState(false)
|
||||
const [useAgent, setUseAgent] = useState(false)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [progress, setProgress] = useState('')
|
||||
const [results, setResults] = useState<any>(() => {
|
||||
@@ -92,6 +93,7 @@ export function DocCheckTab() {
|
||||
url: e.url.trim(),
|
||||
})),
|
||||
check_cookie_banner: checkCookieBanner,
|
||||
use_agent: useAgent,
|
||||
}),
|
||||
})
|
||||
if (!startRes.ok) throw new Error(`Pruefung konnte nicht gestartet werden: ${startRes.status}`)
|
||||
@@ -192,6 +194,19 @@ export function DocCheckTab() {
|
||||
/>
|
||||
Cookie-Banner pruefen
|
||||
</label>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setUseAgent(!useAgent)}
|
||||
className={`flex items-center gap-2 px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${
|
||||
useAgent
|
||||
? 'bg-emerald-100 border-emerald-300 text-emerald-800'
|
||||
: 'bg-gray-50 border-gray-200 text-gray-500 hover:bg-gray-100'
|
||||
}`}
|
||||
>
|
||||
<span className={`w-2 h-2 rounded-full ${useAgent ? 'bg-emerald-500' : 'bg-gray-300'}`} />
|
||||
{useAgent ? 'KI-Agent aktiv (1.874 MCs)' : 'KI-Agent aus'}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Submit */}
|
||||
|
||||
@@ -40,6 +40,7 @@ class DocCheckRequest(BaseModel):
|
||||
entries: list[DocCheckEntry]
|
||||
recipient: str = "dsb@breakpilot.local"
|
||||
check_cookie_banner: bool = False
|
||||
use_agent: bool = False
|
||||
|
||||
|
||||
class CheckItem(BaseModel):
|
||||
@@ -193,7 +194,7 @@ async def _run_doc_check(check_id: str, req: DocCheckRequest):
|
||||
f"Dokument {i+1}/{len(req.entries)}: {entry.label}..."
|
||||
)
|
||||
|
||||
doc_results = await _check_single_document(entry)
|
||||
doc_results = await _check_single_document(entry, use_agent=req.use_agent)
|
||||
results.extend(doc_results)
|
||||
total_findings += sum(r.findings_count for r in doc_results)
|
||||
|
||||
@@ -231,7 +232,7 @@ async def _run_doc_check(check_id: str, req: DocCheckRequest):
|
||||
_doc_check_jobs[check_id]["error"] = str(e)[:500]
|
||||
|
||||
|
||||
async def _check_single_document(entry: DocCheckEntry) -> list[DocCheckResult]:
|
||||
async def _check_single_document(entry: DocCheckEntry, use_agent: bool = False) -> list[DocCheckResult]:
|
||||
"""Load a single URL, expand content, extract text, split into sections,
|
||||
and check each section against its type-specific checklist.
|
||||
|
||||
@@ -287,10 +288,10 @@ async def _check_single_document(entry: DocCheckEntry) -> list[DocCheckResult]:
|
||||
# binary pass/fail criteria verified by LLM (Qwen)
|
||||
try:
|
||||
from compliance.services.rag_document_checker import check_document_with_controls
|
||||
use_agent = os.getenv("COMPLIANCE_USE_AGENT", "false").lower() == "true"
|
||||
use_agent_flag = use_agent or os.getenv("COMPLIANCE_USE_AGENT", "false").lower() == "true"
|
||||
mc_results = await check_document_with_controls(
|
||||
doc_text, entry.doc_type, entry.label,
|
||||
max_controls=0, use_agent=use_agent,
|
||||
max_controls=0, use_agent=use_agent_flag,
|
||||
)
|
||||
if mc_results:
|
||||
# Add MC results as additional checks to the main result
|
||||
|
||||
Reference in New Issue
Block a user