summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile7
-rw-r--r--bot.go2
-rw-r--r--session.go13
3 files changed, 12 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 7030b5c..9113919 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-.PHONY: setconfig run lint install-linters setup-whisper build-whisper download-whisper-model docker-up docker-down docker-logs noextra-run installdelve checkdelve
+.PHONY: setconfig run lint lintall install-linters setup-whisper build-whisper download-whisper-model docker-up docker-down docker-logs noextra-run installdelve checkdelve
run: setconfig
go build -tags extra -o gf-lt && ./gf-lt
@@ -25,7 +25,10 @@ install-linters: ## Install additional linters (noblanks)
go install github.com/GrailFinder/noblanks-linter/cmd/noblanks@latest
lint: ## Run linters. Use make install-linters first.
- golangci-lint run -c .golangci.yml ./...; noblanks ./...
+ golangci-lint run -c .golangci.yml ./...
+
+lintall: lint
+ noblanks ./...
# Whisper STT Setup (in batteries directory)
setup-whisper: build-whisper download-whisper-model
diff --git a/bot.go b/bot.go
index 6b46c52..86b602c 100644
--- a/bot.go
+++ b/bot.go
@@ -1411,8 +1411,6 @@ func init() {
}
// load cards
basicCard.Role = cfg.AssistantRole
- // toolCard.Role = cfg.AssistantRole
- //
logLevel.Set(slog.LevelInfo)
logger = slog.New(slog.NewTextHandler(logfile, &slog.HandlerOptions{Level: logLevel}))
store = storage.NewProviderSQL(cfg.DBPATH, logger)
diff --git a/session.go b/session.go
index bcfe841..5784333 100644
--- a/session.go
+++ b/session.go
@@ -131,13 +131,18 @@ func loadOldChatOrGetNew() []models.RoleMsg {
chat, err := store.GetLastChat()
if err != nil {
logger.Warn("failed to load history chat", "error", err)
+ maxID, err := store.ChatGetMaxID()
+ if err != nil {
+ logger.Error("failed to fetch max chat id", "error", err)
+ }
+ maxID++
chat := &models.Chat{
- ID: 0,
+ ID: maxID,
CreatedAt: time.Now(),
UpdatedAt: time.Now(),
Agent: cfg.AssistantRole,
}
- chat.Name = fmt.Sprintf("%s_%v", chat.Agent, chat.CreatedAt.Unix())
+ chat.Name = fmt.Sprintf("%s_%v", chat.Agent, chat.ID)
activeChatName = chat.Name
chatMap[chat.Name] = chat
return defaultStarter
@@ -149,10 +154,6 @@ func loadOldChatOrGetNew() []models.RoleMsg {
chatMap[chat.Name] = chat
return defaultStarter
}
- // if chat.Name == "" {
- // logger.Warn("empty chat name", "id", chat.ID)
- // chat.Name = fmt.Sprintf("%s_%v", chat.Agent, chat.CreatedAt.Unix())
- // }
chatMap[chat.Name] = chat
activeChatName = chat.Name
cfg.AssistantRole = chat.Agent