feat(canvas): 多模态表格 - 合并 PR #549 并保留本地交互与校验
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
const (
|
||||
maxCloudAgentBatchRows = 500
|
||||
maxCloudAgentBatchReferences = 6
|
||||
maxCloudAgentBatchReferences = 10
|
||||
maxCloudAgentBatchPromptRunes = 20000
|
||||
)
|
||||
|
||||
@@ -96,7 +96,7 @@ func batchTableNodeFromDocument(doc map[string]any, nodeID string) (map[string]a
|
||||
}
|
||||
columns := creationMaps(table["referenceColumns"])
|
||||
if len(columns) < 1 || len(columns) > maxCloudAgentBatchReferences {
|
||||
return nil, nil, nil, nil, BadAuthRequest("批量创作表必须包含 1 到 6 个参考图列")
|
||||
return nil, nil, nil, nil, BadAuthRequest("批量创作表必须包含 1 到 10 个参考图列")
|
||||
}
|
||||
columnIDs := map[string]bool{}
|
||||
for _, column := range columns {
|
||||
@@ -299,7 +299,7 @@ func prepareCloudAgentBatchTableEdit(repo *repository.Repository, userID, canvas
|
||||
fields = []string{"并发数"}
|
||||
case "add_reference_column":
|
||||
if len(columns) >= maxCloudAgentBatchReferences {
|
||||
return nil, BadAuthRequest("批量创作表最多支持6组参考图")
|
||||
return nil, BadAuthRequest("批量创作表最多支持10组参考图")
|
||||
}
|
||||
if args.RowID != "" || len(args.Patch) != 0 || args.Operation != "" || args.Concurrency != 0 {
|
||||
return nil, BadAuthRequest("新增参考图列不接受其他修改参数")
|
||||
|
||||
@@ -2,12 +2,29 @@ package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"infinite-canvas/backend/internal/model"
|
||||
)
|
||||
|
||||
func TestCloudAgentBatchTableReferenceLimit(t *testing.T) {
|
||||
for _, count := range []int{10, 11} {
|
||||
t.Run(fmt.Sprint(count), func(t *testing.T) {
|
||||
columns := make([]any, count)
|
||||
for i := range columns {
|
||||
columns[i] = map[string]any{"id": fmt.Sprintf("reference-%d", i+1), "label": fmt.Sprintf("参考图 %d", i+1)}
|
||||
}
|
||||
doc := map[string]any{"nodes": []any{map[string]any{"id": "batch", "type": "batch-table", "metadata": map[string]any{"batchTable": map[string]any{"operation": "creative", "concurrency": float64(1), "referenceColumns": columns, "rows": []any{}}}}}}
|
||||
_, _, _, _, err := batchTableNodeFromDocument(doc, "batch")
|
||||
if (err == nil) != (count == 10) {
|
||||
t.Fatalf("reference count %d: unexpected validation result %v", count, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func cloudAgentBatchTableCall(t *testing.T, name, callID string, args any) cloudAgentCall {
|
||||
t.Helper()
|
||||
raw, err := json.Marshal(args)
|
||||
|
||||
Reference in New Issue
Block a user