feat: extend EmbeddingService and RAGService interfaces for .so plugins
Add EmbedContent/IsAvailable to EmbeddingService and RegisterContentFetcher/OnContentChanged to RAGService so .so plugins can use embedding and RAG capabilities through SDK interfaces instead of type-asserting CMS concrete types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3753210c2d
commit
d270bc8582
@ -12,6 +12,7 @@ import (
|
|||||||
"git.dev.alexdunmow.com/block/core/menus"
|
"git.dev.alexdunmow.com/block/core/menus"
|
||||||
"git.dev.alexdunmow.com/block/core/settings"
|
"git.dev.alexdunmow.com/block/core/settings"
|
||||||
"git.dev.alexdunmow.com/block/core/subscriptions"
|
"git.dev.alexdunmow.com/block/core/subscriptions"
|
||||||
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ServiceDeps provides dependencies that plugins need for RPC service handlers.
|
// ServiceDeps provides dependencies that plugins need for RPC service handlers.
|
||||||
@ -59,11 +60,19 @@ type JobRunner interface {
|
|||||||
// EmbeddingService generates and manages text embeddings.
|
// EmbeddingService generates and manages text embeddings.
|
||||||
type EmbeddingService interface {
|
type EmbeddingService interface {
|
||||||
GenerateEmbedding(ctx context.Context, text string) ([]float32, error)
|
GenerateEmbedding(ctx context.Context, text string) ([]float32, error)
|
||||||
|
EmbedContent(ctx context.Context, sourceType string, sourceID uuid.UUID, text string) (bool, error)
|
||||||
|
IsAvailable() bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ContentFetcher retrieves the title and full text for a content item so the
|
||||||
|
// RAG service can re-index it after changes. Plugins register one per content type.
|
||||||
|
type ContentFetcher func(ctx context.Context, contentID uuid.UUID) (title string, text string, err error)
|
||||||
|
|
||||||
// RAGService provides retrieval-augmented generation for AI agents.
|
// RAGService provides retrieval-augmented generation for AI agents.
|
||||||
type RAGService interface {
|
type RAGService interface {
|
||||||
Query(ctx context.Context, query string, limit int) ([]RAGResult, error)
|
Query(ctx context.Context, query string, limit int) ([]RAGResult, error)
|
||||||
|
RegisterContentFetcher(contentType string, fetcher ContentFetcher)
|
||||||
|
OnContentChanged(ctx context.Context, contentType string, contentID uuid.UUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RAGResult is a single result from a RAG query.
|
// RAGResult is a single result from a RAG query.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user