fix
This commit is contained in:
@@ -20,6 +20,10 @@ type FixCompanyCatalogOpts struct {
|
||||
ReprocessSampleLimit int
|
||||
// AIPrompts optionally re-applies BuiltInDefaults product_enhance per content language.
|
||||
AIPrompts *aiprompts.Service
|
||||
// WPCategoriesSQL is an uploaded wp_product_categories.sql dump. When set,
|
||||
// RepairCompanyCategoryEnhancePrompts force-applies overlays from these bytes
|
||||
// (Admin Sync A1 primary path). Empty keeps filesystem auto-detect fallback.
|
||||
WPCategoriesSQL []byte
|
||||
}
|
||||
|
||||
// FixCompanyCatalogResult is the idempotent admin Fix A1 report.
|
||||
@@ -36,6 +40,10 @@ type FixCompanyCatalogResult struct {
|
||||
CategoryPromptsEmpty int `json:"category_prompts_empty_skipped"`
|
||||
// Prompts aliases category_prompts_updated for flash.admin.fixA1Success {prompts}.
|
||||
Prompts int `json:"prompts"`
|
||||
// WPCategoriesPath is set when prompts came from wp_product_categories.sql
|
||||
// (upload:… or a resolved filesystem path).
|
||||
WPCategoriesPath string `json:"wp_categories_path,omitempty"`
|
||||
WPCategoriesEntries int `json:"wp_categories_entries,omitempty"`
|
||||
|
||||
ProductEnhanceLanguages int `json:"product_enhance_languages"`
|
||||
|
||||
@@ -88,13 +96,17 @@ func FixCompanyCatalog(ctx context.Context, pool *pgxpool.Pool, companyID uuid.U
|
||||
out.CategoryAttributeOrphansRemoved = orphans
|
||||
out.CategoryAttributeLinks = links
|
||||
|
||||
updated, alreadyOK, emptySkipped, err := catalog.RepairCompanyCategoryEnhancePrompts(ctx, pool, companyID)
|
||||
updatedRes, err := catalog.RepairCompanyCategoryEnhancePromptsWithOptions(ctx, pool, companyID, catalog.RepairA1DemoOptions{
|
||||
WPCategoriesSQL: opts.WPCategoriesSQL,
|
||||
})
|
||||
if err != nil {
|
||||
return out, err
|
||||
}
|
||||
out.CategoryPromptsUpdated = updated
|
||||
out.CategoryPromptsAlreadyOK = alreadyOK
|
||||
out.CategoryPromptsEmpty = emptySkipped
|
||||
out.CategoryPromptsUpdated = updatedRes.Updated
|
||||
out.CategoryPromptsAlreadyOK = updatedRes.AlreadyOK
|
||||
out.CategoryPromptsEmpty = updatedRes.EmptySkipped
|
||||
out.WPCategoriesPath = updatedRes.WPCategoriesPath
|
||||
out.WPCategoriesEntries = updatedRes.SeedEntries
|
||||
|
||||
if opts.AIPrompts != nil {
|
||||
n, err := opts.AIPrompts.ApplyBuiltInProductEnhance(ctx, companyID)
|
||||
|
||||
Reference in New Issue
Block a user