feat(ai-core): trace instrumentation, LLM thinker, decay scheduler
Cyrene CI / backend (push) Has been cancelled
Cyrene CI / frontend (push) Has been cancelled

- orchestrator: Tracer interface with spans for intent analysis, persona,
  subsession dispatch, context build, LLM streaming and each tool call;
  traces finish when the stream completes — the admin Trace waterfall
  finally receives data
- background: Thinker generates real LLM thoughts (post-chat + silence
  triggers, recent history as context, empty/overlong outputs discarded);
  thoughts broadcast to web clients as 'thinking' WS messages; pipeline
  postChatHook triggers post-chat thinking after each round
- memory: ApplyDecayAll + ListUserIDs with a 6h decay/purge cron in main
  (was implemented but never scheduled)
This commit is contained in:
Aska committed 2026-08-20 20:57:27 +08:00
1 parent 8495a4b055
commit 8603839711
8 files changed
+338 -10

No files matched your search

+17
View File
@@ -161,6 +161,23 @@ func (s *Service) ApplyDecay(ctx context.Context, userID string) (int, error) {
return updated, nil
}
// ApplyDecayAll applies decay for every user that has memories.
func (s *Service) ApplyDecayAll(ctx context.Context) (int, error) {
users, err := s.repo.ListUserIDs(ctx)
if err != nil {
return 0, err
}
total := 0
for _, uid := range users {
n, err := s.ApplyDecay(ctx, uid)
if err != nil {
return total, err
}
total += n
}
return total, nil
}
// --- Keyword extraction (sliding window n-grams) ---
// extractNGrams extracts all n-gram substrings from text.