feat(config): 更新系统配置默认值和文档说明
- 将 allowCustomChannel 默认值从 false 改为 true - 修改 allowCustomChannel 字段类型为指针类型以支持默认值设置 - 更新相关文档中对 allowCustomChannel 功能的描述 - 修复画布页面中对话框节点打开逻辑,避免文本节点意外触发编辑对话框 - 将用户配置中的渠道模式默认值从 remote 改为 local
This commit is contained in:
@@ -122,7 +122,7 @@
|
||||
| `defaultImageModel` | string | 默认图片模型 |
|
||||
| `defaultTextModel` | string | 默认文本模型 |
|
||||
| `systemPrompt` | string | 系统提示词 |
|
||||
| `allowCustomChannel` | bool | 是否允许用户自定义渠道,允许时前端可提供走后端渠道和自定义 baseUrl 直连两种模式 |
|
||||
| `allowCustomChannel` | bool | 是否允许用户自定义渠道,默认允许,关闭后前端只提供走后端渠道的模式 |
|
||||
|
||||
`private.value` 当前字段:
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"defaultImageModel": "gpt-image-2",
|
||||
"defaultTextModel": "gpt-5.5",
|
||||
"systemPrompt": "",
|
||||
"allowCustomChannel": false
|
||||
"allowCustomChannel": true
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -35,14 +35,14 @@
|
||||
| `defaultImageModel` | string | 默认图片模型,从 `availableModels` 中选择 |
|
||||
| `defaultTextModel` | string | 默认文本模型,从 `availableModels` 中选择 |
|
||||
| `systemPrompt` | string | 系统提示词 |
|
||||
| `allowCustomChannel` | boolean | 是否允许用户在配置弹窗中切换为本地直连渠道 |
|
||||
| `allowCustomChannel` | boolean | 是否允许用户在配置弹窗中切换为本地直连渠道,默认允许 |
|
||||
|
||||
用户侧请求模式:
|
||||
|
||||
| 模式 | 说明 |
|
||||
| --- | --- |
|
||||
| 云端渠道 | 使用后端 `/api/v1/*` 代理接口,请求会按模型名匹配 `private.value.channels` 中的可用渠道 |
|
||||
| 本地直连 | 仅 `allowCustomChannel` 为 `true` 时可选,用户在浏览器本地配置 `baseUrl`、`apiKey` 和模型列表后直接请求模型接口 |
|
||||
| 本地直连 | 默认可选;`allowCustomChannel` 关闭后不可选,用户在浏览器本地配置 `baseUrl`、`apiKey` 和模型列表后直接请求模型接口 |
|
||||
|
||||
## private.value
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ type PublicModelChannelSetting struct {
|
||||
DefaultImageModel string `json:"defaultImageModel"`
|
||||
DefaultTextModel string `json:"defaultTextModel"`
|
||||
SystemPrompt string `json:"systemPrompt"`
|
||||
AllowCustomChannel bool `json:"allowCustomChannel"`
|
||||
AllowCustomChannel *bool `json:"allowCustomChannel"`
|
||||
}
|
||||
|
||||
// PublicSetting 公开配置。
|
||||
|
||||
@@ -33,6 +33,10 @@ func normalizePublicSetting(setting model.PublicSetting) model.PublicSetting {
|
||||
if setting.ModelChannel.AvailableModels == nil {
|
||||
setting.ModelChannel.AvailableModels = []string{}
|
||||
}
|
||||
if setting.ModelChannel.AllowCustomChannel == nil {
|
||||
enabled := true
|
||||
setting.ModelChannel.AllowCustomChannel = &enabled
|
||||
}
|
||||
return setting
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const emptySettings: AdminSettings = {
|
||||
defaultImageModel: "",
|
||||
defaultTextModel: "",
|
||||
systemPrompt: "",
|
||||
allowCustomChannel: false,
|
||||
allowCustomChannel: true,
|
||||
},
|
||||
},
|
||||
private: { channels: [] },
|
||||
|
||||
@@ -488,7 +488,7 @@ function InfiniteCanvasPage() {
|
||||
setConnections((prev) => [...prev, { id: nanoid(), ...connection }]);
|
||||
setSelectedNodeIds(new Set([newNode.id]));
|
||||
setSelectedConnectionId(null);
|
||||
setDialogNodeId(newNode.id);
|
||||
if (type !== CanvasNodeType.Text) setDialogNodeId(newNode.id);
|
||||
setPendingConnectionCreate(null);
|
||||
setConnecting(null);
|
||||
}, [effectiveConfig.imageModel, effectiveConfig.model, effectiveConfig.size, message, setConnecting]);
|
||||
@@ -598,7 +598,7 @@ function InfiniteCanvasPage() {
|
||||
setNodes((prev) => [...prev, newNode]);
|
||||
setSelectedNodeIds(new Set([newNode.id]));
|
||||
setSelectedConnectionId(null);
|
||||
setDialogNodeId(newNode.id);
|
||||
if (type !== CanvasNodeType.Text) setDialogNodeId(newNode.id);
|
||||
},
|
||||
[effectiveConfig.imageModel, effectiveConfig.model, effectiveConfig.size, getCanvasCenter],
|
||||
);
|
||||
@@ -1782,7 +1782,6 @@ function InfiniteCanvasPage() {
|
||||
setNodes((prev) => [...prev, node]);
|
||||
setSelectedNodeIds(new Set([node.id]));
|
||||
setSelectedConnectionId(null);
|
||||
setDialogNodeId(node.id);
|
||||
}, [screenToCanvas, size.height, size.width]);
|
||||
|
||||
const handleAssetInsert = useCallback((payload: InsertAssetPayload) => {
|
||||
|
||||
@@ -24,7 +24,7 @@ export type AiConfig = {
|
||||
export const CONFIG_STORE_KEY = "infinite-canvas:ai_config_store";
|
||||
|
||||
export const defaultConfig: AiConfig = {
|
||||
channelMode: "remote",
|
||||
channelMode: "local",
|
||||
baseUrl: "https://api.openai.com",
|
||||
apiKey: "",
|
||||
model: "gpt-image-2",
|
||||
|
||||
Reference in New Issue
Block a user