metadata

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractQuantization

func ExtractQuantization(filename string) string

ExtractQuantization extracts quantization info from filename (exported for scanner)

func ParseCivitAIModelID

func ParseCivitAIModelID(url string) (string, error)

ParseModelIDFromURL extracts the model ID from a CivitAI URL

func ParseCivitAIVersionID

func ParseCivitAIVersionID(url string) (int64, error)

GetModelVersionID extracts version ID from download URLs like /api/download/models/{versionId}

Types

type CivitAIFetcher

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

CivitAIFetcher fetches metadata from CivitAI

func NewCivitAIFetcher

func NewCivitAIFetcher(client *http.Client) *CivitAIFetcher

NewCivitAIFetcher creates a new CivitAI metadata fetcher

func (*CivitAIFetcher) CanHandle

func (f *CivitAIFetcher) CanHandle(url string) bool

func (*CivitAIFetcher) CheckConnectivity

func (f *CivitAIFetcher) CheckConnectivity(ctx context.Context) error

CheckConnectivity tests if CivitAI is accessible (useful for VPN detection)

func (*CivitAIFetcher) FetchMetadata

func (f *CivitAIFetcher) FetchMetadata(ctx context.Context, url string) (*state.ModelMetadata, error)

func (*CivitAIFetcher) SetAPIKey

func (f *CivitAIFetcher) SetAPIKey(key string)

SetAPIKey sets the CivitAI API key for authenticated requests

func (*CivitAIFetcher) Source

func (f *CivitAIFetcher) Source() string

func (*CivitAIFetcher) ValidateAPIKey

func (f *CivitAIFetcher) ValidateAPIKey(ctx context.Context, apiKey string) error

ValidateAPIKey checks if the provided API key is valid

type Fetcher

type Fetcher interface {
	// CanHandle returns true if this fetcher can handle the given URL
	CanHandle(url string) bool

	// FetchMetadata retrieves metadata for the given URL
	FetchMetadata(ctx context.Context, url string) (*state.ModelMetadata, error)

	// Source returns the name of this metadata source
	Source() string
}

Fetcher is the interface for fetching model metadata from various sources

type HuggingFaceFetcher

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

HuggingFaceFetcher fetches metadata from HuggingFace

func NewHuggingFaceFetcher

func NewHuggingFaceFetcher(client *http.Client) *HuggingFaceFetcher

NewHuggingFaceFetcher creates a new HuggingFace metadata fetcher

func (*HuggingFaceFetcher) CanHandle

func (f *HuggingFaceFetcher) CanHandle(url string) bool

func (*HuggingFaceFetcher) FetchMetadata

func (f *HuggingFaceFetcher) FetchMetadata(ctx context.Context, url string) (*state.ModelMetadata, error)

func (*HuggingFaceFetcher) Source

func (f *HuggingFaceFetcher) Source() string

type Registry

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

Registry holds all available metadata fetchers

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new fetcher registry with default fetchers

func (*Registry) CanHandle

func (r *Registry) CanHandle(url string) bool

CanHandle returns true if any registered fetcher can handle the given URL

func (*Registry) FetchMetadata

func (r *Registry) FetchMetadata(ctx context.Context, url string) (*state.ModelMetadata, error)

FetchMetadata attempts to fetch metadata using the appropriate fetcher

func (*Registry) Register

func (r *Registry) Register(f Fetcher)

Register adds a fetcher to the registry

Jump to

Keyboard shortcuts

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