summaryrefslogtreecommitdiff
path: root/bot.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2024-11-21 18:15:01 +0300
committerGrail Finder <wohilas@gmail.com>2024-11-21 18:15:01 +0300
commitc35af037203ac5c39a4f704d5343bc2b5cc56a0c (patch)
tree0f392fc7788e3b2632ceeabe3b85af771c74fd2d /bot.go
parent35340d88863cb2a6a1b883bd3312abfef3a24c7a (diff)
Feat: add tools to tool map
Diffstat (limited to 'bot.go')
-rw-r--r--bot.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/bot.go b/bot.go
index 66303a2..1d7133d 100644
--- a/bot.go
+++ b/bot.go
@@ -33,11 +33,12 @@ var (
historyDir = "./history/"
// TODO: pass as an cli arg
showSystemMsgs bool
+ chunkLimit = 1000
activeChatName string
chunkChan = make(chan string, 10)
streamDone = make(chan bool, 1)
chatBody *models.ChatBody
- store storage.ChatHistory
+ store storage.FullRepo
defaultFirstMsg = "Hello! What can I do for you?"
defaultStarter = []models.MessagesStory{
{Role: "system", Content: systemMsg},
@@ -89,14 +90,15 @@ func sendMsgToLLM(body io.Reader) (any, error) {
break
}
llmchunk := models.LLMRespChunk{}
- if counter > 2000 {
+ if counter > chunkLimit {
+ logger.Warn("response hit chunk limit", "limit", chunkLimit)
streamDone <- true
break
}
line, err := reader.ReadBytes('\n')
if err != nil {
streamDone <- true
- panic(err)
+ logger.Error("error reading response body", "error", err)
}
// logger.Info("linecheck", "line", string(line), "len", len(line), "counter", counter)
if len(line) <= 1 {