upddate
This commit is contained in:
1 parent
ff6c2df618
commit
43cfaa0411
18 files changed
+683
-299
No files matched your search
@@ -398,21 +398,30 @@ func main() {
|
||||
}
|
||||
continue
|
||||
}
|
||||
// Upgrade only exact, untouched copies of the OLD built-in defaults.
|
||||
// A tenant-authored language prompt or structured formula is protected.
|
||||
previous := aiprompts.LegacyDefaultCategoryFormula(row.UID, row.Name)
|
||||
if previous.Overlay == def.Overlay || previous.Overlay == "" {
|
||||
custom++
|
||||
continue
|
||||
// Upgrade ONLY exact platform-generated copies, including the prior
|
||||
// offline release. Custom company instructions are never replaced.
|
||||
foundPrevious := false
|
||||
for _, previous := range []aiprompts.CategoryFormulaDefaults{
|
||||
aiprompts.PriorDefaultCategoryFormula(row.UID, row.Name),
|
||||
aiprompts.LegacyDefaultCategoryFormula(row.UID, row.Name),
|
||||
} {
|
||||
if previous.Overlay == "" || previous.Overlay == def.Overlay {
|
||||
continue
|
||||
}
|
||||
oldEntry := cache[catalog.DefaultPromptHash(previous.Overlay)]
|
||||
oldTranslations := company.LangPromptMap{}
|
||||
if oldEntry != nil {
|
||||
oldTranslations = oldEntry.Values
|
||||
}
|
||||
if !catalog.IsUntouchedDefaultPrompt(row.Prompts, previous.Overlay, oldTranslations) ||
|
||||
!matchesDefaultFormula(row.Title, previous.TitleTemplateJSON) ||
|
||||
!matchesDefaultFormula(row.Desc, previous.DescriptionTemplateJSON) {
|
||||
continue
|
||||
}
|
||||
foundPrevious = true
|
||||
break
|
||||
}
|
||||
oldEntry := cache[catalog.DefaultPromptHash(previous.Overlay)]
|
||||
oldTranslations := company.LangPromptMap{}
|
||||
if oldEntry != nil {
|
||||
oldTranslations = oldEntry.Values
|
||||
}
|
||||
if !catalog.IsUntouchedDefaultPrompt(row.Prompts, previous.Overlay, oldTranslations) ||
|
||||
!matchesDefaultFormula(row.Title, previous.TitleTemplateJSON) ||
|
||||
!matchesDefaultFormula(row.Desc, previous.DescriptionTemplateJSON) {
|
||||
if !foundPrevious {
|
||||
custom++
|
||||
continue
|
||||
}
|
||||
@@ -429,6 +438,7 @@ func main() {
|
||||
changed++
|
||||
upgraded++
|
||||
}
|
||||
|
||||
}
|
||||
log.Printf("offline shared default translations: languages=%d templates=%d missing=%d saved=%d eligible=%d updated=%d legacy_upgraded=%d custom_untouched=%d A1_protected=%d A1_duplicate_pairs_rewritten=%d A1_categories_updated=%d failures=%d dry_run=%v", len(targetLangs), len(sources), missing, inserted, eligible, changed, upgraded, custom, protected, a1Removed, a1Updated, failures, *dryRun)
|
||||
if *dryRun && missing > 0 {
|
||||
|
||||
Reference in new issue
Block a user