resolver

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CivitaiBaseForTest

func CivitaiBaseForTest() string

CivitaiBaseForTest returns the current base for tests.

func ClearCache

func ClearCache(cfg *config.Config) error

ClearCache removes all resolver cache entries.

func SetCivitaiBaseForTest

func SetCivitaiBaseForTest(u string)

SetCivitaiBaseForTest overrides the base URL for CivitAI API (tests only).

Types

type CivitAI

type CivitAI struct{}

func (*CivitAI) CanHandle

func (c *CivitAI) CanHandle(u string) bool

func (*CivitAI) Resolve

func (c *CivitAI) Resolve(ctx context.Context, uri string, cfg *config.Config) (*Resolved, error)

civitai://model/{id}?version={versionId}&file={substring}

type HuggingFace

type HuggingFace struct{}

func (*HuggingFace) CanHandle

func (h *HuggingFace) CanHandle(u string) bool

Accepts URIs of the form:

hf://{owner}/{repo}/{path}?rev=main

If rev is omitted, defaults to "main".

func (*HuggingFace) Resolve

func (h *HuggingFace) Resolve(ctx context.Context, uri string, cfg *config.Config) (*Resolved, error)

type Resolved

type Resolved struct {
	URL     string
	Headers map[string]string
	// Optional metadata (primarily for CivitAI) — may be empty for other resolvers
	ModelName         string
	VersionName       string
	VersionID         string
	FileName          string
	FileType          string // Source-specific type (e.g., CivitAI file.type: Model|VAE|TextualInversion)
	SuggestedFilename string
	// Optional metadata for Hugging Face
	RepoOwner string
	RepoName  string
	RepoPath  string
	Rev       string
}

func Resolve

func Resolve(ctx context.Context, uri string, cfg *config.Config) (*Resolved, error)

type Resolver

type Resolver interface {
	CanHandle(uri string) bool
	Resolve(ctx context.Context, uri string, cfg *config.Config) (*Resolved, error)
}

Jump to

Keyboard shortcuts

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