summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2024-11-21 07:25:23 +0300
committerGrail Finder <wohilas@gmail.com>2024-11-21 07:25:23 +0300
commit35340d88863cb2a6a1b883bd3312abfef3a24c7a (patch)
tree31d41c25e97e7efec0849bdc3b8df2c0b521c90c
parent5ccad20bd680dc443b30f0decc8fca13427dc70d (diff)
Fix: chat upsertHEADmaster
-rw-r--r--README.md6
-rw-r--r--bot.go1
-rw-r--r--session.go6
3 files changed, 9 insertions, 4 deletions
diff --git a/README.md b/README.md
index f75c23e..f7c63bf 100644
--- a/README.md
+++ b/README.md
@@ -14,12 +14,12 @@
- stop stream from the bot; +
- sqlitedb instead of chatfiles; +
- sqlite for the bot memory;
+- option to switch between predefined sys prompts;
### FIX:
- bot responding (or haninging) blocks everything; +
- programm requires history folder, but it is .gitignore; +
- at first run chat table does not exist; run migrations sql on startup; +
- Tab is needed to copy paste text into textarea box, use shift+tab to switch focus; (changed tp pgup) +
-- delete last msg: can have unexpected behavior (deletes what appears to be two messages);
-- EOF from llama, possibly broken json in request;
-- chat upsert does not work;
+- delete last msg: can have unexpected behavior (deletes what appears to be two messages if last bot msg was not generated (should only delete icon in that case));
+- empty input to continue bot msg gens new msg index and bot icon;
diff --git a/bot.go b/bot.go
index 2037e7e..66303a2 100644
--- a/bot.go
+++ b/bot.go
@@ -238,7 +238,6 @@ func init() {
panic(err)
}
logger = slog.New(slog.NewTextHandler(file, nil))
- logger.Info("test msg")
store = storage.NewProviderSQL("test.db", logger)
// https://github.com/coreydaley/ggerganov-llama.cpp/blob/master/examples/server/README.md
// load all chats in memory
diff --git a/session.go b/session.go
index a6c0e8b..23d725d 100644
--- a/session.go
+++ b/session.go
@@ -90,6 +90,12 @@ func loadOldChatOrGetNew() []models.MessagesStory {
chatMap[newChat.Name] = newChat
return defaultStarter
}
+ if chat.Name == "" {
+ logger.Warn("empty chat name", "id", chat.ID)
+ chat.Name = fmt.Sprintf("%d_%v", chat.ID, chat.CreatedAt.Unix())
+ }
+ chatMap[chat.Name] = chat
+ activeChatName = chat.Name
return history
}