services

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisServer

type AnalysisServer struct {
	protos.UnimplementedAnalysisServiceServer
}

AnalysisServer implements the AnalysisService gRPC service

func NewAnalysisServer

func NewAnalysisServer() *AnalysisServer

NewAnalysisServer creates a new Analysis server instance

func (*AnalysisServer) GetAllArticleAnalyses

GetAllArticleAnalyses retrieves all analysis results for a specific article

type ArticleServer

type ArticleServer struct {
	protos.UnimplementedArticleServiceServer
}

ArticleServer implements the ArticleService gRPC service

func NewArticleServer

func NewArticleServer() *ArticleServer

NewArticleServer creates a new article server instance

func (*ArticleServer) GetArticle

GetArticle implements the GetArticle RPC method

func (*ArticleServer) GetArticleCounts

func (s *ArticleServer) GetArticleCounts(_ context.Context, filter *protos.ArticleFilter) (*protos.ArticleCountsResponse, error)

func (*ArticleServer) ListArticles

ListArticles implements the ListArticles RPC method

func (*ArticleServer) MarkFeedArticlesRead

func (s *ArticleServer) MarkFeedArticlesRead(_ context.Context, req *protos.MarkFeedReadRequest) (*emptypb.Empty, error)

func (*ArticleServer) UpdateArticle

UpdateArticle implements the UpdateArticle RPC method

type AutoConfigResult added in v0.2.0

type AutoConfigResult struct {
	ConfigYAML string
	Summary    string
	Confidence float64
}

AutoConfigResult is the agent's final output.

type CategoriesServer

type CategoriesServer struct {
	protos.UnimplementedCategoriesServiceServer
}

CategoriesServer implements the CategoriesService gRPC service

func NewCategoriesServer

func NewCategoriesServer() *CategoriesServer

NewCategoriesServer creates a new Categories server instance

func (*CategoriesServer) GetOrCreateCategory

GetOrCreateCategory implements the CategoriesService gRPC service

type DigestServer

type DigestServer struct {
	protos.UnimplementedDigestServiceServer
	// contains filtered or unexported fields
}

DigestServer implements the DigestService gRPC service

func NewDigestServer

func NewDigestServer(gw *llmgateway.Gateway, llms *LLMsServer) *DigestServer

NewDigestServer creates a new Digest server instance. The gateway is the single chokepoint for LLM calls (dedupe, summary, article analysis during ensureArticlesAnalyzed); llms is reused so we don't re-construct an LLMsServer on every digest.

func (*DigestServer) GenerateDigest

GenerateDigest generates a new digest, streaming progress events throughout the process

func (*DigestServer) GetDigest

GetDigest returns a single digest by Id

func (*DigestServer) GetDigestArticles

GetDigestArticles returns articles for a digest

func (*DigestServer) ListDigests

ListDigests retrieves all digests

type FeedsServer

type FeedsServer struct {
	protos.UnimplementedFeedsServiceServer
	// contains filtered or unexported fields
}

FeedsServer implements the FeedsService gRPC service

func NewFeedsServer

func NewFeedsServer(queue *QueueServer, gw *llmgateway.Gateway) *FeedsServer

NewFeedsServer creates a new feeds server instance. gw powers AutoBuildFeed and may be nil when no LLM gateway is available (autobuild will then error).

func (*FeedsServer) ApplyFeeds

ApplyFeeds reconciles the stored feeds to match the desired set in the request.

func (*FeedsServer) AutoConfigFeed added in v0.2.0

AutoConfigFeed runs the autonomous LLM agent that discovers a feed's selectors (after probing and locking the scraping mode + headers), streaming each step then the final config.

func (*FeedsServer) DeleteFeed

func (*FeedsServer) DeleteFeeds

DeleteFeeds removes the given feeds (by id) from the database.

func (*FeedsServer) InspectArticle added in v0.2.0

InspectArticle scrapes a single article URL in the requested mode and, when selectors are supplied, returns the extracted content for selector testing.

func (*FeedsServer) InspectFeed added in v0.2.0

InspectFeed probes a feed URL (read-only, pre-registration) and returns its diagnosis plus sample article links for building a feed config.

func (*FeedsServer) ListFeeds

ListFeeds implements the ListFeeds RPC method

func (*FeedsServer) RefreshAllFeeds

func (*FeedsServer) RefreshFeed

func (*FeedsServer) RegisterFeed

func (s *FeedsServer) RegisterFeed(_ context.Context, req *protos.RegisterFeedRequest) (*emptypb.Empty, error)

type LLMRequest

type LLMRequest struct {
	// ProviderName selects an enabled provider by its config Name (highest priority).
	ProviderName string
	// ProviderType selects an enabled provider by type (used when ProviderName is empty).
	ProviderType string
	// Provider is the auto-detect token: it may be a provider type OR a config
	// profile name; the server figures out which. Used by the user-facing
	// --provider flag. Lower priority than the explicit ProviderName/ProviderType
	// fields above (which the internal profile/queue callers set directly).
	Provider  string
	ModelName string // may be "" (use provider default) or "auto"

	// Per-call overrides; nil/zero means inherit from ProviderConfig, then fall
	// back to the package-level defaults above.
	Temperature *float64
	MaxRetries  *int
	Timeout     *time.Duration
	MaxTokens   int
}

LLMRequest describes how to look up and configure a provider for a single call. Zero values mean "use the analysis config default".

type LLMsServer

type LLMsServer struct {
	protos.UnimplementedLLMsServiceServer
	// contains filtered or unexported fields
}

LLMsServer implements the LLMsService gRPC service

func NewLLMsServer

func NewLLMsServer(gw *llmgateway.Gateway) *LLMsServer

NewLLMsServer creates a new LLMs server instance. The gateway is the single chokepoint for every LLM call the server makes; see pkg/llmgateway.

func (*LLMsServer) AnalyzeArticle

AnalyzeArticle analyzes an article using the default model

func (*LLMsServer) AnalyzeArticleOneShot

func (s *LLMsServer) AnalyzeArticleOneShot(ctx context.Context, req *protos.AnalyzeArticleWithProviderModelRequest, onTask func(taskName, status string, taskIndex, totalTasks int, err error)) (*protos.AnalyzeArticleWithProviderModelResponse, error)

func (*LLMsServer) AnalyzeArticleWithProgress

func (s *LLMsServer) AnalyzeArticleWithProgress(ctx context.Context, req *protos.AnalyzeArticleWithProviderModelRequest, onTask func(taskName, status string, taskIndex, totalTasks int, err error)) (*protos.AnalyzeArticleWithProviderModelResponse, error)

AnalyzeArticleWithProgress is like AnalyzeArticleWithProviderModel but invokes the provided callback for each pipeline task start/completion so callers can forward progress events.

func (*LLMsServer) AnalyzeArticleWithProviderModel

AnalyzeArticleWithProviderModel analyzes an article using sequential Eino ChatModelAgent calls.

func (*LLMsServer) GetAnalysisConfig

GetAnalysisConfig returns the current analysis configuration

func (*LLMsServer) GetAvailableModels

GetAvailableModels fetches available models from all configured providers concurrently.

func (*LLMsServer) GetLLMProviders

GetLLMProviders returns the current LLM provider configurations

func (*LLMsServer) PreviewAnalysisPrompt

PreviewAnalysisPrompt builds the prompt for an article without sending it to an LLM

func (*LLMsServer) ResolveLLM added in v0.2.0

ResolveLLM resolves a provider/model selection to the concrete provider type and model name a run would use, via the same path the actual calls take.

func (*LLMsServer) SaveLLMProviders

func (s *LLMsServer) SaveLLMProviders(_ context.Context, req *protos.SaveLLMProvidersRequest) (*emptypb.Empty, error)

SaveLLMProviders updates the LLM provider configurations

func (*LLMsServer) StreamAnalyzeArticle

StreamAnalyzeArticle is the streaming version that sends progress events per task.

type QueueServer

type QueueServer struct {
	protos.UnimplementedQueueServiceServer
	// contains filtered or unexported fields
}

QueueServer implements the server-side analysis queue.

Concurrency model: the LLM-call cap lives in the Gateway (which llms uses internally). QueueServer keeps its own `workerSem` only to bound how many goroutines it spawns from a large backlog, not to bound LLM calls. That budget is auto-derived from maxConcurrentLLMRequests (4× with a floor of 4) so a 10k-article backlog does not spawn 10k parked goroutines.

func NewQueueServer

func NewQueueServer(llms *LLMsServer, maxConcurrentLLMRequests int) *QueueServer

NewQueueServer creates a new QueueServer with a reference to the LLMs service. The optional maxConcurrentLLMRequests seeds the queue's worker fan-out budget (not the LLM-call cap, which lives in the Gateway).

func (*QueueServer) ClearQueue

func (s *QueueServer) ClearQueue(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error)

func (*QueueServer) DequeueArticle

func (s *QueueServer) DequeueArticle(_ context.Context, req *protos.DequeueArticleRequest) (*emptypb.Empty, error)

func (*QueueServer) EnqueueArticles

func (*QueueServer) StartQueue

func (s *QueueServer) StartQueue(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error)

func (*QueueServer) StopQueue

func (s *QueueServer) StopQueue(_ context.Context, _ *emptypb.Empty) (*emptypb.Empty, error)

func (*QueueServer) StreamQueueProgress

func (s *QueueServer) StreamQueueProgress(_ *emptypb.Empty, stream protos.QueueService_StreamQueueProgressServer) error

type ResolvedLLM

type ResolvedLLM struct {
	Provider     llmprovider.ChatModelProvider
	ProviderType string
	ModelName    string
	Timeout      time.Duration
	MaxRetries   int
}

ResolvedLLM bundles a ready-to-use provider with the resolved identifiers.

func ResolveLLM

func ResolveLLM(req LLMRequest) (*ResolvedLLM, error)

ResolveLLM performs provider lookup, "auto" model resolution, default application, and provider construction in one place.

type ServerConfigServer

type ServerConfigServer struct {
	protos.UnimplementedServerConfigServiceServer
}

ServerConfigServer implements the ServerConfigService gRPC service

func NewServerConfigServer

func NewServerConfigServer() *ServerConfigServer

NewServerConfigServer creates a new ServerConfig server instance

func (*ServerConfigServer) GetConfig

ServerConfigServer implements the ServerConfigService gRPC service

func (*ServerConfigServer) SaveConfig

ServerConfigServer implements the ServerConfigService gRPC service

func (*ServerConfigServer) UpdateAnalysisConfig

UpdateAnalysisConfig updates the analysis configuration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL