Fix: marshal default chat start in the init func

This commit is contained in:
Grail Finder
2024-11-21 20:22:13 +03:00
parent cc84c037ec
commit 692e0ada4b

9
bot.go
View File

@@ -43,8 +43,8 @@ var (
{Role: "system", Content: systemMsg},
{Role: assistantRole, Content: defaultFirstMsg},
}
defaultStarterBytes, _ = json.Marshal(chatBody.Messages)
interruptResp = false
defaultStarterBytes = []byte{}
interruptResp = false
)
// ====
@@ -234,6 +234,11 @@ func init() {
logger.Error("failed to open log file", "error", err, "filename", logFileName)
return
}
defaultStarterBytes, err = json.Marshal(defaultStarter)
if err != nil {
logger.Error("failed to marshal defaultStarter", "error", err)
return
}
logger = slog.New(slog.NewTextHandler(file, nil))
store = storage.NewProviderSQL("test.db", logger)
// https://github.com/coreydaley/ggerganov-llama.cpp/blob/master/examples/server/README.md