593feddc3f
- 将模型选择器替换为统一的 shadcn 风格下拉组件 - 移除原生数字输入框的步进箭头样式 - 更新默认定时同步配置为每5分钟执行 - 修复画布助手和节点配置中的模型选择逻辑 - 统一各页面中的模型选择器样式和交互行为
64 lines
1.7 KiB
Go
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"`
|
|
}
|