Interaktiver 12-Fragen-Entscheidungsbaum für die AI Act Klassifikation auf zwei Achsen: High-Risk (Anhang III, Q1-Q7) und GPAI (Art. 51-56, Q8-Q12). Deterministische Auswertung ohne LLM. Backend (Go): - Neue Structs: GPAIClassification, DecisionTreeAnswer, DecisionTreeResult - Decision Tree Engine mit BuildDecisionTreeDefinition() und EvaluateDecisionTree() - Store-Methoden für CRUD der Ergebnisse - API-Endpoints: GET/POST /decision-tree, GET/DELETE /decision-tree/results - 12 Unit Tests (alle bestanden) Frontend (Next.js): - DecisionTreeWizard: Wizard-UI mit Ja/Nein-Fragen, Dual-Progress-Bar, Ergebnis-Ansicht - AI Act Page refactored: Tabs (Übersicht | Entscheidungsbaum | Ergebnisse) - Proxy-Route für decision-tree Endpoints Migration 083: ai_act_decision_tree_results Tabelle Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
const SDK_URL = process.env.SDK_URL || 'http://ai-compliance-sdk:8090'
|
|
const DEFAULT_TENANT = process.env.DEFAULT_TENANT_ID || '9282a473-5c95-4b3a-bf78-0ecc0ec71d3e'
|
|
|
|
/**
|
|
* Proxy: GET /api/sdk/v1/ucca/decision-tree → Go Backend GET /sdk/v1/ucca/decision-tree
|
|
* Returns the decision tree definition (questions, structure)
|
|
*/
|
|
export async function GET(request: NextRequest) {
|
|
const tenantID = request.headers.get('X-Tenant-ID') || DEFAULT_TENANT
|
|
|
|
try {
|
|
const response = await fetch(`${SDK_URL}/sdk/v1/ucca/decision-tree`, {
|
|
headers: { 'X-Tenant-ID': tenantID },
|
|
})
|
|
|
|
if (!response.ok) {
|
|
const errorText = await response.text()
|
|
console.error('Decision tree GET error:', errorText)
|
|
return NextResponse.json(
|
|
{ error: 'Backend error', details: errorText },
|
|
{ status: response.status }
|
|
)
|
|
}
|
|
|
|
const data = await response.json()
|
|
return NextResponse.json(data)
|
|
} catch (error) {
|
|
console.error('Decision tree proxy error:', error)
|
|
return NextResponse.json(
|
|
{ error: 'Failed to connect to AI compliance backend' },
|
|
{ status: 503 }
|
|
)
|
|
}
|
|
}
|