]> git.giacomolli.uk - onechat/blobdiff - turn.go
Keep the connection of a new WhatsApp link
[onechat] / turn.go
diff --git a/turn.go b/turn.go
index e304714e5068b01acb0f4d545b9dedd4de2ac5fb..c6ab5e9b2dcedf7182fdf3e9d7c0685052f585d7 100644 (file)
--- a/turn.go
+++ b/turn.go
@@ -9,10 +9,10 @@ import (
        "time"
 )
 
        "time"
 )
 
-// newTurnLoop returns the loop of agent with its memory and its subagents. Its
-// calls go through client, and notify gets each event. The clock gives the date
-// of a turn.
-func newTurnLoop(agent *Agent, memory *Memory, subagents *Subagents, client ChainClient, clock func() time.Time, notify func(Event)) (*TurnLoop, error) {
+// newTurnLoop returns the loop of agent with its memory, its subagents, and the
+// WhatsApp link of its tools. Its calls go through client, and notify gets each
+// event. The clock gives the date of a turn.
+func newTurnLoop(agent *Agent, memory *Memory, subagents *Subagents, whatsapp *WhatsApp, client ChainClient, clock func() time.Time, notify func(Event)) (*TurnLoop, error) {
        layout, err := loadViewLayout(filepath.Join(agent.dir, viewLayoutFileName))
        if err != nil {
                return nil, err
        layout, err := loadViewLayout(filepath.Join(agent.dir, viewLayoutFileName))
        if err != nil {
                return nil, err
@@ -47,6 +47,7 @@ func newTurnLoop(agent *Agent, memory *Memory, subagents *Subagents, client Chai
                chat:      memory,
                subagents: subagents,
                runs:      l.runs,
                chat:      memory,
                subagents: subagents,
                runs:      l.runs,
+               whatsapp:  whatsapp,
                workdir:   agent.config.Workdir,
        }
 
                workdir:   agent.config.Workdir,
        }