From 587adfbbdaba802b2089db272a01824ecf56fb50 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 8 Jul 2025 10:34:54 +0300 Subject: [PATCH] Fix: llmapi use same db conn, delete old test; --- config/config.go | 2 +- llmapi/main.go | 2 +- repos/main_test.go | 24 ------------------------ 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 repos/main_test.go diff --git a/config/config.go b/config/config.go index 3f9a279..a36503d 100644 --- a/config/config.go +++ b/config/config.go @@ -39,7 +39,7 @@ func LoadConfigOrDefault(fn string) *Config { config.CookieSecret = "test" config.ServerConfig.Host = "localhost" config.ServerConfig.Port = "3000" - config.DBPath = "sqlite3://gralias.db" + config.DBPath = "gralias.db" } fmt.Printf("config debug; config.LLMConfig.URL: %s\n", config.LLMConfig.URL) return config diff --git a/llmapi/main.go b/llmapi/main.go index 2c51c6b..8109c1c 100644 --- a/llmapi/main.go +++ b/llmapi/main.go @@ -19,7 +19,7 @@ import ( var ( // botname -> channel - repo = repos.NewRepoProvider("sqlite3://../gralias.db") + repo = repos.RP SignalChanMap = make(map[string]chan bool) DoneChanMap = make(map[string]chan bool) // got prompt: control character (\\u0000-\\u001F) found while parsing a string at line 4 column 0 diff --git a/repos/main_test.go b/repos/main_test.go deleted file mode 100644 index 557f483..0000000 --- a/repos/main_test.go +++ /dev/null @@ -1,24 +0,0 @@ -package repos - -import ( - "os" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestNewRepoProvider(t *testing.T) { - // Create a temporary SQLite database file for testing - tmpDBFile := "./test_gralias.db" - defer os.Remove(tmpDBFile) // Clean up the temporary file after the test - - // Initialize a new RepoProvider - repoProvider := NewRepoProvider(tmpDBFile) - - // Assert that the DB connection is not nil - assert.NotNil(t, repoProvider.DB, "DB connection should not be nil") - - // Close the database connection - err := repoProvider.DB.Close() - assert.NoError(t, err, "Error closing database connection") -} \ No newline at end of file