Files
infinite-canvas/model/setting.go
T
HouYunFei 03396a9d18 feat(admin): 添加提示词批量删除和定时同步功能
- 后端新增批量删除提示词接口和实现
- 前端管理页面添加多选和批量删除功能
- 添加定时同步GitHub远程提示词源功能
- 新增系统设置中的提示词同步配置选项
- 更新文档说明新的批量操作和定时同步功能
- 添加相关的测试用例和依赖库
2026-05-22 16:01:00 +08:00

64 lines
1.7 KiB
Go

package model
import "encoding/json"
type SettingKey string
const (
SettingKeyPublic SettingKey = "public"
SettingKeyPrivate SettingKey = "private"
)
// ModelChannel 模型渠道配置。
type ModelChannel struct {
Protocol string `json:"protocol"`
Name string `json:"name"`
BaseURL string `json:"baseUrl"`
APIKey string `json:"apiKey"`
Models []string `json:"models"`
Weight int `json:"weight"`
Enabled bool `json:"enabled"`
Remark string `json:"remark"`
}
// PublicModelChannelSetting 公开模型渠道配置。
type PublicModelChannelSetting struct {
AvailableModels []string `json:"availableModels"`
DefaultModel string `json:"defaultModel"`
DefaultImageModel string `json:"defaultImageModel"`
DefaultTextModel string `json:"defaultTextModel"`
SystemPrompt string `json:"systemPrompt"`
AllowCustomChannel *bool `json:"allowCustomChannel"`
}
// PublicSetting 公开配置。
type PublicSetting struct {
ModelChannel PublicModelChannelSetting `json:"modelChannel"`
}
// PrivateSetting 私有配置。
type PrivateSetting struct {
Channels []ModelChannel `json:"channels"`
PromptSync PromptSyncSetting `json:"promptSync"`
}
// PromptSyncSetting 提示词定时同步配置。
type PromptSyncSetting struct {
Enabled bool `json:"enabled"`
Cron string `json:"cron"`
}
// Setting 系统配置。
type Setting struct {
Key SettingKey `json:"key" gorm:"primaryKey"`
Value json.RawMessage `json:"value" gorm:"serializer:json"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
// Settings 系统公开和私有配置。
type Settings struct {
Public PublicSetting `json:"public"`
Private PrivateSetting `json:"private"`
}