Enha: first chat name convention
This commit is contained in:
7
Makefile
7
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
|
||||
|
||||
2
bot.go
2
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)
|
||||
|
||||
13
session.go
13
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
|
||||
|
||||
Reference in New Issue
Block a user