feat: 增加内存存储

This commit is contained in:
tbphp
2025-07-05 15:42:20 +08:00
parent d64ada4181
commit 9b252bbd3e
10 changed files with 289 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ import (
"gpt-load/internal/proxy"
"gpt-load/internal/router"
"gpt-load/internal/services"
"gpt-load/internal/store"
"gpt-load/internal/types"
"github.com/sirupsen/logrus"
@@ -76,7 +77,14 @@ func main() {
// ---
// --- Service Initialization ---
taskService := services.NewTaskService()
// Initialize the store first, as other services depend on it.
storage, err := store.NewStore(configManager)
if err != nil {
logrus.Fatalf("Failed to initialize store: %v", err)
}
defer storage.Close()
taskService := services.NewTaskService(storage)
channelFactory := channel.NewFactory(settingsManager)
keyValidatorService := services.NewKeyValidatorService(database, channelFactory)