diff --git a/cmd/client-telegram/main.go b/cmd/client-telegram/main.go index fb9ab1e..2c5f096 100644 --- a/cmd/client-telegram/main.go +++ b/cmd/client-telegram/main.go @@ -9,6 +9,7 @@ import ( "os" "os/signal" "strings" + "syscall" "sync" "github.com/go-telegram/bot" @@ -39,7 +40,7 @@ func main() { } l := New(aiSrv, usernameLimits) - ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) + ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM) defer cancel() opts := []bot.Option{ diff --git a/cmd/server-bot/main.go b/cmd/server-bot/main.go index cd4436f..b519903 100644 --- a/cmd/server-bot/main.go +++ b/cmd/server-bot/main.go @@ -9,6 +9,7 @@ import ( "os/signal" "strconv" "strings" + "syscall" "hairy-botter/internal/ai/agent" "hairy-botter/internal/ai/gemini" @@ -165,7 +166,7 @@ func main() { }) stopCh := make(chan os.Signal, 1) - signal.Notify(stopCh, os.Interrupt, os.Kill) + signal.Notify(stopCh, os.Interrupt, syscall.SIGTERM) finishedCh := make(chan struct{}) // Signal the end of the graceful shutdown go func() { <-stopCh diff --git a/internal/rag/rag.go b/internal/rag/rag.go index f5d5fef..cee81cb 100644 --- a/internal/rag/rag.go +++ b/internal/rag/rag.go @@ -121,7 +121,7 @@ func (l *Logic) loadContent() error { return err }) - l.embeddedDocs = id - 1 // Set the number of embedded documents + l.embeddedDocs = coll.Count() // Set the number of embedded documents l.logger.Info("rag embedding done", slog.Int("num", l.embeddedDocs))