Files
infinite-canvas/model/setting.go
T
HouYunFei 9c2fa25380 feat(config): 更新系统配置默认值和文档说明
- 将 allowCustomChannel 默认值从 false 改为 true
- 修改 allowCustomChannel 字段类型为指针类型以支持默认值设置
- 更新相关文档中对 allowCustomChannel 功能的描述
- 修复画布页面中对话框节点打开逻辑,避免文本节点意外触发编辑对话框
- 将用户配置中的渠道模式默认值从 remote 改为 local
2026-05-22 08:11:13 +08:00

57 lines
1.5 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"`
}
// 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"`
}