settings

package
v0.5.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package settings is the user's preferences: one typed, versioned document, persisted as JSON by the store (settings table, key "app"), read by any goroutine, changed through Service.Update, announced with Changed on the core.Bus. Thread C implements Service in M0 and owns the schema; other modules add their section here (a field with a default in Defaults) through C or main.

Not settings: secrets (HF token, API keys) live in the macOS Keychain; window geometry stays with MyGo (WindowOptions.StateKey); editor contents are drafts (core.DraftService).

Imports: nothing internal (Changed satisfies core.Event structurally).

Index

Constants

View Source
const (
	MCPOutputInline = "inline" // audio as base64 in the tool result
	MCPOutputFile   = "file"   // a file in the sandbox, its path in the result
	MCPOutputBoth   = "both"
)

MCP output modes.

View Source
const (
	InboundGreeting = "greeting"
	InboundAgent    = "agent"
)

Inbound modes.

View Source
const (
	DictationToggle = "toggle"
	DictationHold   = "hold"
	OutputPaste     = "paste"
	OutputCopy      = "copy"
	// DefaultShortcut is ⌘⇧Space on macOS.
	DefaultShortcut = "CmdOrCtrl+Shift+Space"
	// MaxVocabulary bounds Dictation.Vocabulary, in characters.
	MaxVocabulary = 1000
)

Dictation modes and outputs.

View Source
const (
	TranscribeFast     = "fast"
	TranscribeAccurate = "accurate"
)

Transcription modes.

View Source
const (
	MediaDownloaded = "download" // the pinned build, downloaded into <data>/tools/ffmpeg
	MediaSystem     = "system"   // Homebrew's or another on the PATH
	MediaCustom     = "custom"   // a file the user chose
)

Media origins.

View Source
const (
	MinSidebarWidth = 170
	MaxSidebarWidth = 320
)

Sidebar width bounds, DIPs at 100 %.

View Source
const DefaultAPIPort = 3901

DefaultAPIPort is the loopback port of a fresh install.

View Source
const DefaultAutoUnload = 30

DefaultAutoUnload is the idle limit of a new install, in minutes (Models.AutoUnload).

View Source
const DefaultCallMinutes = 5

DefaultCallMinutes is a call's default limit.

View Source
const DefaultGatewayPort = 3950

DefaultGatewayPort is the call gateway's default port.

View Source
const Key = "settings:app"

Key is the document the settings are stored under (store.Documents).

View Source
const MaxGreeting = 1000

MaxGreeting is the longest greeting.

View Source
const Version = 2

Version is the schema version Defaults writes. Bump it when a field's meaning changes and migrate older documents in Migrate.

  • 2 (#109): Models.AutoUnload defaults to 30 minutes; a version-1 document's 0 was the old default (the UI could not tell it from a choice), so it becomes 30 once.

Variables

View Source
var ExportFormats = []string{"wav", "m4a", "mp3", "flac", "opus"}

ExportFormats are the formats the dialog writes.

View Source
var ExportLoudness = []string{"", "podcast", "speech", "broadcast"}

ExportLoudness are the loudness targets the dialog offers ("" is off).

View Source
var Scales = []float64{0.9, 1, 1.1, 1.25}

Scales are the UI scales Appearance offers (90, 100, 110 and 125 %).

View Source
var Themes = []string{"system", "light", "dark"}

Themes are the values of Appearance.Theme.

Functions

This section is empty.

Types

type API

type API struct {
	// Enabled starts the server with the app. On by default: it listens
	// on the loopback interface only.
	Enabled bool `json:"enabled"`
	// Port is the loopback port (127.0.0.1). 0 = DefaultAPIPort.
	Port int `json:"port,omitempty"`
	// RequireKey asks every client, local ones too, for the API key
	// (Authorization: Bearer). Off: local clients need none.
	RequireKey bool `json:"requireKey,omitempty"`
	// SharePort is the port LAN sharing listens on (all interfaces). 0 =
	// Port+1. Sharing itself is turned on per session, never saved.
	SharePort int `json:"sharePort,omitempty"`
	// Origins are extra browser origins allowed to call the API
	// ("http://localhost:5173"); the API's own origin always is.
	Origins []string `json:"origins,omitempty"`
	// QueueSeconds is how long a request waits for the engine behind
	// other work before it is answered 503 (Retry-After). 0 = 120.
	QueueSeconds int `json:"queueSeconds,omitempty"`

	// MCP: how tools hand back audio and where they write files.
	MCPOutput string `json:"mcpOutput,omitempty"` // "inline" | "file" | "both"; "" = MCPOutputBoth
	MCPDir    string `json:"mcpDir,omitempty"`    // file sandbox; "" = <data>/mcp
	// Bindings give each agent (MCP client id) its own voice.
	Bindings []APIBinding `json:"bindings,omitempty"`
}

API: the local HTTP server.

func (API) Binding

func (a API) Binding(client string) (APIBinding, bool)

Binding finds the binding of a client id (case-insensitive).

func (API) LANPort

func (a API) LANPort() int

LANPort is the port LAN sharing listens on.

func (API) LoopbackPort

func (a API) LoopbackPort() int

LoopbackPort is the loopback port in use.

func (API) Output

func (a API) Output() string

Output is the MCP output mode in use.

type APIBinding

type APIBinding struct {
	Client string `json:"client"`          // client id: X-AudioSmith-Client header, else the MCP client's name
	Label  string `json:"label,omitempty"` // shown in Settings
	Voice  string `json:"voice,omitempty"` // saved voice id; "" = the default
	Model  string `json:"model,omitempty"` // catalogue id; "" = the default
}

APIBinding is the voice of one agent.

type Appearance

type Appearance struct {
	Theme        string  `json:"theme"`        // "system" | "light" | "dark"
	Scale        float64 `json:"scale"`        // UI scale, 0.9–1.25 (1 = 100 %)
	ReduceMotion bool    `json:"reduceMotion"` // in addition to the system setting
	// M7a (setup.go): the sidebar as icons only, its width in DIPs at 100 %
	// (0 = the default) and the sidebar sections the user closed. (0.3
	// dropped M7a's accent palette: a stored "palette" is ignored, and
	// gone after the next save.)
	Rail           bool     `json:"rail,omitempty"`
	SidebarWidth   float64  `json:"sidebarWidth,omitempty"`
	ClosedSections []string `json:"closedSections,omitempty"`
	// Advanced lists the pages whose 「高级」 section is open ("studio",
	// "story", "audiobook", "dub", "export", "clone").
	Advanced []string `json:"advanced,omitempty"`
}

Appearance: theme and scale.

type AudioExport

type AudioExport struct {
	Format     string   `json:"format,omitempty"`     // "wav", "m4a", "mp3", "flac", "opus"
	Bits       int      `json:"bits,omitempty"`       // WAV and FLAC: 16, 24, 32 (float, WAV only)
	Bitrate    int      `json:"bitrate,omitempty"`    // lossy formats, kb/s
	SampleRate int      `json:"sampleRate,omitempty"` // Hz; 0 = the source's
	Stereo     bool     `json:"stereo,omitempty"`     // mono sources become two channels
	Loudness   string   `json:"loudness,omitempty"`   // "" (off), "podcast" (−16), "speech" (−18), "broadcast" (−23)
	Trim       bool     `json:"trim,omitempty"`       // leading and trailing silence
	Extras     []string `json:"extras,omitempty"`     // files saved beside the audio: "script", "subtitles"
}

AudioExport is what the dialog was last set to for one kind.

type Calls

type Calls struct {
	// Enabled runs the call gateway (Twilio can reach AudioSmith). Off by
	// default.
	Enabled bool `json:"enabled,omitempty"`
	// AccountSID is the Twilio account ("AC" + 32 hex digits).
	AccountSID string `json:"accountSid,omitempty"`
	// PublicURL is the tunnel's public https origin, which forwards to the
	// gateway ("https://x.trycloudflare.com").
	PublicURL string `json:"publicUrl,omitempty"`
	// Tunnel is the tool the setup page shows commands for: "cloudflared"
	// ("") or "ngrok".
	Tunnel string `json:"tunnel,omitempty"`
	// GatewayPort is the gateway's port; 0 = DefaultGatewayPort.
	GatewayPort int `json:"gatewayPort,omitempty"`
	// GatewayAll listens on every interface instead of 127.0.0.1 (a
	// tunnel running on another machine).
	GatewayAll bool `json:"gatewayAll,omitempty"`
	// Number is the Twilio number calls come from and to (E.164), and
	// NumberSID its id.
	Number    string `json:"number,omitempty"`
	NumberSID string `json:"numberSid,omitempty"`
	// Voice is the saved voice the agent speaks with (a designed voice,
	// or a cloned one with a verified consent recording); Model the TTS
	// model ("" = the voice's own, else the Studio's).
	Voice string `json:"voice,omitempty"`
	Model string `json:"model,omitempty"`
	// STTModel transcribes the caller ("" = dictation's model).
	STTModel string `json:"sttModel,omitempty"`
	// UserName is who the agent works for ("{name}" in the disclosure).
	UserName string `json:"userName,omitempty"`
	// Disclosure is the AI disclosure's template ("" = the default).
	Disclosure string `json:"disclosure,omitempty"`
	// Greeting is what callers hear in greeting mode.
	Greeting string `json:"greeting,omitempty"`
	// Inbound is what happens to incoming calls: "greeting" ("") or "agent".
	Inbound      string `json:"inbound,omitempty"`
	InboundBrief string `json:"inboundBrief,omitempty"`
	// MaxMinutes is the default limit of a new call (2–30; 0 = 5);
	// InboundMinutes that of incoming agent calls (0 = 5).
	MaxMinutes     int `json:"maxMinutes,omitempty"`
	InboundMinutes int `json:"inboundMinutes,omitempty"`
	// MaxConcurrent is how many calls may run at once (1–2; 0 = 1).
	MaxConcurrent int `json:"maxConcurrent,omitempty"`
	// Record keeps a stereo recording of each call, only when the
	// disclosure spoken says the call is recorded.
	Record bool `json:"record,omitempty"`
	// Verified is when a webhook last passed the signature check (unix
	// seconds; 0 = never): Twilio reached AudioSmith.
	Verified int64 `json:"verified,omitempty"`
}

Calls: the Twilio account, the gateway and how calls behave.

func (Calls) Concurrent

func (c Calls) Concurrent() int

Concurrent is how many calls may run at once.

func (Calls) GatewayAddr

func (c Calls) GatewayAddr() string

GatewayAddr is the address the gateway listens on.

func (Calls) InboundLimit

func (c Calls) InboundLimit() int

InboundLimit is the limit of an incoming agent call.

func (Calls) InboundMode

func (c Calls) InboundMode() string

InboundMode is "greeting" or "agent".

func (Calls) Minutes

func (c Calls) Minutes() int

Minutes is the default limit of a new outbound call.

func (Calls) Port

func (c Calls) Port() int

Port is the gateway's port.

func (Calls) Public

func (c Calls) Public() string

Public is the public URL without a trailing slash.

func (Calls) TunnelTool

func (c Calls) TunnelTool() string

TunnelTool is "cloudflared" or "ngrok".

type Changed

type Changed struct{ Old, New Settings }

Changed is published after an update is saved. Topic "settings.changed".

func (Changed) Topic

func (Changed) Topic() string

type CharacterEngines

type CharacterEngines struct {
	VoicevoxURL string   `json:"voicevoxURL,omitempty"`
	AivisURL    string   `json:"aivisURL,omitempty"`
	Confirmed   []string `json:"confirmed,omitempty"`
}

CharacterEngines are the addresses of the VOICEVOX and AivisSpeech engines AudioSmith connects to ("" = their defaults, voicevox.DefaultURL), and the characters whose terms the user confirmed ("voicevox:<speaker uuid>", asked once for those that are non-commercial or need asking).

type Dictation

type Dictation struct {
	// Enabled registers the global shortcut.
	Enabled bool `json:"enabled"`
	// Shortcut is an accelerator ("CmdOrCtrl+Shift+Space").
	Shortcut string `json:"shortcut"`
	Mode     string `json:"mode"`               // "toggle" | "hold"
	Model    string `json:"model,omitempty"`    // catalogue id; "" = the default
	Language string `json:"language,omitempty"` // BCP-47; "" = detect
	// Cleanup asks the LLM to clean the text (fillers, self-corrections)
	// when one is set up; the deterministic polish always runs.
	Cleanup bool `json:"cleanup"`
	// Vocabulary: names and jargon to expect, at most 1000 characters.
	Vocabulary string `json:"vocabulary,omitempty"`
	Output     string `json:"output"` // "paste" | "copy"
	Sounds     bool   `json:"sounds"`
	// StartSound, StopSound and ErrorSound are the sounds of listening
	// starting and stopping and of an error, as choices of actnowkit's
	// sounds package: "" the default (one of the ActNow family's sounds),
	// "none", "system:<name>" for a macOS system sound, or a family
	// sound's id. SoundVolume is their volume in percent (0: 70; negative:
	// muted).
	StartSound  string `json:"startSound,omitempty"`
	StopSound   string `json:"stopSound,omitempty"`
	ErrorSound  string `json:"errorSound,omitempty"`
	SoundVolume int    `json:"soundVolume,omitempty"`
	Device      string `json:"device,omitempty"` // capture device id; "" = the system's
	// EnabledAt is when the user last set the shortcut or turned
	// dictation on (UTC; zero = before AudioSmith recorded it), for the
	// ActNow family's shortcut conflicts (family.go).
	EnabledAt time.Time `json:"enabledAt,omitzero"`
}

Dictation: system-wide dictation.

type Documents

type Documents interface {
	Get(ctx context.Context, key string) ([]byte, bool, error)
	Put(ctx context.Context, key string, doc []byte) error
}

Documents is where a Store keeps its document; store.Documents (SQLite) satisfies it.

type Dubbing

type Dubbing struct {
	// URLImport allows importing videos from links (yt-dlp, downloaded
	// when it was turned on); YtDlp is the executable.
	URLImport bool   `json:"urlImport,omitempty"`
	YtDlp     string `json:"ytdlp,omitempty"`
	// NoReview runs a new dub straight through, without stopping after
	// the transcript and the translation.
	NoReview bool `json:"noReview,omitempty"`
	// Defaults of a new dub: the TTS model (repo), target languages and
	// translator ("llm", "deepl", "google", "microsoft").
	Model      string   `json:"model,omitempty"`
	Targets    []string `json:"targets,omitempty"`
	Translator string   `json:"translator,omitempty"`
	// CredentialRefs name the ActNow family's shared keys the online
	// translators use, by service ("deepl" → "actnow:vendor.deepl",
	// family spec §8.3); none = AudioSmith's own Keychain items only.
	CredentialRefs map[string]string `json:"credentialRefs,omitempty"`
	// Open is the dub open when the app quit (reopened at the next start).
	Open string `json:"open,omitempty"`
}

Dubbing: the Dub and Batch pages' choices.

type Engine

type Engine struct {
	// MemoryBudgetGB caps resident models across workers; 0 = automatic
	// (engine.Config.MemoryBudget).
	MemoryBudgetGB float64 `json:"memoryBudgetGB"`
}

Engine: resource limits.

type Export

type Export struct {
	Audio map[string]AudioExport `json:"audio,omitempty"`
}

Export: the dialog's last choices by kind ("take", "voice", "convert", "api"). A kind without an entry opens with the dialog's defaults for it, so the zero value is a fresh install's.

type Family

type Family struct {
	// Follow is false for a shared setting AudioSmith keeps for itself
	// ("Use a different setting for this app"), by the family's key
	// ("general.language", "network.proxy", "network.hfEndpoints",
	// "models.root"). A key that is missing follows: new installs follow
	// everything (spec §9.3), so only false is kept (normalize).
	Follow map[string]bool `json:"follow,omitempty"`
	// SharedMigrated: the first-run merge of AudioSmith's settings with
	// the family's (spec §9.4) is done.
	SharedMigrated bool `json:"sharedMigrated,omitempty"`
	// OtherValue are the shared settings whose migration found another
	// value in the family while AudioSmith kept its own: the row says so
	// once, with "Use theirs" (for models.root: the Models page's "Move
	// models…" banner, until moved or "Keep separate").
	OtherValue map[string]bool `json:"otherValue,omitempty"`
	// ConflictShown are the shortcut conflicts already prompted for, by
	// pair (shortcuts.Conflict.Key: "dictation|<bundle id>|<function>"):
	// each pair is prompted once (spec §10.4).
	ConflictShown map[string]bool `json:"conflictShown,omitempty"`
	// KeyFingerprints are the fingerprints of the shared keys AudioSmith
	// uses, by vendor, as it last saw them: when one is deleted for all
	// apps, AudioSmith's own copy of the same key goes too (family spec
	// §8.3).
	KeyFingerprints map[string]string `json:"keyFingerprints,omitempty"`
}

Family: AudioSmith's own bookkeeping for the ActNow family. The shared settings themselves (General.Language, Models.Proxy, Models.Endpoints, Models.CacheDir) stay where they are: internal/family's Shared writes the family's values into them while they follow it (spec §9.3).

func (Family) Follows

func (f Family) Follows(key string) bool

Follows reports whether the shared setting key follows the family's.

func (*Family) SetFollows

func (f *Family) SetFollows(key string, follow bool)

SetFollows sets key's follow flag (only false is kept).

type General

type General struct {
	// Language is the UI language as a BCP-47 tag ("en", "zh-Hans"), or ""
	// to follow the system (mygo.App.PreferredLanguages()); see i18n.Match.
	Language string `json:"language"`
	// CloseToTray keeps AudioSmith running in the menu bar when its
	// window closes, so dictation keeps working (M2).
	CloseToTray bool `json:"closeToTray,omitempty"`
}

General: language and app behaviour.

type LLM

type LLM struct {
	// Providers the user configured, in their order.
	Providers []LLMProvider `json:"providers,omitempty"`
	// Default routes every skill without routes of its own; nil and Auto
	// = automatic: a local Ollama when it answers, else none (cloud
	// providers only by an explicit choice).
	Default []LLMRoute `json:"default,omitempty"`
	// Skills routes one skill (llm.Skill: "dictation_cleanup",
	// "translate"…) to its own providers.
	Skills map[string][]LLMRoute `json:"skills,omitempty"`
	// Manual: Default was chosen by the user (even empty: no LLM).
	Manual bool `json:"manual,omitempty"`
	// LocalModel is the catalogue id of the engine's own language model
	// (provider "local"); "" = catalog.DefaultLLM.
	LocalModel string `json:"localModel,omitempty"`
}

LLM: the language models that help with writing (dictation clean-up, later translation). Keys are not settings: they live in the Keychain as "llm.<provider>".

type LLMProvider

type LLMProvider struct {
	ID       string            `json:"id"`
	Preset   string            `json:"preset,omitempty"`
	Name     string            `json:"name,omitempty"`
	BaseURL  string            `json:"baseURL,omitempty"`
	Model    string            `json:"model,omitempty"`
	Headers  map[string]string `json:"headers,omitempty"`
	JSONMode string            `json:"jsonMode,omitempty"`
	// CredentialRef names the ActNow family's shared key the provider
	// uses ("actnow:vendor.deepseek", family spec §8.3); "" = AudioSmith's
	// own Keychain item only.
	CredentialRef string `json:"credentialRef,omitempty"`
}

LLMProvider mirrors llm.ProviderConfig.

type LLMRoute

type LLMRoute struct {
	Provider    string   `json:"provider"`
	Model       string   `json:"model,omitempty"`
	Temperature *float64 `json:"temperature,omitempty"`
}

LLMRoute mirrors llm.Route.

type Media

type Media struct {
	// FFmpeg is the ffmpeg executable to use; "" = none (AVFoundation
	// only). ffprobe is looked for beside it.
	FFmpeg string `json:"ffmpeg,omitempty"`
	// Origin says where it came from: MediaDownloaded, MediaSystem or
	// MediaCustom.
	Origin string `json:"origin,omitempty"`
}

Media: the optional ffmpeg build that adds formats AVFoundation lacks (MP3, Opus and FLAC output, WebM/MKV input, burnt-in subtitles).

type Migration

type Migration struct {
	Field    string
	From, To any
}

Migration is a change Migrate made to a stored value, for the operations log: the setting's JSON path, the value before and after.

type ModelParams

type ModelParams struct {
	Temperature float64 `json:"temperature,omitempty"`
	TopP        float64 `json:"topP,omitempty"`
	Steps       int     `json:"steps,omitempty"`
	Guidance    float64 `json:"guidance,omitempty"`
	Speed       float64 `json:"speed,omitempty"` // 0 = 1×
}

ModelParams are generation parameters changed from a model's recommendation; 0 = not changed.

type Models

type Models struct {
	CacheDir  string   `json:"cacheDir"`  // "" = hub.CacheDir()
	Endpoints []string `json:"endpoints"` // mirrors to race; nil = default
	// Proxy for downloads: "" = automatic (environment, then the macOS
	// system proxy), "direct", or a proxy URL (hub.Options.Proxy).
	Proxy string `json:"proxy,omitempty"`
	// AutoUnload is the minutes a model stays loaded unused before it is
	// unloaded, on every engine worker (dictation's included); 0 = never.
	AutoUnload int `json:"autoUnload"`
	// HFCredentialRef names the ActNow family's shared Hugging Face token
	// ("actnow:vendor.huggingface", family spec §8.4); "" = AudioSmith's
	// own Keychain item only.
	HFCredentialRef string `json:"hfCredentialRef,omitempty"`
	// MovingTo is the target of a move of the models that has not
	// finished (cancelled, skipped, interrupted): the models it moved are
	// there, so they are looked for there too (#101 M2). "" = none.
	MovingTo string `json:"movingTo,omitempty"`
	// Characters are the outside engines of Japanese character voices
	// (thread #171).
	Characters CharacterEngines `json:"characters,omitzero"`
}

Models: where and how models download.

type Privacy

type Privacy struct {
	// AllowNetworkSearch enables web lookups that are not downloads the
	// user asked for (voice portraits, gallery updates). Off by default.
	AllowNetworkSearch bool `json:"allowNetworkSearch"`
	// LocalOnlyLLM keeps text on this Mac: only local language models
	// (Ollama, LM Studio, the engine) are used (M2).
	LocalOnlyLLM bool `json:"localOnlyLLM,omitempty"`
	// NoWatermark turns off the invisible watermark (AudioSeal) that is
	// added to generated audio by default.
	NoWatermark bool `json:"noWatermark,omitempty"`
	// WatermarkID is this install's id in the watermark's message
	// (1–255, chosen at random on first use; internal/watermark).
	WatermarkID int `json:"watermarkID,omitempty"`
}

Privacy: what may leave the machine.

type Recording

type Recording struct {
	// EchoCancellation records with macOS voice processing: echo
	// cancellation, with noise suppression and automatic gain. Off by
	// default (the processing colours a clone's reference); the engine
	// still turns it on by itself for a recording whose input brings no
	// sound (proto.CaptureParams.AEC).
	EchoCancellation bool `json:"echoCancellation,omitempty"`
}

Recording: what every microphone recording shares (the clone recorder, the consent statement, Transcribe's Record, dictation).

type Service

type Service interface {
	// Get returns the current settings: a copy, from memory (no I/O), so
	// views may call it while building.
	Get() Settings
	// Update applies fn to a copy, saves it, swaps it in and publishes
	// Changed; a no-op change publishes nothing. fn must not block.
	Update(ctx context.Context, fn func(*Settings)) error
}

Service holds the current settings. Goroutine-safe.

type Settings

type Settings struct {
	Version    int        `json:"version"`
	General    General    `json:"general"`
	Appearance Appearance `json:"appearance"`
	Studio     Studio     `json:"studio"`
	Models     Models     `json:"models"`
	Engine     Engine     `json:"engine"`
	Privacy    Privacy    `json:"privacy"`
	// M2 (thread #17, llm.go).
	LLM        LLM        `json:"llm"`
	Transcribe Transcribe `json:"transcribe"`
	Dictation  Dictation  `json:"dictation"`
	Dubbing    Dubbing    `json:"dubbing"` // M4 (thread #19, dubbing.go)
	// M5 (thread #20, api.go).
	API API `json:"api"`
	// M7a (thread #22, setup.go): the first-run setup and the media tools.
	Setup Setup `json:"setup"`
	Media Media `json:"media"`
	Calls Calls `json:"calls"` // M6b (thread #23, calls.go)
	// The Export audio dialog's last choices, per kind (export.go).
	Export Export `json:"export"`
	// Software updates (thread #52, updates.go of the app).
	Updates Updates `json:"updates"`
	// The ActNow family (family.go; internal/family).
	Family Family `json:"family,omitzero"`
	// Every microphone recording (thread #153).
	Recording Recording `json:"recording,omitzero"`
}

Settings is the whole document. Zero values must be valid (they are what a field added in a newer version reads as in an older document, before Migrate fills it in).

func Defaults

func Defaults() Settings

Defaults returns the settings of a fresh install. They match the MVP's behaviour (Kokoro first, autoplay on, system theme, English unless the system language is supported).

func Migrate

func Migrate(data []byte) (Settings, error)

Migrate upgrades a stored document to Version, filling fields added since with their defaults. Unknown fields are dropped.

type Setup

type Setup struct {
	// Done: the wizard ran to its end (or was skipped). A fresh install
	// shows it; an older document without this section is an install that
	// predates the wizard, which counts as done (migrateM7).
	Done bool `json:"done"`
	// Pack is the model pack chosen ("fast", "balanced", "quality",
	// "max"; "" = none), FirstSound whether the welcome line played.
	Pack       string `json:"pack,omitempty"`
	FirstSound bool   `json:"firstSound,omitempty"`
	// Starters mapped the bundled starter voices imported (their file
	// names) to the voices they became. The app no longer bundles or
	// reads them (0.5 cleanup); the field stays so settings files keep
	// their shape.
	Starters map[string]string `json:"starters,omitempty"`
	// Intros are the features whose 「介绍」 dialog showed (0.5 F6: the
	// first visit to Dub, Speech to text…); Settings → General clears it.
	Intros []string `json:"intros,omitempty"`
	// Samples maps a sample opened (its id) to the copy it made, as
	// "<kind>:<id>" (app/samples.go): opening it again asks.
	Samples map[string]string `json:"samples,omitempty"`
}

Setup: the first-run wizard.

type Store

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

Store implements Service over Documents.

func NewMemory

func NewMemory() *Store

NewMemory returns a Store with the defaults that keeps them in memory: for tests, and the UI before the app wires the real one.

func Open

func Open(ctx context.Context, docs Documents, publish func(Changed)) (*Store, error)

Open loads the settings document from docs, migrating it, and returns a Store that saves there. publish (may be nil) receives Changed after each saved update; main wires it to the core.Bus. A document that does not decode is replaced by the defaults at the next update: Open returns the Store with defaults and the error, for the log. A migration that changed stored values is saved at once, so it runs once: a later choice (say "never" again) is the user's (Migrations lists it).

func (*Store) Get

func (s *Store) Get() Settings

Get returns a copy of the current settings, from memory.

func (*Store) Migrations

func (s *Store) Migrations() []Migration

Migrations lists the stored values Open migrated (and saved); nil when none. The app logs them.

func (*Store) Update

func (s *Store) Update(ctx context.Context, fn func(*Settings)) error

Update applies fn to a copy, normalizes it (unknown themes become "system", scales snap to Scales), saves it, swaps it in and publishes Changed. Nothing is saved or published when fn changes nothing.

type Studio

type Studio struct {
	Model    string `json:"model"`    // catalog.Entry.ID last used ("" = the first)
	Autoplay bool   `json:"autoplay"` // play each take when it is ready
	// KeepTakes caps the history: beyond it the oldest takes that are not
	// starred (nor part of a project) are deleted. 0 = keep every take.
	KeepTakes int `json:"keepTakes,omitempty"`
	// Overrides are the user's changes to each model's recommended
	// settings (the catalogue's presets), by catalogue id: picking the
	// model again brings them back; "Restore recommended" clears them.
	Overrides map[string]ModelParams `json:"overrides,omitempty"`
}

Studio: defaults of the TTS form.

type Transcribe

type Transcribe struct {
	Mode     string `json:"mode"`               // "fast" | "accurate"
	Language string `json:"language,omitempty"` // BCP-47; "" = detect
	// FastModel and AccurateModel are catalogue ids; "" = the defaults.
	FastModel     string `json:"fastModel,omitempty"`
	AccurateModel string `json:"accurateModel,omitempty"`
	Device        string `json:"device,omitempty"` // capture device id; "" = the system's
	// Speakers transcribes with the speakers model (thread #48:
	// MOSS-Transcribe-Diarize), labelling who says what, instead of the
	// mode's model.
	Speakers bool `json:"speakers,omitempty"`
}

Transcribe: the Transcribe page's choices.

type Updates

type Updates struct {
	// AutoCheck checks once a day; nil until chosen (or carried over):
	// on (AutoCheckOn).
	AutoCheck *bool `json:"autoCheck,omitempty"`
	// AutoInstall downloads and installs a version the daily check found
	// without asking; it runs after the next restart.
	AutoInstall bool `json:"autoInstall,omitempty"`
	// LastCheck is when a check last answered.
	LastCheck time.Time `json:"lastCheck,omitzero"`
	// Beta takes beta versions (prereleases such as 0.4.0-beta.1)
	// as well as releases. Nil until the user chooses: then a beta copy
	// takes betas and a release copy releases only (the app's
	// betaUpdates).
	Beta *bool `json:"beta,omitempty"`
}

Updates: the in-app updater's preferences (updates.go). Up to 0.4.0-beta.5 the daily check and installing without asking were MyGo's updater plugin's, in its updater.json; the first launch after it carries them over (keepUpdaterChoices).

func (Updates) AutoCheckOn

func (u Updates) AutoCheckOn() bool

AutoCheckOn says whether updates are checked once a day (on unless the user turned it off).

Jump to

Keyboard shortcuts

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