fix: Struktureller Fix — Maschinentyp-Filter fuer Keywords + Patterns
PROBLEM: Cobot-Projekt hatte 52 Pressen-Hazards weil Keywords wie "stempel" und "stoessel" ohne Maschinentyp-Kontext matchten. FIX an 3 Stellen: 1. KeywordEntry.MachineTypes — Pressen-Keywords nur fuer press/*_press 2. ParseNarrative(text, machineType) — Parser laedt Maschinentyp aus Projekt 3. HazardPattern.MachineTypes — Pressen-Patterns (HP045-HP058) nur fuer Pressen Verhindert zukuenftig falsche Zuordnungen bei neuen Kundenprojekten. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/breakpilot/ai-compliance-sdk/internal/iace"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
// ParseNarrativeRequest is the request body for POST /projects/:id/parse-narrative.
|
||||
@@ -43,8 +44,16 @@ func (h *IACEHandler) ParseNarrative(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
// 1. Parse narrative text deterministically
|
||||
parseResult := iace.ParseNarrative(req.NarrativeText)
|
||||
// Load project to get machine type for context-aware parsing
|
||||
var machineType string
|
||||
if projectID, err := uuid.Parse(c.Param("id")); err == nil {
|
||||
if project, err := h.store.GetProject(c.Request.Context(), projectID); err == nil && project != nil {
|
||||
machineType = project.MachineType
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Parse narrative text deterministically (machine-type-aware)
|
||||
parseResult := iace.ParseNarrative(req.NarrativeText, machineType)
|
||||
|
||||
// 2. Feed parsed tags into pattern engine
|
||||
// Collect all component IDs for tag resolution
|
||||
|
||||
Reference in New Issue
Block a user