fix
This commit is contained in:
@@ -19,6 +19,18 @@ import (
|
||||
type StepPolicy struct {
|
||||
AllowAI bool
|
||||
AllowEPREL bool
|
||||
// MinCategorizeConfidence overrides DefaultMinCategorizeConfidence. A categorize
|
||||
// reply below it is treated as "no category found" and fails the product rather
|
||||
// than letting a wrong guess drive the formula. 0 uses the default.
|
||||
MinCategorizeConfidence float64
|
||||
}
|
||||
|
||||
// CategorizeConfidence returns the effective low-confidence floor for this policy.
|
||||
func (p StepPolicy) CategorizeConfidence() float64 {
|
||||
if p.MinCategorizeConfidence > 0 {
|
||||
return p.MinCategorizeConfidence
|
||||
}
|
||||
return DefaultMinCategorizeConfidence
|
||||
}
|
||||
|
||||
// RunSteps executes the multi-step product pipeline.
|
||||
@@ -213,7 +225,11 @@ func (e *Engine) RunSteps(ctx context.Context, companyID string, in ProductInput
|
||||
|
||||
case StepCategorize:
|
||||
// Vector (if enabled) then LLM taxonomy pick when category still empty.
|
||||
runCategorizeStep(ctx, e, companyID, &out, in, categoryNames, policy)
|
||||
// A category the model could not determine fails the product here, before
|
||||
// enhance spends a call writing copy for the wrong category.
|
||||
if err := runCategorizeStep(ctx, e, companyID, &out, in, categoryNames, policy); err != nil {
|
||||
return out, err
|
||||
}
|
||||
|
||||
case StepAIEnhance:
|
||||
preservePriorEnhanceHash := func() {
|
||||
@@ -533,7 +549,9 @@ func (e *Engine) RunSteps(ctx context.Context, companyID string, in ProductInput
|
||||
// Pipelines without StepCategorize (normalize_only) still run vector + LLM
|
||||
// categorize when category is empty so downstream steps are not fed a blank.
|
||||
if !stepsContain(steps, StepCategorize) {
|
||||
runCategorizeStep(ctx, e, companyID, &out, in, categoryNames, policy)
|
||||
if err := runCategorizeStep(ctx, e, companyID, &out, in, categoryNames, policy); err != nil {
|
||||
return out, err
|
||||
}
|
||||
}
|
||||
// Record why category stayed empty for every pipeline, including the ones that
|
||||
// now categorize inside the loop (enhance / title / description).
|
||||
|
||||
Reference in New Issue
Block a user