Documentation
¶
Index ¶
- Variables
- func DataDirPath() string
- func GlobalDBPath() string
- func LLMConfigPath() string
- func ModelsDir() string
- func NovelDirPath(novelID int64) string
- func NovelSkillsDir(novelID int64) string
- func Save(dataDir string) error
- func SaveSettings(db *gorm.DB, s *AppSettings) error
- func Set(cfg *AppConfig)
- func StyleSamplesDir() string
- func UserSkillsDir() string
- type AppConfig
- type AppSettings
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotInitialized = errors.New("指针文件不存在,应用未初始化")
ErrNotInitialized 表示指针文件不存在,应用尚未完成首次初始化。没初始化弹出来初始化界面,如果初始化了但是还是出错就谈配置错误恢复
Functions ¶
func LLMConfigPath ¶
func LLMConfigPath() string
LLMConfigPath 返回 LLM 加密配置文件的固定路径 ~/.goink/llm_config.enc。
func ModelsDir ¶
func ModelsDir() string
ModelsDir 返回 ONNX 模型目录路径。 优先查安装包自带的 runtime/models/,找不到再 fallback 到用户数据目录。
func StyleSamplesDir ¶
func StyleSamplesDir() string
StyleSamplesDir 返回全局风格素材目录 ~/.goink/style_samples/。
Types ¶
type AppConfig ¶
type AppConfig struct {
DataDir string `json:"data_dir"` // 用户选择的数据根目录(保留字段)
}
AppConfig 是启动指针文件 ~/.goink/config.json 的内容。 DataDir 字段保留用于未来扩展,当前数据目录由 platform.DataDir() 确定。
type AppSettings ¶
type AppSettings struct {
ID uint `gorm:"column:id;primaryKey;default:1"`
LastNovelID int64 `gorm:"column:last_novel_id;default:0" json:"last_novel_id"`
SelectedModelKey string `gorm:"column:selected_model_key;default:''" json:"selected_model_key"`
ReasoningEffort string `gorm:"column:reasoning_effort;default:''" json:"reasoning_effort"`
ApprovalMode string `gorm:"column:approval_mode;default:manual" json:"approval_mode"`
LastSessionID string `gorm:"column:last_session_id;default:''" json:"last_session_id"`
UserName string `gorm:"column:user_name;default:''" json:"user_name"`
GitName string `gorm:"column:git_name;default:'Goink'" json:"git_name"`
GitEmail string `gorm:"column:git_email;default:'goink@local'" json:"git_email"`
DismissedVersion string `gorm:"column:dismissed_version;default:''" json:"dismissed_version"` // 用户已忽略的更新版本号
LastUpdateCheckAt time.Time `gorm:"column:last_update_check_at" json:"last_update_check_at"` // 上次自动更新检查时间,用于 12h 节流;零值表示从未检查
}
AppSettings 是全局 app_config 表的单行配置。 适合存放更新频率低,重要的,其他可前端localstorage。 增删配置项直接在此 struct 加减字段即可,GORM 自动迁移。
func LoadSettings ¶
func LoadSettings(db *gorm.DB) (*AppSettings, error)
LoadSettings 从全局库读取配置(单行)。首次使用时自动创建空行。
func (AppSettings) TableName ¶
func (AppSettings) TableName() string
Click to show internal directories.
Click to hide internal directories.