feat: Phase 3 — RAG-Anbindung fuer alle 18 Dokumenttypen + Vendor Contract Review
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 34s
CI / test-python-backend-compliance (push) Successful in 26s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
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 34s
CI / test-python-backend-compliance (push) Successful in 26s
CI / test-python-document-crawler (push) Successful in 21s
CI / test-python-dsms-gateway (push) Successful in 17s
Migrate queryRAG from klausur-service GET to bp-core-rag-service POST with multi-collection support. Each of the 18 ScopeDocumentType now gets a type-specific RAG collection and optimized search query instead of the generic fallback. Vendor-compliance contract review now uses LLM + RAG for real analysis with mock fallback on error. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import { terminologyToPromptString, styleContractToPromptString } from '@/lib/sd
|
||||
import { executeRepairLoop, type ProseBlockOutput, type RepairAudit } from '@/lib/sdk/drafting-engine/prose-validator'
|
||||
import { ProseCacheManager, computeChecksumSync, type CacheKeyParams } from '@/lib/sdk/drafting-engine/cache'
|
||||
import { queryRAG } from '@/lib/sdk/drafting-engine/rag-query'
|
||||
import { DOCUMENT_RAG_CONFIG } from '@/lib/sdk/drafting-engine/rag-config'
|
||||
|
||||
// ============================================================================
|
||||
// Shared State
|
||||
@@ -104,11 +105,9 @@ async function handleV1Draft(body: Record<string, unknown>): Promise<NextRespons
|
||||
}, { status: 403 })
|
||||
}
|
||||
|
||||
// RAG: Fetch relevant legal context
|
||||
const ragQuery = documentType === 'dsfa'
|
||||
? 'Datenschutz-Folgenabschaetzung Art. 35 DSGVO Risikobewertung'
|
||||
: `${documentType} DSGVO Compliance Anforderungen`
|
||||
const ragContext = await queryRAG(ragQuery)
|
||||
// RAG: Fetch relevant legal context (config-based)
|
||||
const ragCfg = DOCUMENT_RAG_CONFIG[documentType]
|
||||
const ragContext = await queryRAG(ragCfg.query, 3, ragCfg.collection)
|
||||
|
||||
let v1SystemPrompt = V1_SYSTEM_PROMPT
|
||||
if (ragContext) {
|
||||
@@ -380,11 +379,9 @@ async function handleV2Draft(body: Record<string, unknown>): Promise<NextRespons
|
||||
// Compute prompt hash for audit
|
||||
const promptHash = computeChecksumSync({ factsString, tagsString, termsString, styleString, disallowedString })
|
||||
|
||||
// Step 5b: RAG Legal Context
|
||||
const v2RagQuery = documentType === 'dsfa'
|
||||
? 'DSFA Art. 35 DSGVO Risikobewertung Massnahmen Datenschutz-Folgenabschaetzung'
|
||||
: `${documentType} DSGVO Compliance`
|
||||
const v2RagContext = await queryRAG(v2RagQuery)
|
||||
// Step 5b: RAG Legal Context (config-based)
|
||||
const v2RagCfg = DOCUMENT_RAG_CONFIG[documentType]
|
||||
const v2RagContext = await queryRAG(v2RagCfg.query, 3, v2RagCfg.collection)
|
||||
|
||||
// Step 6: Generate Prose Blocks (with cache + repair loop)
|
||||
const proseBlocks = DOCUMENT_PROSE_BLOCKS[documentType] || DOCUMENT_PROSE_BLOCKS.tom
|
||||
|
||||
Reference in New Issue
Block a user