Documentation
¶
Index ¶
- type Embedder
- type HybridMatch
- type ImportResult
- type Service
- func (s *Service) AvailableProviders() []string
- func (s *Service) BackfillMetadata(ctx context.Context, userID int) (int, error)
- func (s *Service) DefaultProvider() string
- func (s *Service) DeleteByBookmarkID(ctx context.Context, userID int, bookmarkID string) error
- func (s *Service) DeleteVideo(ctx context.Context, userID int, id uuid.UUID) error
- func (s *Service) GetModelPreference(ctx context.Context, userID int) (provider, model string, err error)
- func (s *Service) GetSummaryPrompts(ctx context.Context, userID int) (*SummaryPromptsInfo, error)
- func (s *Service) GetVideo(ctx context.Context, userID int, id uuid.UUID) (*storage.Video, error)
- func (s *Service) GetWebhookInfo(ctx context.Context, userID int) (token string, err error)
- func (s *Service) HasKarakeepAPIKey(ctx context.Context, userID int) (bool, error)
- func (s *Service) ImportKarakeepBookmarks(ctx context.Context, userID int) (*ImportResult, error)
- func (s *Service) KarakeepBaseURL() string
- func (s *Service) ListAllModels(ctx context.Context) []models.Model
- func (s *Service) ListRecent(ctx context.Context, userID int, filters storage.ListFilters, ...) ([]storage.Video, int, error)
- func (s *Service) ProcessVideo(ctx context.Context, userID int, youtubeID, bookmarkID string, ...) error
- func (s *Service) ProcessVideoAsync(userID int, youtubeID, bookmarkID string)
- func (s *Service) Resummarize(ctx context.Context, userID int, videoID uuid.UUID, ...) error
- func (s *Service) ResummarizeAsync(userID int, videoID uuid.UUID, level, language, provider string) error
- func (s *Service) RetryAllFailed(ctx context.Context, userID int) (int, error)
- func (s *Service) RetryVideo(ctx context.Context, userID int, id uuid.UUID) error
- func (s *Service) Search(ctx context.Context, userID int, query string, limit int) ([]HybridMatch, []string, error)
- func (s *Service) SetKarakeepAPIKey(ctx context.Context, userID int, apiKey string) error
- func (s *Service) SetModelPreference(ctx context.Context, userID int, provider, model string) error
- func (s *Service) SetSummaryPrompt(ctx context.Context, userID int, level, prompt string) error
- func (s *Service) Stats(ctx context.Context, userID int) (*storage.VideoStats, error)
- func (s *Service) TranscribeAllNoCaptions(ctx context.Context, userID int) (int, error)
- func (s *Service) TranscribeVideo(ctx context.Context, userID int, id uuid.UUID) error
- type SummaryPromptsInfo
- type Transcriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HybridMatch ¶
type HybridMatch struct {
ID uuid.UUID `json:"id"`
YouTubeID string `json:"youtube_id"`
Title string `json:"title"`
Channel string `json:"channel"`
Summary string `json:"summary"`
Metadata json.RawMessage `json:"metadata"`
Score float64 `json:"score"`
MatchType string `json:"match_type"`
CreatedAt time.Time `json:"created_at"`
}
HybridMatch is a search result from hybrid (keyword + semantic) search.
type ImportResult ¶
type ImportResult struct {
Total int `json:"total"`
Imported int `json:"imported"`
Skipped int `json:"skipped"`
}
ImportResult holds the result of a Karakeep import.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service contains all business logic for vimmary.
func New ¶
func New( db *storage.DB, summarizers map[string]summary.Summarizer, defaultProvider string, registry *models.Registry, yt *youtube.Client, karakeepBaseURL string, externalURL string, embedder Embedder, transcriber Transcriber, searchCfg config.SearchConfig, summaryCfg config.SummaryConfig, log *slog.Logger, ) *Service
New creates a new Service.
func (*Service) AvailableProviders ¶
AvailableProviders returns the names of all configured summarizer providers.
func (*Service) BackfillMetadata ¶
BackfillMetadata fetches and saves metadata for videos that have an empty title.
func (*Service) DefaultProvider ¶
DefaultProvider returns the name of the default summarizer provider.
func (*Service) DeleteByBookmarkID ¶
DeleteByBookmarkID removes a video by its Karakeep bookmark ID.
func (*Service) DeleteVideo ¶
DeleteVideo removes a video from the database.
func (*Service) GetModelPreference ¶
func (s *Service) GetModelPreference(ctx context.Context, userID int) (provider, model string, err error)
GetModelPreference returns the user's preferred summary model.
func (*Service) GetSummaryPrompts ¶
GetSummaryPrompts returns the user's current and default prompts.
func (*Service) GetWebhookInfo ¶
GetWebhookInfo returns the webhook URL and token for a user.
func (*Service) HasKarakeepAPIKey ¶
HasKarakeepAPIKey returns whether a user has a Karakeep API key set.
func (*Service) ImportKarakeepBookmarks ¶
ImportKarakeepBookmarks imports all YouTube bookmarks from a user's Karakeep account.
func (*Service) KarakeepBaseURL ¶
KarakeepBaseURL returns the configured Karakeep base URL.
func (*Service) ListAllModels ¶
ListAllModels returns available models from all configured providers.
func (*Service) ListRecent ¶
func (s *Service) ListRecent(ctx context.Context, userID int, filters storage.ListFilters, limit, offset int) ([]storage.Video, int, error)
ListRecent returns recent completed videos with optional filters.
func (*Service) ProcessVideo ¶
func (s *Service) ProcessVideo(ctx context.Context, userID int, youtubeID, bookmarkID string, forceVoxtral ...bool) error
ProcessVideo fetches transcript, generates summary, creates embedding, stores in DB, and writes back to Karakeep. If forceVoxtral is true, it skips InnerTube captions and goes straight to audio extraction + Voxtral transcription.
func (*Service) ProcessVideoAsync ¶
ProcessVideoAsync enqueues a video for background processing. All jobs go through a single rate-limited worker to avoid YouTube 429s.
func (*Service) Resummarize ¶
func (s *Service) Resummarize(ctx context.Context, userID int, videoID uuid.UUID, level, language, provider string) error
Resummarize regenerates the summary for a video with a new detail level.
func (*Service) ResummarizeAsync ¶
func (s *Service) ResummarizeAsync(userID int, videoID uuid.UUID, level, language, provider string) error
ResummarizeAsync starts resummarization in a background goroutine.
func (*Service) RetryAllFailed ¶
RetryAllFailed resets all failed videos for a user and re-enqueues them.
func (*Service) RetryVideo ¶
RetryVideo resets a failed video and re-processes it.
func (*Service) Search ¶
func (s *Service) Search(ctx context.Context, userID int, query string, limit int) ([]HybridMatch, []string, error)
Search runs hybrid (keyword + semantic) search with RRF merging.
func (*Service) SetKarakeepAPIKey ¶
SetKarakeepAPIKey stores a Karakeep API key for a user.
func (*Service) SetModelPreference ¶
SetModelPreference sets the user's preferred summary model.
func (*Service) SetSummaryPrompt ¶
SetSummaryPrompt sets a custom prompt for the given level. Empty string resets to default.
func (*Service) TranscribeAllNoCaptions ¶
TranscribeAllNoCaptions queues all no_captions videos for Voxtral audio transcription.