Skip to content

Commit

Permalink
robot, command: think instead of speak
Browse files Browse the repository at this point in the history
For #94.
  • Loading branch information
zephyrtronium committed Dec 22, 2024
1 parent 7eeb676 commit 09e645f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions command/talk.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ func speakCmd(ctx context.Context, robo *Robot, call *Invocation, effect string)
return "no " + e
}
start := time.Now()
m, trace, err := brain.Speak(ctx, robo.Brain, call.Channel.Send, call.Args["prompt"])
m, trace, err := brain.Think(ctx, robo.Brain, call.Channel.Send, call.Args["prompt"])
cost := time.Since(start)
if err != nil {
robo.Log.ErrorContext(ctx, "couldn't speak", "err", err.Error())
robo.Log.ErrorContext(ctx, "couldn't think", "err", err.Error())
return ""
}
if m == "" {
robo.Log.InfoContext(ctx, "spoke nothing", slog.String("tag", call.Channel.Send), slog.String("prompt", call.Args["prompt"]))
robo.Log.InfoContext(ctx, "thought nothing", slog.String("tag", call.Channel.Send), slog.String("prompt", call.Args["prompt"]))
return ""
}
e := call.Channel.Emotes.Pick(rand.Uint32())
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func cliSpeak(ctx context.Context, cmd *cli.Command) error {
prompt := cmd.String("prompt")
for range cmd.Int("n") {
group.Go(func() error {
m, tr, err := brain.Speak(ctx, br, tag, prompt)
m, tr, err := brain.Think(ctx, br, tag, prompt)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions privmsg.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,14 @@ func (robo *Robot) tmiMessage(ctx context.Context, send chan<- *tmi.Message, msg
return
}
start := time.Now()
s, trace, err := brain.Speak(ctx, robo.brain, ch.Send, "")
s, trace, err := brain.Think(ctx, robo.brain, ch.Send, "")
cost := time.Since(start)
if err != nil {
log.ErrorContext(ctx, "wanted to speak but failed", slog.Any("err", err), slog.Duration("cost", cost))
log.ErrorContext(ctx, "wanted to think but failed", slog.Any("err", err), slog.Duration("cost", cost))
return
}
if s == "" {
log.InfoContext(ctx, "spoke nothing", slog.String("tag", ch.Send), slog.Duration("cost", cost))
log.InfoContext(ctx, "thought nothing", slog.String("tag", ch.Send), slog.Duration("cost", cost))
return
}
x := rand.Uint64()
Expand Down

0 comments on commit 09e645f

Please sign in to comment.