config

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodexAuthProvider   = "codex"
	CopilotAuthProvider = "copilot"
)

Variables

View Source
var Debug = false

Functions

func ClearModelProvider added in v0.2.0

func ClearModelProvider(baseURL string) error

func ConfigExists added in v0.2.0

func ConfigExists() bool

func CreateConfig added in v0.2.0

func CreateConfig(providerNames []string, keys map[string]string, baseUrls map[string]string, models map[string][]string) error

CreateConfig writes a fresh config.json containing only the chosen providers, filling in any API keys collected during onboarding. This is the only place that materializes config.json reads no longer create it.

func CustomizationPath

func CustomizationPath() (string, error)

CustomizationPath returns the config.json path. It no longer creates the file — onboarding owns creation (see CreateConfig).

func DBPath

func DBPath() string

func DefaultCodexModels added in v0.2.0

func DefaultCodexModels() []string

func DeleteAuthVal added in v0.2.0

func DeleteAuthVal(provider string) error

func Dir

func Dir() string

func GetAuthPath added in v0.2.0

func GetAuthPath() (string, error)

func GetModels

func GetModels() ([]ResModel, []RecentModels, error)

func GetOllamaModels added in v0.2.1

func GetOllamaModels(url string) ([]string, error)

func GetTheme

func GetTheme() string

func HasAnyApiKey added in v0.2.0

func HasAnyApiKey() bool

func HasAnyAuthModel added in v0.2.0

func HasAnyAuthModel() bool

func ImportCodexAuth added in v0.2.0

func ImportCodexAuth() error

func ImportCodexAuthFromPath added in v0.2.0

func ImportCodexAuthFromPath(path string) error

func IsReasoningEffort added in v0.2.0

func IsReasoningEffort(effort string) bool

func ReconcileAuthProviderModels added in v0.2.0

func ReconcileAuthProviderModels(baseURL string, models []string) error

func SetApiKey added in v0.1.8

func SetApiKey(m ResModel, apikey string) error

func SetCurrentModel

func SetCurrentModel(model ResModel) error

func SetReasoningEffort added in v0.2.0

func SetReasoningEffort(effort string) error

func SetTheme

func SetTheme(theme string) error

func SkillsPath

func SkillsPath() string

func SupportsReasoningEffort added in v0.2.0

func SupportsReasoningEffort(model ResModel) bool

func UpdateAuthVal added in v0.2.0

func UpdateAuthVal(provider string, newVal AuthVal) error

func UpdateModelsForProvider added in v1.2.3

func UpdateModelsForProvider(baseURL string, models []string, apiKey string) error

func ValidateProviderKey added in v0.2.0

func ValidateProviderKey(providerName, apiKey string) error

ValidateProviderKey makes a minimal chat-completion request (max_tokens: 1) to the given provider to confirm the API key is accepted. It returns nil if the request succeeds. A short timeout keeps onboarding responsive.

Types

type AllModels added in v0.1.8

type AllModels struct {
	Models       []ResModel
	RecentModels []RecentModels
}

type AuthJson added in v0.2.0

type AuthJson map[string]AuthVal

type AuthVal added in v0.2.0

type AuthVal struct {
	Type      string   `json:"type"`
	Access    string   `json:"access_token"`
	Refresh   string   `json:"refresh_token"`
	Expires   int64    `json:"expires"`
	AccountId string   `json:"account_id"`
	Models    []string `json:"models"`
}

func GetAuthVal added in v0.2.0

func GetAuthVal(provider string) (AuthVal, error)

func ReadCodexAuth added in v0.2.0

func ReadCodexAuth(path string) (AuthVal, error)

type Customization

type Customization struct {
	SkillsPath   string         `json:"skills_path"`
	Port         string         `json:"port"`
	Theme        string         `json:"theme"`
	Providers    []Provider     `json:"providers"`
	CurrentModel ResModel       `json:"current_model"`
	RecentModels []RecentModels `json:"recent_models"`
}

```bash OPENAI_API_KEY=sk-... OPENAI_BASE_URL=https://... SKILL_PATH=path/to/skill/folder API_URL=http://localhost:8080 ```

func GetCustomization

func GetCustomization() Customization

type OllamaModelsResponse added in v0.2.1

type OllamaModelsResponse struct {
	Models []struct {
		Name  string `json:"name"`
		Model string `json:"model"`
	}
}

{"models":[{"name":"qwen3.5:0.8b","model":"qwen3.5:0.8b","modified_at":"2026-06-14T20:56:47.031182497+05:30","size":1036046583,"digest":"f3817196d142eaf72ce79dfebe53dcb20bd21da87ce13e138a8f8e10a866b3a4","details":{"parent_model":"","format":"gguf","family":"qwen35","families":["qwen35"],"parameter_size":"873.44M","quantization_level":"Q8_0"}}]}

type Provider

type Provider struct {
	BaseUrl string   `json:"base_url"`
	ApiKey  string   `json:"api_key"`
	Models  []string `json:"models"`
}

func AllProviders added in v0.2.0

func AllProviders() []Provider

Providers displayed in onboarding

func ProviderByName added in v0.2.0

func ProviderByName(name string) (Provider, bool)

func (Provider) Name added in v0.2.0

func (p Provider) Name() string

type RecentModels added in v0.1.8

type RecentModels struct {
	Model           string `json:"model"`
	ApiKey          string `json:"api_key"`
	BaseUrl         string `json:"base_url"`
	ReasoningEffort string `json:"reasoning_effort,omitempty"`
	LastUsed        int64  `json:"last_used"`
}

func GetRecentModels added in v0.1.8

func GetRecentModels() []RecentModels

type ResModel

type ResModel struct {
	Model           string `json:"model"`
	ApiKey          string `json:"api_key"`
	BaseUrl         string `json:"base_url"`
	ReasoningEffort string `json:"reasoning_effort,omitempty"`
}

func GetAllAuthModels added in v0.2.0

func GetAllAuthModels() ([]ResModel, error)

func GetCurrentModel

func GetCurrentModel() (ResModel, error)

Jump to

Keyboard shortcuts

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