feat(ai-core): trigger memory extraction after each conversation round
The WS hub and platform bridge now call Pipeline.FinishRound when the response stream completes, recording the assistant reply and invoking the LLM memory extractor asynchronously.
This commit is contained in:
1 parent
7c02d31194
commit
cc040b861d
2 files changed
+12
-1
No files matched your search
@@ -388,10 +388,12 @@ func loadAdaptersFromConfig(router *bridge.Router, cfg *bridge.BridgeConfig, orc
|
||||
}
|
||||
|
||||
router.SetMessageHandler(func(msg *bridge.UnifiedMessage) {
|
||||
tokenCh, _, err := orch.ProcessInput(context.Background(), "bridge-"+msg.Source, msg.Content)
|
||||
sessionID := "bridge-" + msg.Source
|
||||
tokenCh, _, err := orch.ProcessInput(context.Background(), sessionID, msg.Content)
|
||||
if err != nil { return }
|
||||
var fc string
|
||||
for t := range tokenCh { fc += t.Content }
|
||||
orch.FinishRound(sessionID, msg.SenderID, fc)
|
||||
if fc != "" {
|
||||
router.SendTo(msg.Platform, msg.Source, fc, bridge.SendOptions{MaxLength: 500, MinGap: 3 * time.Second})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user