diff --git a/cmd/config.go b/cmd/config.go index 13dc8dc..ffcfd16 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -37,15 +37,16 @@ var configSetCmd = &cobra.Command{ Available keys: - data-dir: Data directory for storing notes database - ollama-endpoint: Ollama API endpoint - - embedding-model: Embedding model name - - vector-dimensions: Number of vector dimensions - - enable-vector: Enable/disable vector search (true/false) - debug: Enable/disable debug logging (true/false) - summarization-model: Model to use for summarization - enable-summarization: Enable/disable summarization features (true/false) - editor: Default editor to use for editing notes (e.g., "vim", "code --wait") + - enable-auto-tagging: Enable/disable AI auto-tagging features (true/false) + - auto-tag-model: Model to use for auto-tagging (leave empty to use summarization model) + - max-auto-tags: Maximum number of tags to auto-generate per note (1-20) - github-owner: GitHub repository owner for updates (default: streed) - - github-repo: GitHub repository name for updates (default: ml-notes)`, + - github-repo: GitHub repository name for updates (default: ml-notes) + - lilrag-url: Lil-Rag service endpoint for enhanced semantic search`, Args: cobra.ExactArgs(2), RunE: runConfigSet, } @@ -168,6 +169,8 @@ func runConfigSet(cmd *cobra.Command, args []string) error { cfg.GitHubOwner = value case "github-repo": cfg.GitHubRepo = value + case "lilrag-url": + cfg.LilRagURL = value default: return fmt.Errorf("%w: %s", interrors.ErrUnknownConfigKey, key) } diff --git a/internal/api/server.go b/internal/api/server.go index 6d33b45..3b8a73c 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -114,9 +114,12 @@ type UpdateSettingsRequest struct { EnableSummarization *bool `json:"enable_summarization,omitempty"` Editor string `json:"editor,omitempty"` EnableAutoTagging *bool `json:"enable_auto_tagging,omitempty"` + AutoTagModel string `json:"auto_tag_model,omitempty"` MaxAutoTags *int `json:"max_auto_tags,omitempty"` GitHubOwner string `json:"github_owner,omitempty"` GitHubRepo string `json:"github_repo,omitempty"` + LilRagURL string `json:"lilrag_url,omitempty"` + WebUITheme string `json:"webui_theme,omitempty"` } func NewAPIServer(cfg *config.Config, db *sql.DB, repo *models.NoteRepository, vectorSearch search.SearchProvider, assetProvider AssetProvider) *APIServer { @@ -1411,9 +1414,11 @@ func (s *APIServer) handleGetSettings(w http.ResponseWriter, r *http.Request) { "enable_summarization": s.cfg.EnableSummarization, "editor": s.cfg.Editor, "enable_auto_tagging": s.cfg.EnableAutoTagging, + "auto_tag_model": s.cfg.AutoTagModel, "max_auto_tags": s.cfg.MaxAutoTags, "github_owner": s.cfg.GitHubOwner, "github_repo": s.cfg.GitHubRepo, + "lilrag_url": s.cfg.LilRagURL, "webui_theme": s.cfg.WebUITheme, } @@ -1448,6 +1453,9 @@ func (s *APIServer) handleUpdateSettings(w http.ResponseWriter, r *http.Request) if req.EnableAutoTagging != nil { newCfg.EnableAutoTagging = *req.EnableAutoTagging } + if req.AutoTagModel != "" { + newCfg.AutoTagModel = req.AutoTagModel + } if req.MaxAutoTags != nil { if *req.MaxAutoTags < 1 || *req.MaxAutoTags > 20 { s.writeError(w, http.StatusBadRequest, fmt.Errorf("max auto tags must be between 1 and 20")) @@ -1461,6 +1469,12 @@ func (s *APIServer) handleUpdateSettings(w http.ResponseWriter, r *http.Request) if req.GitHubRepo != "" { newCfg.GitHubRepo = req.GitHubRepo } + if req.LilRagURL != "" { + newCfg.LilRagURL = req.LilRagURL + } + if req.WebUITheme != "" { + newCfg.WebUITheme = req.WebUITheme + } // Save the updated configuration if err := config.Save(&newCfg); err != nil { @@ -1483,9 +1497,11 @@ func (s *APIServer) handleUpdateSettings(w http.ResponseWriter, r *http.Request) "enable_summarization": s.cfg.EnableSummarization, "editor": s.cfg.Editor, "enable_auto_tagging": s.cfg.EnableAutoTagging, + "auto_tag_model": s.cfg.AutoTagModel, "max_auto_tags": s.cfg.MaxAutoTags, "github_owner": s.cfg.GitHubOwner, "github_repo": s.cfg.GitHubRepo, + "lilrag_url": s.cfg.LilRagURL, "webui_theme": s.cfg.WebUITheme, }, } diff --git a/web/templates/settings.html b/web/templates/settings.html index 505a739..c3450dc 100644 --- a/web/templates/settings.html +++ b/web/templates/settings.html @@ -45,30 +45,6 @@

⚙️ Configuration Settings

- -
-

🔍 Vector Search & Embeddings

-
- -

Enable semantic search using vector embeddings for better note discovery

-
-
- - -

The model to use for generating text embeddings

-
-
- - -

Number of dimensions for vector embeddings (must match your model)

-
-
-

🦙 Ollama Integration

@@ -80,6 +56,17 @@

🦙 Ollama Integration

+ +
+

🔍 Lil-Rag Integration

+
+ + +

URL of your Lil-Rag service for enhanced semantic search with project isolation

+
+
+

📊 Summarization & Analysis

@@ -108,6 +95,12 @@

🏷️ Auto-tagging

Automatically suggest and apply tags to notes using AI

+
+ + +

The model to use for auto-tagging (leave empty to use summarization model)

+
✏️ Editor Configuration
+ +
+

🎨 Web UI Configuration

+
+ + +

Default theme for the web interface

+
+
+

🔄 Update Configuration

@@ -224,7 +230,7 @@

🔧 System Configuration

for (const [key, value] of formData.entries()) { if (key.startsWith('enable_') || key === 'debug') { settings[key] = true; // Checkboxes are only included if checked - } else if (key === 'vector_dimensions' || key === 'max_auto_tags') { + } else if (key === 'max_auto_tags') { settings[key] = parseInt(value, 10); } else if (value.trim() !== '') { settings[key] = value.trim(); @@ -232,7 +238,7 @@

🔧 System Configuration

} // Handle unchecked checkboxes explicitly - const checkboxes = ['enable_vector_search', 'enable_summarization', 'enable_auto_tagging', 'debug']; + const checkboxes = ['enable_summarization', 'enable_auto_tagging', 'debug']; checkboxes.forEach(checkbox => { if (!(checkbox in settings)) { settings[checkbox] = false; @@ -253,10 +259,6 @@

🔧 System Configuration

if (result.success) { this.showNotification('✅ Settings saved successfully!', 'success'); - if (result.data.reindex_needed) { - this.showNotification('⚠️ Vector configuration changed. Run "ml-notes reindex" to update embeddings.', 'warning'); - } - // Update form with returned values this.updateFormWithSettings(result.data.settings); } else { @@ -276,17 +278,18 @@

🔧 System Configuration

try { // Reset to default values by sending minimal configuration const defaultSettings = { - enable_vector_search: true, enable_summarization: true, enable_auto_tagging: true, debug: false, ollama_endpoint: 'http://localhost:11434', - embedding_model: 'nomic-embed-text', - vector_dimensions: 384, + lilrag_url: 'http://localhost:12121', summarization_model: 'llama3.2:latest', + auto_tag_model: '', max_auto_tags: 5, + editor: '', github_owner: 'streed', - github_repo: 'ml-notes' + github_repo: 'ml-notes', + webui_theme: 'dark' }; const response = await fetch('/api/v1/settings', {