add ai feature

This commit is contained in:
2025-11-05 16:06:09 +08:00
parent 42bc9aff42
commit 13ca7ddbed
33 changed files with 2194 additions and 30 deletions

View File

@@ -0,0 +1,21 @@
package history
// BuildAIMetadata constructs ledger metadata for AI-driven rename batches.
func BuildAIMetadata(prompt string, promptHistory []string, notes []string, model string, warnings []string) map[string]any {
data := map[string]any{
"prompt": prompt,
"model": model,
"flow": "renameFlow",
"warnings": warnings,
}
if len(promptHistory) > 0 {
data["promptHistory"] = append([]string(nil), promptHistory...)
}
if len(notes) > 0 {
data["notes"] = append([]string(nil), notes...)
}
return data
}