Documentation
¶
Index ¶
- Variables
- func ExtractQuantization(filename string) string
- func ParseCivitAIModelID(url string) (string, error)
- func ParseCivitAIVersionID(url string) (int64, error)
- type CivitAIFetcher
- func (f *CivitAIFetcher) CanHandle(url string) bool
- func (f *CivitAIFetcher) CheckConnectivity(ctx context.Context) error
- func (f *CivitAIFetcher) FetchMetadata(ctx context.Context, url string) (*state.ModelMetadata, error)
- func (f *CivitAIFetcher) SetAPIKey(key string)
- func (f *CivitAIFetcher) Source() string
- func (f *CivitAIFetcher) ValidateAPIKey(ctx context.Context, apiKey string) error
- type Fetcher
- type HuggingFaceFetcher
- type ModelScopeFetcher
- type OllamaFetcher
- type Registry
Constants ¶
This section is empty.
Variables ¶
var ErrResponseTooLarge = errors.New("response body exceeded maximum size")
ErrResponseTooLarge is returned by readBoundedBody when the response body exceeds the configured limit. Callers can branch on this to surface a distinct error or fall back to basic metadata, rather than mistaking truncated JSON for a parse failure.
Functions ¶
func ExtractQuantization ¶
ExtractQuantization extracts quantization info from filename (exported for scanner)
func ParseCivitAIModelID ¶
ParseModelIDFromURL extracts the model ID from a CivitAI URL
func ParseCivitAIVersionID ¶
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 ModelScopeFetcher ¶ added in v0.7.1
type ModelScopeFetcher struct {
// contains filtered or unexported fields
}
func NewModelScopeFetcher ¶ added in v0.7.1
func NewModelScopeFetcher(client *http.Client) *ModelScopeFetcher
func (*ModelScopeFetcher) CanHandle ¶ added in v0.7.1
func (f *ModelScopeFetcher) CanHandle(rawURL string) bool
func (*ModelScopeFetcher) FetchMetadata ¶ added in v0.7.1
func (f *ModelScopeFetcher) FetchMetadata(ctx context.Context, rawURL string) (*state.ModelMetadata, error)
func (*ModelScopeFetcher) Source ¶ added in v0.7.1
func (f *ModelScopeFetcher) Source() string
type OllamaFetcher ¶ added in v0.7.1
type OllamaFetcher struct {
// contains filtered or unexported fields
}
func NewOllamaFetcher ¶ added in v0.7.1
func NewOllamaFetcher(client *http.Client) *OllamaFetcher
func (*OllamaFetcher) CanHandle ¶ added in v0.7.1
func (f *OllamaFetcher) CanHandle(rawURL string) bool
func (*OllamaFetcher) FetchMetadata ¶ added in v0.7.1
func (f *OllamaFetcher) FetchMetadata(ctx context.Context, rawURL string) (*state.ModelMetadata, error)
func (*OllamaFetcher) Source ¶ added in v0.7.1
func (f *OllamaFetcher) 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 ¶
CanHandle returns true if any registered fetcher can handle the given URL
func (*Registry) FetchMetadata ¶
FetchMetadata attempts to fetch metadata using the appropriate fetcher