conf

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Exists

func Exists(cpPath string) bool

func GenerateAndUpdateConfigFile

func GenerateAndUpdateConfigFile(cpRepoPath string, multiAddress, nodeName string, port int) error

func GetInferenceApiKey

func GetInferenceApiKey(cpRepoPath string) string

GetInferenceApiKey returns the configured Inference API key

func InitConfig

func InitConfig(cpRepoPath string, standalone bool) error

func LoadModelsJson

func LoadModelsJson(cpRepoPath string) (map[string]ModelConfig, error)

LoadModelsJson loads the models.json file

func UpdateInferenceConfig

func UpdateInferenceConfig(cpRepoPath, apiKey string, models []string) error

UpdateInferenceConfig updates the Inference section in config.toml

func WriteModelsJson

func WriteModelsJson(cpRepoPath string, models map[string]ModelConfig) error

WriteModelsJson writes the models.json file from model configurations

Types

type API

type API struct {
	Port                          int
	MultiAddress                  string
	Domain                        string
	NodeName                      string
	Pricing                       Pricing  `toml:"pricing"`
	AutoDeleteImage               bool     `toml:"AutoDeleteImage"`
	ClearLogDuration              int      `toml:"ClearLogDuration"`
	PortRange                     []string `toml:"PortRange"`
	GpuUtilizationRejectThreshold float64  `toml:"GpuUtilizationRejectThreshold"`
}

type ComputeNode

type ComputeNode struct {
	API       API
	RPC       RPC       `toml:"RPC,omitempty"`
	Inference Inference `toml:"Inference,omitempty"`
}

ComputeNode is a compute node config

func GetConfig

func GetConfig() *ComputeNode

type Inference

type Inference struct {
	Enable       bool     `toml:"Enable"`
	ServiceURL   string   `toml:"ServiceURL"`   // HTTP API URL (e.g., http://localhost:8080)
	WebSocketURL string   `toml:"WebSocketURL"` // WebSocket URL (e.g., wss://inference-ws.swanchain.io)
	ApiKey       string   `toml:"ApiKey"`       // Provider API key for authentication (sk-prov-*)
	Models       []string `toml:"Models"`       // Models this provider serves
}

Inference is the Swan Inference marketplace configuration (default mode)

type ModelConfig

type ModelConfig struct {
	Container  string `json:"container,omitempty"`
	Endpoint   string `json:"endpoint"`
	GPUMemory  int    `json:"gpu_memory"`
	Category   string `json:"category"`
	LocalModel string `json:"local_model,omitempty"`
}

ModelConfig represents a model configuration for models.json

type Pricing

type Pricing bool

func (*Pricing) UnmarshalTOML

func (p *Pricing) UnmarshalTOML(data interface{}) error

type RPC

type RPC struct {
	SwanChainRpc string `toml:"SWAN_CHAIN_RPC"`
}

Jump to

Keyboard shortcuts

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