droboticflow/docs/slice-name-dictionary.md

48 lines
2.8 KiB
Markdown

# Project slice-name dictionary
Project detail keeps its existing horizontal navigation. Inside **语义标签**,
administrators can switch between **动作描述字典** and **切片字典**. Both use the
same explicit add/edit/remove interaction. Editing creates a replacement entry
for this project's selection, so other projects sharing an entry are unaffected.
In the annotator's slice phase, **从切片字典选择** searches active names enabled
for the current project and fills the selected slice's existing `name` field.
The name is selected from the project dictionary. Selection does not seek video, change boundaries or
submit work; **确认全部切片** retains the existing save/materialization flow.
An absent or unavailable dictionary blocks a new slice confirmation. Editing/removing dictionary
entries never rewrites already saved slice names or historical delivery data.
## Compatibility and API
- `AnnotationLabelRecord.kind`: `action` or `slice`; missing legacy kind means
`action`. Purpose cannot be changed on an existing entry.
- Existing `/api/annotation-labels` defaults to the action dictionary. Creating a
slice entry uses the same admin-only POST with `kind: "slice"`. Organization-wide
slice listing is admin-only.
- `GET /api/projects/{id}/slice-labels`: returns `labelIds` and active `items`,
constrained to the authorized project.
- `PUT /api/projects/{id}/slice-labels`: admin-only `{labelIds: [...]}`. Rejects
foreign-organization, inactive and wrong-purpose IDs, and deleting projects.
- Project selections store `sliceLabelIds` independently from existing `labelIds`.
Memory/Mongo updates change only the relevant dictionary selection.
- Task/project switches abort stale reads; reopening the picker refreshes names.
Load failures retain saved names and expose retry rather than manual name entry.
## Post-confirmation naming and submission
The annotation view has a visible **选择切片名称 / 修改切片名称** button. It opens
the existing atomic slice-edit panel; choosing a name preserves action content,
boundaries and history. E remains a keyboard entry. Renaming never requires
the destructive initial **重新切片** operation.
Unnamed kept slices may be saved as drafts while editing. Formal submission
requires a nonempty classification name, including after a split/merge was
saved: an unchanged empty workspace name is not a historical-name exemption.
Unchanged nonempty historical names retain their existing compatibility rule;
new/changed names still require the enabled project dictionary. This rule does
not prohibit unnamed or pending actions, which remain distinct from invalid or
discarded data. Existing deliveries and customer records are not rewritten.
Tests cover legacy action compatibility, purpose and project isolation, permissions,
independent updates, removal without history mutation, and the existing name callback.