summaryrefslogtreecommitdiff
path: root/bot.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-05-01 07:08:03 +0300
committerGrail Finder <wohilas@gmail.com>2025-05-01 07:08:03 +0300
commit10cca9037fac14fff966dd1fd6e9de86893d3981 (patch)
treec1a6ad9815bc6acf70dd9c047763bef8f3377674 /bot.go
parentd2e48468350ff315ca54663dbe2783c6e6eddcb2 (diff)
Fix: tool description
Diffstat (limited to 'bot.go')
-rw-r--r--bot.go35
1 files changed, 21 insertions, 14 deletions
diff --git a/bot.go b/bot.go
index 8aff41d..f6770e7 100644
--- a/bot.go
+++ b/bot.go
@@ -272,25 +272,13 @@ func roleToIcon(role string) string {
return "<" + role + ">: "
}
-func chatRound(userMsg, role string, tv *tview.TextView, regen, resume bool) {
- botRespMode = true
- defer func() { botRespMode = false }()
- // check that there is a model set to use if is not local
- if cfg.CurrentAPI == cfg.DeepSeekChatAPI || cfg.CurrentAPI == cfg.DeepSeekCompletionAPI {
- if chatBody.Model != "deepseek-chat" && chatBody.Model != "deepseek-reasoner" {
- if err := notifyUser("bad request", "wrong deepseek model name"); err != nil {
- logger.Warn("failed ot notify user", "error", err)
- return
- }
- return
- }
- }
+func checkGame(role string, tv *tview.TextView) {
// Handle Cluedo game flow
// should go before form msg, since formmsg takes chatBody and makes ioreader out of it
// role is almost always user, unless it's regen or resume
// cannot get in this block, since cluedoState is nil;
// check if cfg.EnableCluedo is true and init the cluedo state; ai!
- if cfg.EnableCluedo && cluedoState != nil && !resume {
+ if cfg.EnableCluedo && cluedoState != nil {
notifyUser("got in cluedo", "yay")
currentPlayer := playerOrder[0]
playerOrder = append(playerOrder[1:], currentPlayer) // Rotate turns
@@ -303,6 +291,25 @@ func chatRound(userMsg, role string, tv *tview.TextView, regen, resume bool) {
})
}
}
+ return
+}
+
+func chatRound(userMsg, role string, tv *tview.TextView, regen, resume bool) {
+ botRespMode = true
+ defer func() { botRespMode = false }()
+ // check that there is a model set to use if is not local
+ if cfg.CurrentAPI == cfg.DeepSeekChatAPI || cfg.CurrentAPI == cfg.DeepSeekCompletionAPI {
+ if chatBody.Model != "deepseek-chat" && chatBody.Model != "deepseek-reasoner" {
+ if err := notifyUser("bad request", "wrong deepseek model name"); err != nil {
+ logger.Warn("failed ot notify user", "error", err)
+ return
+ }
+ return
+ }
+ }
+ if !resume {
+ checkGame(role, tv)
+ }
choseChunkParser()
reader, err := chunkParser.FormMsg(userMsg, role, resume)
if reader == nil || err != nil {