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 @@