!explain via ❓ reaction: thread-reply with a 3-bullet TL;DR
When a user reacts ❓ on one of Pete's posts, fetch the article body,
ask Ollama for a 3-bullet summary, and post it as a threaded reply
rooted at the original story event. Per-process cooldown of 5min per
story keeps repeated reactions from re-summarizing.
- ingestion.FetchArticleBody: visible <p> text capped at 8000 chars
- classifier.OllamaClient.GenerateText: non-JSON variant
- storage.GetStoryByGUID: full row lookup
- matrix.PostThreadedReply: m.thread + m.in_reply_to fallback
- poster.SetReactionCallback: optional hook fired after recording
- New package: internal/explainer
This commit is contained in:
5
main.go
5
main.go
@@ -11,6 +11,7 @@ import (
|
||||
|
||||
"pete/internal/classifier"
|
||||
"pete/internal/config"
|
||||
"pete/internal/explainer"
|
||||
"pete/internal/ingestion"
|
||||
"pete/internal/matrix"
|
||||
"pete/internal/poster"
|
||||
@@ -73,8 +74,10 @@ func main() {
|
||||
// Create post queue
|
||||
queue := poster.NewQueue(cfg.Posting, mx)
|
||||
|
||||
// Wire reaction handler
|
||||
// Wire reaction handler + ❓ → summary hook
|
||||
mx.SetReactionHandler(poster.HandleReaction)
|
||||
exp := explainer.New(mx, ollamaClient)
|
||||
poster.SetReactionCallback(exp.Handle)
|
||||
|
||||
// Set up graceful shutdown
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user