feat(merge): 以官方 main 为基底融合 PR#530 多维表格与本地定制
- 多维表格(canvas-batch-table-node/use-canvas-batch-table/canvas-batch-table 等)以 PR#530 实现为主 - 保留官方 main 全部新功能:banner/画布版本历史/提示词编辑/方舟 Agent Plan/支付导出 - 移植本地定制:ddcat 多参考图校验、万有引力 lxmone 连接错误提示、Description v20(v24)、自建插件(a6api/metaso-h3/antigravity-proxy/lxmone)、seccomp、Windows 脚本 - 迁移版本升至 v24(官方 v20-23 banner/版本历史 + 我们的 Description 列) - 修复官方缺失的 markdownPlainText import
This commit is contained in:
1 parent
4eaa28b807
commit
9b9a7f4a72
63 files changed
+9087
-892
No files matched your search
@@ -19,6 +19,11 @@ import (
|
||||
)
|
||||
|
||||
func runImageTask(ctx context.Context, input canvasGenerationInput) (map[string]interface{}, error) {
|
||||
if input.Config.InterfaceType == string(model.ChannelInterfaceOpenAIImage) {
|
||||
if err := validateOpenAIImageInput(input); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if _, ok := declarativeProtocolAdapterForContext(ctx, input.Config.InterfaceType); ok {
|
||||
return runDeclarativeProtocolTask(ctx, input)
|
||||
}
|
||||
@@ -113,6 +118,30 @@ func runImageTask(ctx context.Context, input canvasGenerationInput) (map[string]
|
||||
return map[string]interface{}{"mode": "image", "images": images}, nil
|
||||
}
|
||||
|
||||
// Validate before selecting the plugin so declarative and handwritten paths share
|
||||
// the same write boundary. Invalid explicit sizes must not silently become auto.
|
||||
func validateOpenAIImageInput(input canvasGenerationInput) error {
|
||||
if input.Mask != nil && len(input.ReferenceImages) == 0 {
|
||||
return errors.New("蒙版编辑必须提供与蒙版同尺寸的源图片")
|
||||
}
|
||||
raw := strings.TrimSpace(input.Config.Size)
|
||||
if raw == "" || raw == "auto" {
|
||||
return nil
|
||||
}
|
||||
size := normalizePixelSize(raw)
|
||||
widthText, heightText, ok := strings.Cut(size, "x")
|
||||
width, widthErr := strconv.Atoi(widthText)
|
||||
height, heightErr := strconv.Atoi(heightText)
|
||||
if !ok || widthErr != nil || heightErr != nil || width <= 0 || height <= 0 {
|
||||
return errors.New("图片尺寸无效:请选择支持的宽高比或填写正整数像素尺寸,如 1024x1024")
|
||||
}
|
||||
base, err := url.Parse(input.Config.BaseURL)
|
||||
if err == nil && strings.EqualFold(base.Hostname(), "api.ddcat.pronhubcn.com") && (width > 4096 || height > 4096) {
|
||||
return errors.New("ddcat 图片尺寸超过上游限制:宽和高均不得超过 4096 像素")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func runGeminiImageTask(ctx context.Context, input canvasGenerationInput) (map[string]interface{}, error) {
|
||||
if input.Mask != nil {
|
||||
return nil, errors.New("Gemini Images 不支持蒙版编辑,请移除蒙版后重试")
|
||||
|
||||
Reference in new issue
Block a user