后端新增 preferences 与 prompt_customizations 表及对应接口, 支持 BYOK 模型渠道密钥落库(仅回显掩码)与按任务类型定制 平台提示词模板;前端新增 /settings 页面及入口。
28 lines
941 B
Go
28 lines
941 B
Go
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"`
|
|
}
|