ai

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package ai provides AI integration services for content moderation and assistance

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSaveAnalysis is returned when AI analysis saving fails
	ErrSaveAnalysis = errors.New("failed to save AI analysis")
)

Error constants for AI service

Functions

This section is empty.

Types

type AnalysisEvent

type AnalysisEvent struct {
	ID                   string
	ObjectID             string
	ObjectType           string
	AnalysisType         string
	Results              map[string]interface{}
	Confidence           float64
	ModelVersion         string
	ProcessedAt          time.Time
	ModerationAction     string
	ModerationConfidence float64
	ModerationReason     string
}

AnalysisEvent represents an AI analysis event for subscriptions

type GetAnalysisQuery

type GetAnalysisQuery struct {
	ObjectID string
}

GetAnalysisQuery contains parameters for getting AI analysis

type GetAnalysisResult

type GetAnalysisResult struct {
	Analysis *ai.AIAnalysis
	Events   []*streaming.Event
}

GetAnalysisResult contains the result of getting AI analysis

type GetStatsQuery

type GetStatsQuery struct {
	Period string // "day", "week", "month"
}

GetStatsQuery contains parameters for getting AI stats

type GetStatsResult

type GetStatsResult struct {
	Stats  interface{}
	Events []*streaming.Event
}

GetStatsResult contains the result of getting AI stats

type QueueAnalysisCommand

type QueueAnalysisCommand struct {
	ObjectID   string
	ObjectType string
	Force      bool
}

QueueAnalysisCommand contains parameters for queuing AI analysis

type QueueAnalysisResult

type QueueAnalysisResult struct {
	Queued bool
	Events []*streaming.Event
}

QueueAnalysisResult contains the result of queuing AI analysis

type SaveAnalysisCommand

type SaveAnalysisCommand struct {
	Analysis *ai.AIAnalysis
	UserID   string // User context for event publishing
}

SaveAnalysisCommand contains the AI analysis to save

type SaveAnalysisResult

type SaveAnalysisResult struct {
	Success bool
	Events  []*streaming.Event
}

SaveAnalysisResult contains the result of saving an analysis

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides AI analysis operations following the service-first architecture

func NewService

func NewService(storage core.RepositoryStorage, publisher streaming.Publisher, logger *zap.Logger) *Service

NewService creates a new AI service

func (*Service) ConvertToModel

func (s *Service) ConvertToModel(analysis *ai.AIAnalysis) *models.AIAnalysis

ConvertToModel converts an AI analysis to a DynamORM model

func (*Service) GetAnalysis

func (s *Service) GetAnalysis(ctx context.Context, query *GetAnalysisQuery) (*GetAnalysisResult, error)

GetAnalysis retrieves AI analysis for an object

func (*Service) GetStats

func (s *Service) GetStats(ctx context.Context, query *GetStatsQuery) (*GetStatsResult, error)

GetStats retrieves AI analysis statistics

func (*Service) QueueForAnalysis

func (s *Service) QueueForAnalysis(ctx context.Context, cmd *QueueAnalysisCommand) (*QueueAnalysisResult, error)

QueueForAnalysis queues an object for AI analysis

func (*Service) SaveAnalysis

func (s *Service) SaveAnalysis(ctx context.Context, cmd *SaveAnalysisCommand) (*SaveAnalysisResult, error)

SaveAnalysis saves an AI analysis result and publishes events

func (*Service) SubscribeToAnalysisEvents

func (s *Service) SubscribeToAnalysisEvents(_ context.Context, userID string, objectID *string) (<-chan *AnalysisEvent, error)

SubscribeToAnalysisEvents creates a channel for receiving AI analysis events DEPRECATED: This method is deprecated on Lambda. Use GraphQL subscriptions (SubscribeToAIAnalysis) instead, which properly persists subscriptions in DynamoDB and delivers via stream-router.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a validation error

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface

Jump to

Keyboard shortcuts

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