package model import "time" // PreferenceID 当前没有用户体系,配置与偏好固定为一条全局记录。 const PreferenceID = "default" // APIKeyConfig 用户自带的模型渠道(BYOK)。 // 密钥只落在本机数据库,对外输出时由 service 脱敏,不回传明文。 type APIKeyConfig struct { ID string `json:"id"` Provider string `json:"provider"` Label string `json:"label"` BaseURL string `json:"baseUrl"` APIKey string `json:"apiKey"` Model string `json:"model"` Enabled bool `json:"enabled"` } // Preference 配置与用户偏好。 // 提示词定制单独存放,见 model.PromptCustomization 与 internal/prompts。 type Preference struct { ID string `gorm:"primaryKey;size:32" json:"id"` APIKeys []APIKeyConfig `gorm:"type:text;serializer:json" json:"apiKeys"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }