feat: expand companion platform, device controls, and memoir workflows
ci / verify (push) Canceled after 0s

Add customer and operator login, BLE provisioning, device fleet controls, call memory, memoir generation, and refreshed family and maintenance portals. Include API contracts, migrations, firmware sources, tests, assets, and deployment documentation.
This commit is contained in:
Codex Local
2026-10-08 10:06:44 +08:00
parent 98fb2965d0
commit bf1233d5df
861 changed files with 94614 additions and 3209 deletions
+58
View File
@@ -0,0 +1,58 @@
package extraction
import (
"encoding/json"
"errors"
"strings"
)
// Dify orchestrates the model steps. These rules also apply to its final output
// before the existing story writers can save or merge anything.
func WorkflowPrompts() (string, string) { return eventExtractionPrompt, dailyExtractionPrompt }
func WorkflowContent(in GenerationInput) string { return generationContent(in) }
func ValidateWorkflowResult(in GenerationInput, result GenerationResult, modelRef string) (GenerationResult, error) {
result.Summary = strings.TrimSpace(result.Summary)
result.DecisionReason = strings.TrimSpace(result.DecisionReason)
result.OpenTopic = strings.TrimSpace(result.OpenTopic)
result.Keywords = normalizedKeywords(result.Keywords)
if result.Stories == nil || result.DailyEvents == nil {
return GenerationResult{}, errors.New("workflow event arrays required")
}
if err := normalizeEvents(&result, in); err != nil {
return GenerationResult{}, err
}
normalizeDecisionContent(&result)
if !validGeneratedContent(result) {
return GenerationResult{}, errors.New("workflow content failed validation")
}
actual := make([]DailyEvent, 0, len(result.DailyEvents))
for _, d := range result.DailyEvents {
if d.TimeScope != "today_actual" || strings.TrimSpace(d.Evidence) == "" || !strings.Contains(in.Content, d.Evidence) {
return GenerationResult{}, errors.New("daily event lacks original evidence")
}
future := false
for _, phrase := range []string{"明天", "明早", "前几天", "打算", "计划", "尚未", "还没动手", "想着", "还想", "一会儿", "以后再"} {
if strings.Contains(d.Content, phrase) {
future = true
break
}
}
if !future {
actual = append(actual, d)
}
}
result.DailyEvents = actual
result.ModelRef = modelRef
result.PromptVersion = "content-events-dify-v1"
result.AllowStory = result.Meaningful && result.StoryWorthy
return result, nil
}
func ParseWorkflowResult(in GenerationInput, raw json.RawMessage, modelRef string) (GenerationResult, error) {
var result GenerationResult
if json.Unmarshal(raw, &result) != nil {
return result, errors.New("invalid workflow extraction JSON")
}
return ValidateWorkflowResult(in, result, modelRef)
}