feat(tools): implement CRUD operations for thoughts and projects
* Add tools for creating, retrieving, updating, and deleting thoughts. * Implement project management tools for creating and listing projects. * Introduce linking functionality between thoughts. * Add search and recall capabilities for thoughts based on semantic queries. * Implement statistics and summarization tools for thought analysis. * Create database migrations for thoughts, projects, and links. * Add helper functions for UUID parsing and project resolution.
This commit is contained in:
60
internal/config/validate_test.go
Normal file
60
internal/config/validate_test.go
Normal file
@@ -0,0 +1,60 @@
|
||||
package config
|
||||
|
||||
import "testing"
|
||||
|
||||
func validConfig() Config {
|
||||
return Config{
|
||||
Server: ServerConfig{Port: 8080},
|
||||
MCP: MCPConfig{Path: "/mcp"},
|
||||
Auth: AuthConfig{
|
||||
Keys: []APIKey{{ID: "test", Value: "secret"}},
|
||||
},
|
||||
Database: DatabaseConfig{URL: "postgres://example"},
|
||||
AI: AIConfig{
|
||||
Provider: "litellm",
|
||||
Embeddings: AIEmbeddingConfig{
|
||||
Dimensions: 1536,
|
||||
},
|
||||
LiteLLM: LiteLLMConfig{
|
||||
BaseURL: "http://localhost:4000/v1",
|
||||
APIKey: "key",
|
||||
},
|
||||
OpenRouter: OpenRouterAIConfig{
|
||||
BaseURL: "https://openrouter.ai/api/v1",
|
||||
APIKey: "key",
|
||||
},
|
||||
},
|
||||
Search: SearchConfig{DefaultLimit: 10, MaxLimit: 50},
|
||||
Logging: LoggingConfig{Level: "info"},
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateAcceptsLiteLLMAndOpenRouter(t *testing.T) {
|
||||
cfg := validConfig()
|
||||
if err := cfg.Validate(); err != nil {
|
||||
t.Fatalf("Validate litellm error = %v", err)
|
||||
}
|
||||
|
||||
cfg.AI.Provider = "openrouter"
|
||||
if err := cfg.Validate(); err != nil {
|
||||
t.Fatalf("Validate openrouter error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRejectsInvalidProvider(t *testing.T) {
|
||||
cfg := validConfig()
|
||||
cfg.AI.Provider = "unknown"
|
||||
|
||||
if err := cfg.Validate(); err == nil {
|
||||
t.Fatal("Validate() error = nil, want error for unsupported provider")
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateRejectsEmptyAuthKeyValue(t *testing.T) {
|
||||
cfg := validConfig()
|
||||
cfg.Auth.Keys[0].Value = ""
|
||||
|
||||
if err := cfg.Validate(); err == nil {
|
||||
t.Fatal("Validate() error = nil, want error for empty auth key value")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user