domain

package
v0.0.0-...-e1cdcfb Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCacheDir is the default directory for the cache dir.
	DefaultCacheDir = "."
	// DefaultCacheFileName is the default name of the cache file.
	DefaultCacheFileName = "openapi_cache.json"
	// DefaultOpenAPIDirName is the default name of the openapi file dir.
	DefaultOpenAPIDirName = "openapi"
)
View Source
const (
	AiPluginURLPath = "/.well-known/ai-plugin.json"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAPICacheEntry

type OpenAPICacheEntry struct {
	ETag         string `json:"eTag,omitempty"`
	LastModified string `json:"lastModified,omitempty"`
	APIFilePath  string `json:"apiFileName,omitempty"`
}

type OpenAPICacheInterface

type OpenAPICacheInterface interface {
	// Get returns the OpenAPICacheEntry for the given url if it exists in the cache.
	Get(key string) (OpenAPICacheEntry, bool)
	// Set adds or updates the given entry for the given url in the cache.
	Set(key string, entry OpenAPICacheEntry) error
	// IsNotExpires check cache is expires
	IsNotExpires(key, etag, lastModified string) bool
	// Key returns the cache key for the given apiUrl.
	Key(apiURL string) string
}

func NewOpenAPICache

func NewOpenAPICache(dir, fileName string) OpenAPICacheInterface

type Plugin

type Plugin struct {
	PluginInfra db.PluginInfraInterface
}

func NewPlugin

func NewPlugin(mysqlConf *config.MysqlOptions) (*Plugin, error)

func (*Plugin) AddPlugin

func (p *Plugin) AddPlugin(ctx context.Context, plugin *model.Plugin) error

func (*Plugin) CheckExist

func (p *Plugin) CheckExist(ctx context.Context, name string) bool

func (*Plugin) FetchAiPluginInfo

func (p *Plugin) FetchAiPluginInfo(aiPluginURL string) (model.AiPlugin, error)

func (*Plugin) GeneratePluginModel

func (p *Plugin) GeneratePluginModel(ctx context.Context, domain, label string, ai model.AiPlugin) model.Plugin

func (*Plugin) GeneratePluginURL

func (p *Plugin) GeneratePluginURL(ctx context.Context, domain string) string

func (*Plugin) ListPluginByFuzzyName

func (p *Plugin) ListPluginByFuzzyName(ctx context.Context, fuzzyName, sortFieldName string, orderBy types.OrderBy, page *types.Page) ([]*model.Plugin, error)

func (*Plugin) UpdatePluginScoreAndHeat

func (p *Plugin) UpdatePluginScoreAndHeat(ctx context.Context, ID, heat int32, score float64) error

type PluginMetadata

type PluginMetadata struct {
	PluginMetadataInfra db.PluginMetadataInfraInterface
}

func NewPluginMetadata

func NewPluginMetadata(mysqlConf *config.MysqlOptions) (*PluginMetadata, error)

func (*PluginMetadata) AddPluginMetadata

func (p *PluginMetadata) AddPluginMetadata(ctx context.Context, metadata model.PluginMetadata) error

func (*PluginMetadata) GeneratePluginMetadata

func (p *PluginMetadata) GeneratePluginMetadata(ctx context.Context, pluginID int, pluginURL string) model.PluginMetadata

func (*PluginMetadata) UpdatePluginMetadata

func (p *PluginMetadata) UpdatePluginMetadata(ctx context.Context, metadata model.PluginMetadata) error

type PluginScore

type PluginScore struct {
	PluginScoreInfra db.PluginScoreInfraInterface
}

func NewPluginScore

func NewPluginScore(mysqlConf *config.MysqlOptions) (*PluginScore, error)

func (*PluginScore) AddPluginScore

func (p *PluginScore) AddPluginScore(ctx context.Context, score model.PluginScore) error

func (*PluginScore) CalculateRating

func (p *PluginScore) CalculateRating(ctx context.Context, scores []float64) model.Rating

func (*PluginScore) ListPluginScoreByID

func (p *PluginScore) ListPluginScoreByID(ctx context.Context, pluginID int) ([]*model.PluginScore, error)

Jump to

Keyboard shortcuts

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