sync: migrate ai-operator to Gitea (2026-08-10)
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package kb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Document struct {
|
||||
ID, ExternalID, Title, Language, RegionCode, Category, SourceType, SourceURI, SourceHash, Status string
|
||||
Content, Question, ShortAnswer, FullAnswer, Source string
|
||||
Keywords []string
|
||||
Metadata map[string]any
|
||||
ValidFrom, ValidTo *time.Time
|
||||
Priority int
|
||||
}
|
||||
|
||||
type Chunk struct {
|
||||
ID, DocumentID string
|
||||
ChunkIndex int
|
||||
Language, RegionCode, Title, Content, ContentHash string
|
||||
TokenEstimate, CharCount int
|
||||
Embedding []float32
|
||||
EmbeddingModel, EmbeddingProvider string
|
||||
Metadata map[string]any
|
||||
}
|
||||
|
||||
type SearchRequest struct {
|
||||
Query, Language, RegionCode, CallID string
|
||||
Limit int
|
||||
MinScore float64
|
||||
IncludeGlobal bool
|
||||
CrossLanguageFallback bool
|
||||
}
|
||||
type Citation struct{ DocumentTitle, SourceURI, ChunkID, RegionCode, Language, Source string }
|
||||
type SearchResult struct {
|
||||
DocumentID, ChunkID, Title, Content, Language, SourceLanguage, RegionCode, Category, SourceURI string
|
||||
Score, VectorScore, KeywordScore float64
|
||||
CrossLanguageFallback bool
|
||||
Metadata map[string]any
|
||||
Citation Citation
|
||||
}
|
||||
type IngestResult struct {
|
||||
DocsSeen, DocsIngested, ChunksCreated, Skipped int
|
||||
Errors []string
|
||||
}
|
||||
type Health struct {
|
||||
DBReachable, VectorExtension, MigrationsApplied bool
|
||||
Documents, Chunks int
|
||||
}
|
||||
|
||||
type Repository interface {
|
||||
Health(ctx context.Context) (Health, error)
|
||||
UpsertDocument(ctx context.Context, doc Document, chunks []Chunk) error
|
||||
Search(ctx context.Context, req SearchRequest, queryEmbedding []float32) ([]SearchResult, error)
|
||||
}
|
||||
Reference in New Issue
Block a user