This commit is contained in:
Tomas Dvorak
2026-02-24 10:33:59 +01:00
parent 409acd2e08
commit 898a3c303f
1374 changed files with 290409 additions and 29187 deletions
+5 -61
View File
@@ -6,6 +6,7 @@ import (
"path/filepath"
"github.com/spf13/cobra"
appconfig "github.com/yourorg/devour/internal/config"
)
var initCmd = &cobra.Command{
@@ -53,7 +54,10 @@ func runInit(cmd *cobra.Command, args []string) error {
}
// Create default config
config := generateDefaultConfig(initRemote)
config, err := appconfig.RenderInitYAML(initRemote)
if err != nil {
return fmt.Errorf("failed to render default config: %w", err)
}
if err := os.WriteFile(configPath, []byte(config), 0644); err != nil {
return fmt.Errorf("failed to write config: %w", err)
}
@@ -82,63 +86,3 @@ func runInit(cmd *cobra.Command, args []string) error {
return nil
}
func generateDefaultConfig(remote bool) string {
mode := "local"
if remote {
mode = "remote"
}
return fmt.Sprintf(`# Devour Configuration
version: 1
# Storage paths
storage:
docs_dir: ./devour_data/docs
index_dir: ./devour_data/index
metadata_dir: ./devour_data/metadata
# Embedding settings
embeddings:
provider: openai
model: text-embedding-3-small
dimensions: 1536
api_key: ${OPENAI_API_KEY}
batch_size: 100
# Vector database
vector_db:
type: chromem
persist: true
similarity_metric: cosine
# Scraping settings
scraper:
user_agent: "Devour/1.0"
timeout: 30s
retry_count: 3
concurrency: 10
rate_limit: 500ms
max_depth: 3
cache_dir: ./devour_data/cache
# Scheduler
scheduler:
enabled: true
interval: 72h
check_method: hash
# Server settings
server:
mode: %s
port: 8080
host: localhost
# Sources (add your own)
sources: []
# - name: example-docs
# type: url
# url: https://docs.example.com
# include: ["**/*.md", "**/*.html"]
`, mode)
}