Documentation
¶
Index ¶
- Variables
- func AddDocument(ctx context.Context, db *sql.DB, path string) error
- func AddDocuments(ctx context.Context, db *sql.DB, paths []string, maxWorkers int) []error
- func CreateDB(dbPath string) (*sql.DB, bool, error)
- func CreateEmbedding(ctx context.Context, text string) ([]float32, error)
- func FindGitDir(startPath string) (string, error)
- func GetAllFilePaths(db *sql.DB) ([]string, error)
- func GetConfig(db *sql.DB) (map[string]string, error)
- func GetDatabaseStats(db *sql.DB) (map[string]int, error)
- func InitDatabase(db *sql.DB, embeddingSize int) error
- func IsRemoteURL(path string) bool
- func LoadGitignoreFromFile(path string) ([]gitignore.Pattern, error)
- func LoadGitignorePatterns(gitDir string) ([]gitignore.Pattern, error)
- func RecreateDatabase(db *sql.DB, embeddingSize int) ([]string, error)
- func RemoveDocument(db *sql.DB, id int) error
- func SaveConfig(db *sql.DB, config map[string]string) error
- type Config
- type Document
- type EmbeddingRequest
Constants ¶
This section is empty.
Variables ¶
var ( BaseURL = "http://localhost:11434/api/embeddings" Model = "nomic-embed-text" APIKey = "" )
Functions ¶
func AddDocument ¶
AddDocument adds a single document to the database
func AddDocuments ¶
AddDocuments processes multiple documents in parallel
func CreateDB ¶
CreateDB creates or opens a SQLite database at the given path. Returns the database connection, a boolean indicating if it's a new database, and any error that occurred.
func FindGitDir ¶
validateLocalFile checks if a local file is valid for processing
func InitDatabase ¶
InitDatabase initializes the database schema with the required tables
func IsRemoteURL ¶
IsRemoteURL checks if the given path is a remote URL
func RecreateDatabase ¶
RecreateDatabase recreates the database from scratch with the current schema
func RemoveDocument ¶
RemoveDocument removes a document by its ID
Types ¶
type Config ¶
type Config struct { EmbeddingBaseURL string `json:"embedding_base_url"` EmbeddingModel string `json:"embedding_model"` APIKey string `json:"api_key,omitempty"` // Added API key field }
func LoadConfig ¶
type Document ¶
type Document struct { ID int64 Path string Content string Title string IsRemote bool // Only used for search results Distance float64 }
Document represents a stored document
func FetchDocument ¶
FetchDocument retrieves content from either a local file or remote URL
func GetAllDocuments ¶
GetAllDocuments retrieves all documents from the database
func GetDocumentByID ¶
GetDocumentByID retrieves a single document by its ID