'use client' import { useState } from 'react' import { useRouter } from 'next/navigation' import { DATASHEET_EXAMPLES } from './readiness-presets' interface Followup { key: string; label: string; question: string } interface ExtractResult { limits: Record provenance: Record detected: { interfaces: string[]; units: string[] } llm_status?: string filled: string[] missing: string[] followup: Followup[] } const FIELD_LABEL: Record = { machine_designation: 'Maschinenbezeichnung', machine_type: 'Maschinentyp', manufacturer: 'Hersteller', year_of_construction: 'Baujahr', general_description: 'Allgemeine Beschreibung', intended_purpose: 'Verwendungszweck', area_of_use: 'Einsatzbereich', operating_modes: 'Betriebsarten', variants: 'Varianten', foreseeable_misuses: 'Vorhersehbare Fehlanwendungen', spatial_limits: 'Räumliche Grenzen', temporal_limits: 'Zeitliche Grenzen', operating_conditions: 'Betriebsbedingungen', energy_supply: 'Energieversorgung', mechanical_interfaces: 'Mechanische Schnittstellen', electrical_interfaces: 'Elektrische Schnittstellen', software_interfaces: 'Software-Schnittstellen', pneumatic_hydraulic_interfaces: 'Pneumatik/Hydraulik', person_groups: 'Personengruppen', qualification_requirements: 'Qualifikationsanforderungen', } export function DatasheetExtract() { const router = useRouter() const [text, setText] = useState('') const [res, setRes] = useState(null) const [loading, setLoading] = useState(false) const [creating, setCreating] = useState(false) const [answers, setAnswers] = useState>({}) const run = async () => { setLoading(true) try { const r = await fetch('/api/v1/cra/extract-datasheet', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text }), }) setRes(r.ok ? await r.json() : null) setAnswers({}) } finally { setLoading(false) } } // Create an IACE project from the extracted limits + follow-up answers. The // limits land as the project's editable limits_form; the interview form stays // fully editable (every prefilled field can be changed). Manual creation via // /sdk/iace remains unchanged. const createProject = async () => { if (!res) return setCreating(true) try { const nonEmptyAnswers = Object.fromEntries( Object.entries(answers).filter(([, v]) => (v || '').trim()), ) const limits = { ...res.limits, ...nonEmptyAnswers } const machineName = limits.machine_designation || limits.machine_type || 'Neues Produkt' const cr = await fetch('/api/sdk/v1/iace/projects', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ machine_name: machineName, machine_type: limits.machine_type || 'Nicht angegeben', manufacturer: limits.manufacturer || 'Nicht angegeben', }), }) if (!cr.ok) return const proj = await cr.json() const pid = proj.id || proj.project_id if (!pid) return await fetch(`/api/sdk/v1/iace/projects/${pid}`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ metadata: { limits_form: limits } }), }) router.push(`/sdk/iace/${pid}/interview`) } finally { setCreating(false) } } return (

Datenblatt-Analyse → Maschinengrenzen

Datenblatt einfügen — wir füllen die ISO-12100-Grenzen automatisch (lokales KI-Modell, Datenhoheit) und fragen gezielt nach, was nicht im Datenblatt steht. Jeder übernommene Wert trägt seine Quelle.

Beispiel laden: {DATASHEET_EXAMPLES.map((d) => ( ))}