fix
This commit is contained in:
@@ -358,14 +358,28 @@ func runCategorizeStep(ctx context.Context, e *Engine, companyID string, out *St
|
||||
return nil
|
||||
}
|
||||
|
||||
// MappedCategorySourceKey marks a mapped_data.category this pipeline wrote itself.
|
||||
//
|
||||
// Without it the write is indistinguishable from a feed-supplied category on the
|
||||
// next run, so Review showed an AI-chosen category as the product's "Original" and
|
||||
// every product looked already-categorised. $4 carries the step that chose it
|
||||
// (mapped / vector / llm); only "mapped" means the feed actually supplied one.
|
||||
const MappedCategorySourceKey = "category_source"
|
||||
|
||||
// persistMappedCategorySQL writes a taxonomy unique_id onto mapped_data.category
|
||||
// when the mapped value is still empty (so Products UI + reprocess stick).
|
||||
// when the mapped value is still empty (so Products UI + reprocess stick), and
|
||||
// records who chose it alongside.
|
||||
const persistMappedCategorySQL = `
|
||||
UPDATE raw_products
|
||||
SET mapped_data = jsonb_set(
|
||||
COALESCE(mapped_data, '{}'::jsonb),
|
||||
'{category}',
|
||||
to_jsonb($3::text),
|
||||
jsonb_set(
|
||||
COALESCE(mapped_data, '{}'::jsonb),
|
||||
'{category}',
|
||||
to_jsonb($3::text),
|
||||
true
|
||||
),
|
||||
'{category_source}',
|
||||
to_jsonb($4::text),
|
||||
true
|
||||
),
|
||||
updated_at = now()
|
||||
|
||||
Reference in New Issue
Block a user