From a73e2b2d2b4e11ecc6953e3a96d5befae009a252 Mon Sep 17 00:00:00 2001 From: eust-w Date: Thu, 25 Jun 2026 12:38:29 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=B7=EF=B8=8F=20Track=20custom=20operat?= =?UTF-8?q?or=20versions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api.md | 10 +++--- docs/custom-operator-manual.zh-CN.md | 24 +++++++++++-- internal/api/operator_image_archive.go | 12 ++++--- internal/api/server.go | 48 ++++++++++++++++++++++++-- internal/api/server_test.go | 18 ++++++++++ internal/domain/types.go | 7 ++++ internal/store/memory.go | 2 ++ internal/store/mongo.go | 2 ++ src/lib/operators.js | 5 +++ src/pages/Operators.tsx | 41 ++++++++++++++++++++-- src/pages/WorkflowEditor.tsx | 39 +++++++++++++++++++++ src/services/api/operators.ts | 2 ++ src/types.ts | 2 ++ tests/frontend/operators.test.mjs | 16 +++++++++ 14 files changed, 211 insertions(+), 17 deletions(-) diff --git a/docs/api.md b/docs/api.md index 38dedf77..e888eefe 100644 --- a/docs/api.md +++ b/docs/api.md @@ -219,23 +219,24 @@ The built-in catalog includes the original workflow primitives plus: "type": "custom", "category": "AI", "description": "执行图像分割", + "version": "1.0.0", "inputs": [{ "id": "in-1", "name": "图像", "type": "image" }], "outputs": [{ "id": "out-1", "name": "结果", "type": "json" }], "image": "ccr.example.com/dataflow/custom-seg:latest" } ``` -`POST /api/operators` registers custom operators only. Operator names, categories, descriptions, images, skill definitions, port IDs, and port names are trimmed before persistence. Operator `type` is immutable after creation and accepts only `builtin` or `custom`; registration requires `custom`. Port `type` accepts only `json`, `image`, `video`, `tensor`, or `file`, and non-empty `transmission` accepts only `bus`, `oss`, `shm`, or `stream`. Operator CPU/MEM resource values must be positive Kubernetes resource quantities, and GPU must be a positive integer when present. +`POST /api/operators` registers custom operators only. Operator names, categories, descriptions, versions, images, image IDs, skill definitions, port IDs, and port names are trimmed before persistence. Operator `version` defaults to `v1` when omitted and must match `[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}`; use it as the business/runtime version visible to workflow authors. `imageId` is the digest-pinned image reference when available and defaults to `image` for directly registered image references. Operator `type` is immutable after creation and accepts only `builtin` or `custom`; registration requires `custom`. Port `type` accepts only `json`, `image`, `video`, `tensor`, or `file`, and non-empty `transmission` accepts only `bus`, `oss`, `shm`, or `stream`. Operator CPU/MEM resource values must be positive Kubernetes resource quantities, and GPU must be a positive integer when present. `POST /api/operators/image-archives/import` -Multipart upload endpoint for a pre-built Docker/OCI image archive. The API stores the archive on the shared workspace PVC, starts a Kubernetes import Job using `CUSTOM_OPERATOR_IMAGE_IMPORTER_IMAGE`, pushes the image to `CUSTOM_OPERATOR_IMAGE_REGISTRY`, reads the pushed digest, and creates a `custom` operator whose `image` is pinned to `repo@sha256:...`. +Multipart upload endpoint for a pre-built Docker/OCI image archive. The API stores the archive on the shared workspace PVC, starts a Kubernetes import Job using `CUSTOM_OPERATOR_IMAGE_IMPORTER_IMAGE`, pushes the image to `CUSTOM_OPERATOR_IMAGE_REGISTRY`, reads the pushed digest, and creates a `custom` operator whose `image` and `imageId` are pinned to `repo@sha256:...`. Form fields: - `file`: required `.tar`, `.tar.gz`, or `.tgz` image archive from `docker save` or an OCI archive tool. - `archiveFormat`: optional, `docker` by default; accepts `docker` or `oci`. -- `name`, `type`, `category`, `description`, `inputs`, `outputs`, `configSchema`, `hyperparams`, `resources`, `skillDefinition`: same operator metadata as `POST /api/operators`; JSON fields are passed as JSON strings. +- `name`, `type`, `category`, `description`, `version`, `inputs`, `outputs`, `configSchema`, `hyperparams`, `resources`, `skillDefinition`: same operator metadata as `POST /api/operators`; JSON fields are passed as JSON strings. When `version` is omitted, it defaults to the final import `tag`. - `repository`: optional repository suffix under `CUSTOM_OPERATOR_IMAGE_REGISTRY`; defaults to a sanitized operator name. - `tag`: optional tag; defaults to an import timestamp. @@ -249,10 +250,11 @@ curl -X POST "$API_BASE/api/operators/image-archives/import" \ -F 'type=custom' \ -F 'category=AI' \ -F 'description=执行图像分割' \ + -F 'version=1.0.0' \ -F 'outputs=[{"id":"out-1","name":"结果","type":"json"}]' ``` -The response includes `image` for the pushed tag, `imageId` for the digest-pinned reference, `digest`, `job`, and the created `operator`. +The response includes `version`, `image` for the pushed tag, `imageId` for the digest-pinned reference, `digest`, `job`, and the created `operator`. ### Runs and Monitoring diff --git a/docs/custom-operator-manual.zh-CN.md b/docs/custom-operator-manual.zh-CN.md index 9880d1fb..7dfef51a 100644 --- a/docs/custom-operator-manual.zh-CN.md +++ b/docs/custom-operator-manual.zh-CN.md @@ -134,15 +134,26 @@ - 主要输入 - 主要输出 -### 3.4 image +### 3.4 version / image / imageId + +`version` 是平台侧展示给工作流作者和审计人员看的算子版本。它不是随便写的备注字段,应该和镜像构建、测试验收、上线记录对应起来。 + +推荐约束: + +- 新算子首次注册使用明确版本,例如 `v1`、`1.0.0`、`2026.06.25` +- 每次镜像行为或输入输出契约发生变化,都应升级 `version` +- 不要把不同实现复用同一个版本号 +- 版本号只能包含字母、数字、下划线、点和短横线,长度不超过 128 + +工作流节点会保存添加节点时的 `operatorVersion` 和 `operatorImageId`,用于后续排障和验收追踪。 `image` 字段表示“运行这个自定义算子时实际拉起的容器镜像”。 当前平台的责任边界很明确: - 平台不会帮你构建自定义镜像 -- 平台不会帮你推送镜像到仓库 -- 平台只会保存你填写的镜像地址,并在运行时直接用它启动 Kubernetes Job +- 如果你直接填写镜像地址,平台只会保存并在运行时直接用它启动 Kubernetes Job +- 如果你上传 Docker/OCI 镜像归档,平台会把归档导入到 POC 配置的 CCR 仓库,并把算子运行镜像固定到 digest 引用 因此,自定义镜像的标准流程是: @@ -150,6 +161,12 @@ 2. 用户把完整镜像地址填写到算子的 `image` 字段 3. 工作流运行时,平台直接拉取这个地址执行 +上传镜像归档的标准流程是: + +1. 用户用 `docker save` 或 OCI 工具导出真实镜像归档 +2. 在算子管理页选择“上传归档”,填写目标仓库、tag 和版本 +3. 平台导入镜像后保存 `imageId=repo@sha256:...`,工作流节点也会记录该 digest + 填写要求: - 必须填写完整镜像引用,格式建议为 `//:` @@ -499,6 +516,7 @@ path = artifact["path"] 3. 有最小测试或脚本级验证 4. 有一次真实工作流回归 5. 有外部副作用核验证据 +6. 版本号、镜像 tag、digest 和验收记录能对应起来 建议证据: diff --git a/internal/api/operator_image_archive.go b/internal/api/operator_image_archive.go index ca84f603..65527cfa 100644 --- a/internal/api/operator_image_archive.go +++ b/internal/api/operator_image_archive.go @@ -198,10 +198,6 @@ func (server *server) handleOperatorImageArchiveImport(writer http.ResponseWrite renderValidationError(writer, issues...) return } - if issues := validateOperatorMetadata(payload.Name, payload.Type, payload.Category, payload.Description, payload.Inputs, payload.Outputs, payload.Resources); len(issues) > 0 { - renderValidationError(writer, issues...) - return - } if payload.Type != "custom" { renderValidationError(writer, validationIssue{Field: "type", Message: "type must be custom when importing an operator image archive"}) return @@ -241,6 +237,11 @@ func (server *server) handleOperatorImageArchiveImport(writer http.ResponseWrite renderValidationError(writer, validationIssue{Field: "tag", Message: "tag must match [A-Za-z0-9_][A-Za-z0-9_.-]{0,127}"}) return } + payload.Version = normalizeOperatorVersion(payload.Version, tag) + if issues := validateOperatorMetadata(payload.Name, payload.Type, payload.Category, payload.Description, payload.Version, payload.Inputs, payload.Outputs, payload.Resources); len(issues) > 0 { + renderValidationError(writer, issues...) + return + } imageRepository := strings.TrimRight(server.customOperatorImageRegistry, "/") + "/" + repository destinationImage := imageRepository + ":" + tag @@ -288,6 +289,7 @@ func (server *server) handleOperatorImageArchiveImport(writer http.ResponseWrite imageID := imageRepository + "@" + strings.TrimSpace(importResult.Digest) payload.Image = imageID + payload.ImageID = imageID server.assignTenant(request, &payload.OrganizationID) item, err := server.store.CreateOperator(request.Context(), payload) if err != nil { @@ -299,6 +301,7 @@ func (server *server) handleOperatorImageArchiveImport(writer http.ResponseWrite "importId": importID, "repository": repository, "tag": tag, + "version": payload.Version, "image": destinationImage, "imageId": imageID, "digest": strings.TrimSpace(importResult.Digest), @@ -317,6 +320,7 @@ func parseOperatorArchiveImportPayload(request *http.Request) (domain.CreateOper Type: normalizeOperatorType(request.FormValue("type")), Category: strings.TrimSpace(request.FormValue("category")), Description: strings.TrimSpace(request.FormValue("description")), + Version: strings.TrimSpace(request.FormValue("version")), SkillDefinition: strings.TrimSpace(request.FormValue("skillDefinition")), OrganizationID: strings.TrimSpace(request.FormValue("organizationId")), } diff --git a/internal/api/server.go b/internal/api/server.go index 9b209717..e2bbfafa 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -2508,6 +2508,26 @@ func normalizeOperatorType(value string) string { return strings.ToLower(strings.TrimSpace(value)) } +var operatorVersionPattern = regexp.MustCompile(`^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$`) + +func normalizeOperatorVersion(value string, fallback string) string { + normalized := strings.TrimSpace(value) + if normalized != "" { + return normalized + } + return strings.TrimSpace(fallback) +} + +func validateOperatorVersion(version string) []validationIssue { + if version == "" { + return nil + } + if !operatorVersionPattern.MatchString(version) { + return []validationIssue{{Field: "version", Message: "version must match [A-Za-z0-9_][A-Za-z0-9_.-]{0,127}"}} + } + return nil +} + func validOperatorType(value string) bool { return value == "builtin" || value == "custom" } @@ -2605,7 +2625,7 @@ func validateOperatorResources(resources *domain.OperatorResources) []validation return nil } -func validateOperatorMetadata(name string, operatorType string, category string, description string, inputs []domain.PortDefinition, outputs []domain.PortDefinition, resources *domain.OperatorResources) []validationIssue { +func validateOperatorMetadata(name string, operatorType string, category string, description string, version string, inputs []domain.PortDefinition, outputs []domain.PortDefinition, resources *domain.OperatorResources) []validationIssue { issues := make([]validationIssue, 0) if name == "" { issues = append(issues, validationIssue{Field: "name", Message: "name is required"}) @@ -2619,6 +2639,7 @@ func validateOperatorMetadata(name string, operatorType string, category string, if description == "" { issues = append(issues, validationIssue{Field: "description", Message: "description is required"}) } + issues = append(issues, validateOperatorVersion(version)...) issues = append(issues, validatePortDefinitions("inputs", inputs)...) issues = append(issues, validatePortDefinitions("outputs", outputs)...) issues = append(issues, validateOperatorResources(resources)...) @@ -2639,10 +2660,15 @@ func (server *server) handleOperatorsCreate(writer http.ResponseWriter, request payload.Description = strings.TrimSpace(payload.Description) payload.Inputs = normalizePortDefinitions(payload.Inputs) payload.Outputs = normalizePortDefinitions(payload.Outputs) + payload.Version = normalizeOperatorVersion(payload.Version, "v1") payload.Image = strings.TrimSpace(payload.Image) + payload.ImageID = strings.TrimSpace(payload.ImageID) payload.SkillDefinition = strings.TrimSpace(payload.SkillDefinition) payload.Resources = normalizeOperatorResources(payload.Resources) - if issues := validateOperatorMetadata(payload.Name, payload.Type, payload.Category, payload.Description, payload.Inputs, payload.Outputs, payload.Resources); len(issues) > 0 { + if payload.ImageID == "" { + payload.ImageID = payload.Image + } + if issues := validateOperatorMetadata(payload.Name, payload.Type, payload.Category, payload.Description, payload.Version, payload.Inputs, payload.Outputs, payload.Resources); len(issues) > 0 { renderValidationError(writer, issues...) return } @@ -2683,7 +2709,9 @@ type operatorPatch struct { Inputs *[]domain.PortDefinition `json:"inputs"` Outputs *[]domain.PortDefinition `json:"outputs"` ConfigSchema *map[string]any `json:"configSchema"` + Version *string `json:"version"` Image *string `json:"image"` + ImageID *string `json:"imageId"` SkillDefinition *string `json:"skillDefinition"` Hyperparams *[]domain.HyperParam `json:"hyperparams"` Resources *domain.OperatorResources `json:"resources"` @@ -2737,9 +2765,17 @@ func (server *server) handleOperatorsUpdate(writer http.ResponseWriter, request if payload.ConfigSchema != nil { next.ConfigSchema = *payload.ConfigSchema } + if payload.Version != nil { + next.Version = normalizeOperatorVersion(*payload.Version, "") + } if payload.Image != nil { next.Image = strings.TrimSpace(*payload.Image) } + if payload.ImageID != nil { + next.ImageID = strings.TrimSpace(*payload.ImageID) + } else if payload.Image != nil && next.ImageID == "" { + next.ImageID = next.Image + } if payload.SkillDefinition != nil { next.SkillDefinition = strings.TrimSpace(*payload.SkillDefinition) } @@ -2749,7 +2785,13 @@ func (server *server) handleOperatorsUpdate(writer http.ResponseWriter, request if payload.Resources != nil { next.Resources = normalizeOperatorResources(payload.Resources) } - if issues := validateOperatorMetadata(next.Name, next.Type, next.Category, next.Description, next.Inputs, next.Outputs, next.Resources); len(issues) > 0 { + if normalizeOperatorType(next.Type) == "custom" { + next.Version = normalizeOperatorVersion(next.Version, "v1") + if next.ImageID == "" { + next.ImageID = next.Image + } + } + if issues := validateOperatorMetadata(next.Name, next.Type, next.Category, next.Description, next.Version, next.Inputs, next.Outputs, next.Resources); len(issues) > 0 { renderValidationError(writer, issues...) return } diff --git a/internal/api/server_test.go b/internal/api/server_test.go index a9d3ceaf..48d355ad 100644 --- a/internal/api/server_test.go +++ b/internal/api/server_test.go @@ -4830,6 +4830,12 @@ func TestOperatorMetadataValidationAndNormalization(t *testing.T) { if created.Image != "registry.example.com/custom/operator:v1" { t.Fatalf("expected trimmed image, got %q", created.Image) } + if created.Version != "v1" { + t.Fatalf("expected default operator version v1, got %q", created.Version) + } + if created.ImageID != created.Image { + t.Fatalf("expected imageId to default to image, got %q", created.ImageID) + } if len(created.Inputs) != 1 || created.Inputs[0].ID != "in-1" || created.Inputs[0].Name != "input" || created.Inputs[0].Type != domain.PortTypeJSON || created.Inputs[0].Transmission != "bus" { t.Fatalf("expected normalized input port, got %#v", created.Inputs) } @@ -4869,6 +4875,7 @@ func TestOperatorMetadataValidationAndNormalization(t *testing.T) { {name: "invalid output transmission", payload: `{"outputs":[{"id":"out-1","name":"result","type":"json","transmission":"mailbox"}]}`}, {name: "duplicate output ids", payload: `{"outputs":[{"id":"dup","name":"one","type":"json"},{"id":"dup","name":"two","type":"json"}]}`}, {name: "invalid resources", payload: `{"resources":{"gpuLimit":"half"}}`}, + {name: "invalid version", payload: `{"version":"bad version"}`}, } { recorder := httptest.NewRecorder() handler.ServeHTTP( @@ -4896,6 +4903,7 @@ func TestOperatorMetadataValidationAndNormalization(t *testing.T) { "type":" CUSTOM ", "category":" AI ", "description":" Updated description ", + "version":" 2.0.0 ", "outputs":[{"id":"out-2","name":" tensor result ","type":" TENSOR ","transmission":" STREAM "}], "resources":{"cpuLimit":" 750m ","memoryLimit":" 2Gi "} }`))), @@ -4910,6 +4918,9 @@ func TestOperatorMetadataValidationAndNormalization(t *testing.T) { if updated.Name != "Updated Operator" || updated.Type != "custom" || updated.Category != "AI" || updated.Description != "Updated description" { t.Fatalf("expected normalized operator update, got %#v", updated) } + if updated.Version != "2.0.0" { + t.Fatalf("expected normalized operator version, got %q", updated.Version) + } if len(updated.Outputs) != 1 || updated.Outputs[0].ID != "out-2" || updated.Outputs[0].Name != "tensor result" || updated.Outputs[0].Type != domain.PortTypeTensor || updated.Outputs[0].Transmission != "stream" { t.Fatalf("expected normalized updated output port, got %#v", updated.Outputs) } @@ -5267,6 +5278,7 @@ func TestOperatorImageArchiveImportCreatesOperatorWithDigestImage(t *testing.T) var response struct { Repository string `json:"repository"` Tag string `json:"tag"` + Version string `json:"version"` Image string `json:"image"` ImageID string `json:"imageId"` Digest string `json:"digest"` @@ -5278,6 +5290,9 @@ func TestOperatorImageArchiveImportCreatesOperatorWithDigestImage(t *testing.T) if response.Repository != "team-vision/segment-operator" || response.Tag != "v1_test" { t.Fatalf("unexpected repository/tag: %#v", response) } + if response.Version != "v1_test" { + t.Fatalf("expected version to default to tag, got %#v", response) + } expectedTaggedImage := "ccr.example/dataflow-poc/custom-operators/team-vision/segment-operator:v1_test" expectedImageID := "ccr.example/dataflow-poc/custom-operators/team-vision/segment-operator@" + digest if response.Image != expectedTaggedImage || response.ImageID != expectedImageID || response.Digest != digest { @@ -5293,6 +5308,9 @@ func TestOperatorImageArchiveImportCreatesOperatorWithDigestImage(t *testing.T) if stored == nil || stored.Image != expectedImageID { t.Fatalf("expected imported operator to use digest image %q, got %#v", expectedImageID, stored) } + if stored.ImageID != expectedImageID || stored.Version != "v1_test" { + t.Fatalf("expected imported operator to persist imageId/version, got %#v", stored) + } if stored.Name != "Archive Import Operator" || stored.Type != "custom" || stored.Category != "AI" { t.Fatalf("expected normalized operator metadata, got %#v", stored) } diff --git a/internal/domain/types.go b/internal/domain/types.go index 05366103..6b55f8cb 100644 --- a/internal/domain/types.go +++ b/internal/domain/types.go @@ -149,6 +149,9 @@ type WorkflowNodeData struct { Description string `json:"description" bson:"description"` Inputs []PortDefinition `json:"inputs" bson:"inputs"` Outputs []PortDefinition `json:"outputs" bson:"outputs"` + OperatorID string `json:"operatorId,omitempty" bson:"operatorId,omitempty"` + OperatorVersion string `json:"operatorVersion,omitempty" bson:"operatorVersion,omitempty"` + OperatorImageID string `json:"operatorImageId,omitempty" bson:"operatorImageId,omitempty"` Image string `json:"image,omitempty" bson:"image,omitempty"` SkillDefinition string `json:"skillDefinition,omitempty" bson:"skillDefinition,omitempty"` Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"` @@ -207,7 +210,9 @@ type OperatorRecord struct { Inputs []PortDefinition `json:"inputs" bson:"inputs"` Outputs []PortDefinition `json:"outputs" bson:"outputs"` ConfigSchema map[string]any `json:"configSchema,omitempty" bson:"configSchema,omitempty"` + Version string `json:"version,omitempty" bson:"version,omitempty"` Image string `json:"image,omitempty" bson:"image,omitempty"` + ImageID string `json:"imageId,omitempty" bson:"imageId,omitempty"` SkillDefinition string `json:"skillDefinition,omitempty" bson:"skillDefinition,omitempty"` Hyperparams []HyperParam `json:"hyperparams,omitempty" bson:"hyperparams,omitempty"` Resources *OperatorResources `json:"resources,omitempty" bson:"resources,omitempty"` @@ -690,7 +695,9 @@ type CreateOperatorInput struct { Inputs []PortDefinition `json:"inputs"` Outputs []PortDefinition `json:"outputs"` ConfigSchema map[string]any `json:"configSchema,omitempty"` + Version string `json:"version,omitempty"` Image string `json:"image,omitempty"` + ImageID string `json:"imageId,omitempty"` SkillDefinition string `json:"skillDefinition,omitempty"` Hyperparams []HyperParam `json:"hyperparams,omitempty"` Resources *OperatorResources `json:"resources,omitempty"` diff --git a/internal/store/memory.go b/internal/store/memory.go index 7f037e95..7e68a9fe 100644 --- a/internal/store/memory.go +++ b/internal/store/memory.go @@ -473,7 +473,9 @@ func (store *MemoryStore) CreateOperator(_ context.Context, input domain.CreateO Inputs: clone(input.Inputs), Outputs: clone(input.Outputs), ConfigSchema: clone(input.ConfigSchema), + Version: input.Version, Image: input.Image, + ImageID: input.ImageID, SkillDefinition: input.SkillDefinition, Hyperparams: clone(input.Hyperparams), Resources: clone(input.Resources), diff --git a/internal/store/mongo.go b/internal/store/mongo.go index a65e0430..f4b0d215 100644 --- a/internal/store/mongo.go +++ b/internal/store/mongo.go @@ -333,7 +333,9 @@ func (store *MongoStore) CreateOperator(ctx context.Context, input domain.Create Inputs: input.Inputs, Outputs: input.Outputs, ConfigSchema: input.ConfigSchema, + Version: input.Version, Image: input.Image, + ImageID: input.ImageID, SkillDefinition: input.SkillDefinition, Hyperparams: input.Hyperparams, Resources: input.Resources, diff --git a/src/lib/operators.js b/src/lib/operators.js index 5f66e8b2..3413f29a 100644 --- a/src/lib/operators.js +++ b/src/lib/operators.js @@ -43,7 +43,9 @@ export function buildOperatorPayload(source = {}, overrides = {}) { inputs: normalizePorts(overrides.inputs ?? source.inputs), outputs: normalizePorts(overrides.outputs ?? source.outputs), configSchema: deepClone(overrides.configSchema ?? source.configSchema), + version: trimString(overrides.version ?? source.version), image: trimString(overrides.image ?? source.image), + imageId: trimString(overrides.imageId ?? source.imageId), skillDefinition: trimString(overrides.skillDefinition ?? source.skillDefinition), hyperparams: deepClone(overrides.hyperparams ?? source.hyperparams ?? []), resources: deepClone(overrides.resources ?? source.resources), @@ -88,5 +90,8 @@ export function getOperatorPayloadIssue(source = {}, overrides = {}) { if (!payload.description) { return "算子描述不能为空"; } + if (payload.version && !/^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/.test(payload.version)) { + return "算子版本只能包含字母、数字、下划线、点和短横线,长度不超过 128"; + } return validatePorts("inputs", payload.inputs) || validatePorts("outputs", payload.outputs); } diff --git a/src/pages/Operators.tsx b/src/pages/Operators.tsx index 53165aff..ec828340 100644 --- a/src/pages/Operators.tsx +++ b/src/pages/Operators.tsx @@ -70,6 +70,7 @@ export default function Operators() { const [newOp, setNewOp] = useState>({ type: "custom", category: "CV", + version: "v1", inputs: [], outputs: [], hyperparams: [], @@ -169,7 +170,15 @@ export default function Operators() { setIsModalOpen(false); setEditingOpId(null); setActiveTab("basic"); - setNewOp({ type: "custom", category: "CV", inputs: [], outputs: [], hyperparams: [], skillDefinition: "" }); + setNewOp({ + type: "custom", + category: "CV", + version: "v1", + inputs: [], + outputs: [], + hyperparams: [], + skillDefinition: "", + }); resetArchiveUpload(); }; setActionError(""); @@ -339,6 +348,7 @@ export default function Operators() { setNewOp({ type: "custom", category: "CV", + version: "v1", inputs: [], outputs: [], hyperparams: [], @@ -431,6 +441,11 @@ export default function Operators() { > {op.type === "builtin" ? "Built-in" : "Custom"} + {op.version && ( + + {op.version} + + )} {op.skillDefinition && ( @@ -615,6 +630,17 @@ export default function Operators() { +
+ + setNewOp({ ...newOp, version: e.target.value })} + /> +
+