matrix-gpt-bot/bot/memory.go
2025-05-09 04:43:15 +00:00

19 lines
458 B
Go

package bot
import (
"matrix-gpt-bot/openai"
)
// conversations stores per-user message history.
var conversations = map[string][]openai.Message{}
// GetHistory retrieves the conversation history for a given user.
func GetHistory(userID string) []openai.Message {
return conversations[userID]
}
// SetHistory saves the conversation history for a given user.
func SetHistory(userID string, history []openai.Message) {
conversations[userID] = history
}