This commit is contained in:
2026-08-16 16:57:36 +02:00
parent 96f8c1115c
commit 532d439c41
106 changed files with 10147 additions and 494 deletions
+37 -6
View File
@@ -87,8 +87,25 @@ type ProductInput struct {
// CategoryEnhancePrompt overrides EnhanceUserTemplate when non-empty
// (resolved for the active language before enhance).
CategoryEnhancePrompt string
// CategoryPromptsByLang maps lower(name) → lang → category override prompt.
// CategoryPromptsByLang maps lower(name|unique_id) → lang → category override prompt
// (JSON/overlay text with {{attrs}}/{{category}}; works with repaired A1 overlays).
CategoryPromptsByLang map[string]company.LangPromptMap
// TitleTemplate / DescriptionTemplate are language-agnostic category formulas
// (categories.title_template / description_template). Injected into the enhance
// user prompt as structure constraints; not per-lang text maps.
TitleTemplate any
DescriptionTemplate any
// CategoryFormulasByKey maps lower(name|unique_id) → title/description templates.
CategoryFormulasByKey map[string]CategoryFormulas
// CategoryNamesByUID maps category unique_id → display name (e.g. "50"→"Štedilniki").
CategoryNamesByUID map[string]string
// AllowedAttrKeys are company category_attributes keys for this product's
// category unique_id (plus coreCharacteristicAttrKeys via AttrsForEnhance).
// nil = sanitize only (unit tests); empty non-nil = core keys only.
AllowedAttrKeys map[string]struct{}
// CategoryAttrKeys maps category unique_id → attribute keys (job cache).
// When set, enhance resolves allowlist from the step result category.
CategoryAttrKeys map[string]map[string]struct{}
// Prior* are loaded from the last processed_products row for this raw product.
PriorEnhanceHash string
PriorProcessedName string
@@ -97,6 +114,12 @@ type ProductInput struct {
PriorLocalized company.LocalizedContent
}
// CategoryFormulas holds optional title/description templates for one category key.
type CategoryFormulas struct {
TitleTemplate any
DescriptionTemplate any
}
// PromptTemplates is a system+user pair for one language.
type PromptTemplates struct {
System string
@@ -105,7 +128,11 @@ type PromptTemplates struct {
// StepResult is the cumulative output for one product.
type StepResult struct {
Category string
// Category is the company taxonomy unique_id (DB/API). Prefer CategoryName
// for human-facing copy (meta, synthesize, {{category}}).
Category string
// CategoryName is the display label resolved from categories.name.
CategoryName string
Name string
Description string
ProcessedName string
@@ -126,6 +153,10 @@ type StepResult struct {
// enhance input hash matched (ai_enhance_unchanged). processOne must not
// ConsumeCredits in that case — no LLM and no meaningful rework.
SkipCreditDebit bool
// MetaTitle / MetaDescription are free template SEO fields written by
// processOne via fillMetaFromResult (never AI-enhanced by default).
MetaTitle string
MetaDescription string
}
// StepProgress is a job-level snapshot of pipeline step status.
@@ -153,8 +184,8 @@ func (e *Engine) CompleterEnabled() bool {
if c, ok := e.Completer.(EnableChecker); ok {
return c.Enabled()
}
// HeuristicCompleter has no Enabled — treat as enabled only if explicitly set.
// Worker sets Completer=nil when platform OpenAI (admin settings / env) is unset.
_, isHeuristic := e.Completer.(HeuristicCompleter)
return !isHeuristic
// HeuristicCompleter (local/dev fallback) and other Completers without
// EnableChecker are treated as enabled when explicitly wired on the Engine.
// Worker still sets Completer=nil when no provider is configured.
return true
}